An enemy that notices you at half a chance per second reacts faster on fast screens
Rolling a chance every frame ties the odds to the frame rate, so the same game plays differently on a fast monitor. The fix is a conversion, and it also decides what happens after a lag spike, where the obvious scaling gives answers above one.
Why this works
A promise like half a chance each second is about time, not about screen redraws. Work out the chance of nothing happening over a short step and let those steps multiply, and any speed of screen adds up to the same result, even after a long freeze.
When not to use it
Skip it when the event is not a matter of luck but a timer, such as an attack that always comes after a set wait. Then count down real seconds and no chance is needed. Also skip it when steps are always the same length.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 19 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 "An enemy that notices you at half a chance per second reacts faster on fast screens" (read_entry per-second-chance-converted-to-per-frame-chance) 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