# Turn time system algorithm

how does the time system work?

assume it takes 10 seconds for you to fire a gun to a monster 10 tiles away. that monster’s movement speed is 1 tile every 13 seconds. then how many shots can you take before the monster can close in on you?

how does the game deal with uneven actions? do you get “free” turns if you are faster?

The game uses 1 second ticks, but actions can take longer in which case you spend your action and the enemy spend their action. Once your action has been spent the next turn starts, X ticks later. Enemy attacks can interrupt your action.
If movement speed isn’t a multiple/divisor of tiles per tick I believe the any extra time left over from the previous action gets used as a bonus to the next tick.

Everything has a speed, and a movement pool specified in movement points. When the movement pool reaches 0 or less than that, their turn ends, and it moves onto the next creature.

Each action takes some amount of movement points, which are then subtracted from the movement pool of a creature. While the creature still has movement points, it can continue to take actions.

At the beginning of each turn, a creature has it’s speed added to it’s movement pool. If it’s movement pool is still negative or 0, it’s turn is skipped.

So, in your scenario, both creatures have a speed of 100, and a movement pool of 100.
The monster moving 1 tile costs 100 * 13 movement points, and you firing and aiming the gun costs 100 * 10 movement points.
You fire the gun on your first turn, and the monster moves one tile on it’s first turn.
You then have 9 turns skipped while you recover your movement points, and shoot the monster. The monster monster also skips these nine turns, and you can take another action while the monster is still 3 turns in the hole.

In total, it will take the monster 130 turns to reach you, meaning you can fire your gun 13 times.
If you are faster you can, in extreme cases, perform multiple actions per turn, and in less extreme ones, perform multiple actions more quickly, because you both go less negative from performing an action, and recover more quickly.

1 Like

I’ve described this in detail over in an other topic…:

thanks.

so technically the world freezes until you use up you action points? in your turn you can throw 5 stones if you have the action points. but the the rest of the game is still waiting for your turn to finish?

Yes. Try turning on speedydex, and debug in a couple hundred dexterity (it’s an easy way to get a lot of free move points) to examine this behaviour.

Yes, or just tweak the config file. For one of my debugging/test runs I couldn’t set the dexterity that high (as that would mess with other things), so I’ve made these changes to the file:

``````  {
"type": "EXTERNAL_OPTION",
"name": "SPEEDYDEX_MIN_DEX",
"stype": "int",
"value": -1
},
{
"type": "EXTERNAL_OPTION",
"name": "SPEEDYDEX_DEX_SPEED",
"stype": "int",
"value": 21474836
}
``````

Just… don’t try to build anything that is built quickly, as it will bug the game out.
Also, some actions (like reading, crafting, building and waiting, among others) that require under one turn or partial turns will use up / end on a full turn. This is done by design.