Spielerando

Make a flashlight fail with a flicker that gets worse as the battery drains

A flashlight that simply gets dimmer is dull, and one that flickers randomly every frame just buzzes and hurts the eyes. A good dying light gives the player a few readable moments and then takes them away. Here is how to build that so it repeats the same on every run.

Why this works

A flicker only reads as a flicker if each dark or bright moment lasts long enough to be seen. Fixing the state for short spans, and making bad spans more likely as power fades, gives a warning before the end.

When not to use it

Don't use it where darkness must never be a surprise, such as in a game for very young children or one with strict accessibility needs. Offer a steady dimming or a clear meter there instead.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • 24 lines of example code with 4 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Make a flashlight fail with a flicker that gets worse as the battery drains" (read_entry dying-flashlight-flicker-by-battery) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP