Troops that flee, come back one tick later and flee again
Morale makes battles feel alive, but a simple threshold makes units flicker between running and fighting right at the boundary. Players see soldiers twitching on the spot. Here is how to give fleeing and rallying different conditions so a rout looks like a rout.
Why this works
Fear spreads fast and calm returns slowly. Giving falling and recovering different conditions, with a minimum time in between, lets a flight read clearly to the eye instead of flickering around a single line.
When not to use it
Leave it out when your game has no mood in the troops at all, such as a puzzle battle, or when players dislike losing control of their soldiers. If control matters more than drama, let units fight to the end or give the player a rally button.
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
- 21 lines of example code with 3 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Troops that flee, come back one tick later and flee again" (read_entry morale-rout-and-rally-cooldown) 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