Spielerando

Turn Order by Initiative

Turn order by initiative lets the fastest fighters act first. Give every fighter a score from its speed plus a roll, sort once, and keep that order for the whole round. Settle ties the same way every time, skip fighters who have fallen, and make late arrivals wait for the next round.

Also called: Initiative, Speed order, Turn queue, Action order.

Clay creatures stand on a tiled arena while a row of round glass portraits floats above them in turn order, with the glowing first portrait joined by a ribbon of light to the hare archer who steps forward.
Brindlemoor, an invented clay-figure tactics game. Invented game, image generated with AI.

Paste this to your AI

Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.

Add "Turn Order by Initiative" to my game.

What it should do: A fight with several fighters needs a fair and readable answer to who goes next. A score from speed and a little luck makes fast fighters act earlier without making the order the same every fight, and a fixed order per round lets the player plan ahead.

Build it exactly as this state machine. First check that it fits my game, then build it like this:

```mermaid
stateDiagram-v2
  [*] --> before
  before: Before the fight
  first: First turn
  later: Later turn
  over: Fight over
  before --> first: fight begins
  before --> over: only one team came
  first --> later: turn ends or waits
  first --> over: last enemy falls
  later --> first: new round starts
  later --> over: enemy falls or limit
  over --> [*]
```

Use these starting values:
- rollRange: 6
- maxRounds: 30 rounds
- rerollEachRound: 0

Watch out for these common mistakes:
- Two fighters with the same score: Tell your AI: break ties in a fixed way. Here the faster fighter goes first, and after that whoever joined the fight first.
- Someone joins in the middle of a round: Tell your AI: put the newcomer in by score, but if its place has already passed this round, it waits for the next round.
- The acting fighter falls on their own turn: Tell your AI: keep fallen fighters in the list until the round is over and skip them, and pass the turn on at once if the acting fighter fell.
- Waiting without end: Tell your AI: allow one wait per fighter per round, and refuse it when nobody living is left to act after them.
- A roll outside the range: Tell your AI: hold every roll to a whole number between 0 and the highest roll, and count a broken roll as 0.
- A fight nobody can win: Tell your AI: set a round limit and call the fight a draw when it is reached.

Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

What it does

A fight with several fighters needs a fair and readable answer to who goes next. A score from speed and a little luck makes fast fighters act earlier without making the order the same every fight, and a fixed order per round lets the player plan ahead.

How it runs, as a diagram

Everything it can be in, and what moves it on. Your AI builds from exactly this.

fight beginsonly one team cameturn ends or waitslast enemy fallsnew round startsenemy falls or limitBefore the fightFirst turnLater turnFight over
How it runs, as a diagram
  • Before the fight → First turn: fight begins
  • Before the fight → Fight over: only one team came
  • First turn → Later turn: turn ends or waits
  • First turn → Fight over: last enemy falls
  • Later turn → First turn: new round starts
  • Later turn → Fight over: enemy falls or limit

Good starting values

ValueStart withWhat it changes
rollRange6The highest roll that is added to speed. Six means luck can move a fighter up or down by a few places but a much faster fighter still mostly goes first. Zero removes luck completely.
maxRounds30 roundsAfter this many rounds the fight is called a draw. Two fighters who cannot hurt each other would otherwise go on forever.
rerollEachRound0One rolls again at the start of every round, zero keeps the first rolls. Keeping them lets the player learn who is next and plan, so zero is the safer start. One makes every round a surprise.

What usually goes wrong

Two fighters with the same score

If the sort only looks at the score, equal fighters can swap places from one run to the next, depending on how the list happened to be arranged. The player sees an order that changes for no reason.

Fix: Tell your AI: break ties in a fixed way. Here the faster fighter goes first, and after that whoever joined the fight first.

Someone joins in the middle of a round

A reinforcement with a high score is put at the front of the list, so it either acts twice or pushes the current fighter aside and makes them act again.

Fix: Tell your AI: put the newcomer in by score, but if its place has already passed this round, it waits for the next round.

The acting fighter falls on their own turn

A poison or a trap can knock the acting fighter out. If the game removes them from the list, everyone behind them moves one place forward and the next fighter is skipped.

Fix: Tell your AI: keep fallen fighters in the list until the round is over and skip them, and pass the turn on at once if the acting fighter fell.

Waiting without end

If a fighter can wait as often as they like, two fighters can wait for each other forever, and the fight never moves on.

Fix: Tell your AI: allow one wait per fighter per round, and refuse it when nobody living is left to act after them.

A roll outside the range

A roll that is negative, huge or not a number lets a fighter act first every time or breaks the sort.

Fix: Tell your AI: hold every roll to a whole number between 0 and the highest roll, and count a broken roll as 0.

A fight nobody can win

Two sides that cannot hurt each other go through rounds without end.

Fix: Tell your AI: set a round limit and call the fight a draw when it is reached.

How to check it works

Works well with

Common questions

how do i add turn order to my game

Paste this: Add turn order by initiative. Each fighter gets a score of its speed plus a roll from 0 to 6, the fighters act from the highest score to the lowest, ties go to the faster fighter and then to whoever joined first, and the order stays the same for the whole round. Skip fighters who have fallen.

should initiative be rolled every round or once

Once is the safer start. The player can learn who comes next and plan around it. Rolling every round makes fights less predictable, but it is harder to read and to balance.

what happens when two fighters have the same initiative

Decide it by a rule and write it down. Here the faster fighter goes first, and after that whoever joined the fight first. Never leave it to the order the list happens to be in.

can a new enemy join in the middle of a round

Yes. Place it by its score, but if that place has already passed in this round, let it wait for the next round. Otherwise it acts out of turn or twice.

Where it comes from

We could not find a reliable origin for this one yet.

Where this mechanic comes from has not been researched yet.

Games are named only as references. Names and marks belong to their owners, and nothing here is endorsed by them.

What was checked

This is what separates the blueprint from a catalogue entry: the values on this page come from code that runs.

Your AI gets the code

Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it