Spielerando

Check that a player cannot run out of ammo before a mandatory fight is won

The gate opens only when four tough enemies are down. The player arrives with a handful of bullets after wasting the rest, and there is nothing left to finish the job. Here is how to estimate the shots a fight really needs and how much to top up.

Why this works

A fight is fair only if the player can be certain to have enough to win it. Counting the worst case, with misses, and trusting only what is guaranteed, never what might drop, shows the gap before a player falls into it.

When not to use it

It is not needed when the player always has an unlimited weapon, such as a melee attack, or when the shortage is the point, like a survival game. There let the player be short and give them another way out.

In the full entry

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

Say this to your AI

Use the Spielerando entry "Check that a player cannot run out of ammo before a mandatory fight is won" (read_entry ammo-runs-out-before-the-required-kill) 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