Backstab bonuses fire from the wrong side because angles wrap around
A bonus for hitting an enemy from behind sounds easy until the enemy faces nearly straight right and the attacker stands just above it. The numbers say they are far apart, but they are not. This entry covers the angle comparison and how the bonus changes the hit chance.
Why this works
Directions live on a circle, where the end meets the start. Two directions are as far apart as the shorter way round, never the long way. Compare them that way and left, right and straight behind mean the same thing wherever the circle happens to be cut.
When not to use it
Skip it when the player cannot know where an enemy faces, for example when enemies turn too quickly to read or have no clear front. A bonus for something invisible feels random. Use a clear signal first, or reward positioning in another way.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 28 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 "Backstab bonuses fire from the wrong side because angles wrap around" (read_entry flank-and-backstab-bonus-from-facing-angle-wraparound) 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