Settle two players picking the same hero at the same moment
Both click the last free hero within a blink and both screens say "yours". Here is the order in which to decide, what the loser gets, and the small case where one player swaps and another takes the freed hero in the same batch.
Why this works
When two people act at the same moment, someone has to be first, and only the one place that holds the truth can say who. Ordering by a number that place stamps, not by anyone's own clock, is the same for everybody, and a loser must be told so the screen stops claiming otherwise.
When not to use it
Skip it when heroes can be shared, so two players may play the same one, or when choosing happens one at a time in turns. There is no race then, and a simple first-come list or a plain turn order is enough.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- A diagram of every state
- 23 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 "Settle two players picking the same hero at the same moment" (read_entry online-character-pick-race-between-players) 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