# Turn time system algorithm

**URL:** <https://discourse.cataclysmdda.org/t/turn-time-system-algorithm/25955>\
**Category:** The Bunker\
**Created:** [February 21, 2021, 4:36pm UTC](https://discourse.cataclysmdda.org/t/turn-time-system-algorithm/25955 "2021-02-21T16:36:15Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Valase](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/valase/32/6972_2.png) [@Valase](https://discourse.cataclysmdda.org/u/Valase)\
**Post date:** [February 21, 2021, 4:54pm UTC](https://discourse.cataclysmdda.org/t/turn-time-system-algorithm/25955/4 "2021-02-21T16:54:05Z")

</div>

> [@wrathofgomorrah](#):
>
> how does the game deal with uneven actions? do you get “free” turns if you are faster?

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

> [@Have Zombies' speed been increased?](https://discourse.cataclysmdda.org/t/have-zombies-speed-been-increased/25431/5):
>
> > [@Have Zombies' speed been increased?](https://discourse.cataclysmdda.org/t/have-zombies-speed-been-increased/25431/3):
> >
> > By the way, how does the movement system work?
> 
> To my understanding:  
> A “turn”, equal to an ingame second.  
> Moving from one tile to another does cost move points (well, all actions, really).  
> Different terrain have different costs, as seen by the “Move cost” value if you look at a terrain (default keys: `x` or `;`).  
> All beings in the game has something that (for this explanation) we will call a “move point account”… Each turn that passes will set the being’s account to the current speed value and subtract the cost of the action taken.  
> If the player’s character move point account reaches 0 or he “ends” the turn (by pressing `5` or `.`), the next turn will start and - in case that the player’s character made an action that takes up more move points than it had on its account before the turn ended - substracts the remainder of the move cost from the account.  
> The move/action only finishes or gets executed if its remaining cost is zero.
> 
> Since I’ve explaind that very complicated, let’s take an example:
> 
> > **Mathematical example**
> >
> > Disclaimer: It’s possible that I’ve mixed up a few things, like the order or that actions would take place before the turn ends… But nonetheless, it should be accurate in its base…
> > 
> > ```
> > Start of a fresh turn...
> > Acc = Character's move Account: 100
> > Speed = Character's base Speed: 100
> > Cost = Move cost of the ground: 100
> > 
> > Character gets ordered to move one tile...
> > Acc = Acc - Cost = 0
> > Turn ends (character hasn't moved yet).
> > 
> > New turn beginns.
> > Acc = Speed = 100
> > Acc = Acc - (remaining) Cost (which is 0) = 100
> > Action done, character moves 1 tile.
> > 
> > Waiting for the next order.
> > 
> > ```
> > 
> > Now let’s add in a few more things: The `Base Move Cost` as shown in the character sheet (`@`) and also two monsters, a fast one and a slow one.
> > 
> > ```
> > Start of a fresh turn...
> > Cost = Move cost of the ground: 100
> > C_Acc = Character's move Account: 100
> > C_Bmc = Character's Base Move Cost: 106
> > C_Speed = Character's base Speed: 100
> > FZ_Acc = Fast Zombie's move Account: 150
> > FZ_Speed = Fast Zombie's Speedt: 150
> > SZ_Acc = Slow Zombie's move Account: 95
> > SZ_Speed = Slow Zombie's Speed: 95
> > 
> > Character gets ordered to move one tile...
> > Actual move cost = (Cost / 100) * (C_Bmc / 100) * 100 = 106
> > C_Acc = C_Acc - Actual move cost = -6
> > Character's remaining cost = 6
> > Character's account reached 0 and it didn't move.
> > Character did all it could, now monsters move...
> > 
> > Fast Zombie tries to move towards player...
> > FZ_Acc = FZ_Acc - Cost = 150 - 100 = 50
> > Fast Zombie's remaining cost = 0
> > The fast Zombie still has points left in his account and no remaining cost...
> > Fast Zombie moves a tile.
> > Fast Zombie tries to move towards player, again...
> > FZ_Acc = FZ_Acc - Cost = 50 - 100 = -50
> > Fast Zombie's remaining cost = 50
> > 
> > Slow Zombie tries to move towards player...
> > SZ_Acc = FZ_Acc - Cost = -5
> > Slow Zombie's remaining cost = 5
> > Slow Zombie didn't move.
> > 
> > All accounts reached 0, turn ends.
> > Moved tiles: Character: 0, Fast Zombie: 1, Slow Zombie: 0
> > 
> > New turn beginns.
> > C_Acc = C_Speed = 100
> > FZ_Acc = FZ_Speed = 150
> > SZ_Acc = SZ_Speed = 95
> > 
> > C_Acc = C_Acc - Character's remaining cost (which is 6) = 94
> > Action done, character moves 1 tile.
> > Waiting for the next order...
> > 
> > Let us assume it should move another tile...
> > C_Acc = C_Acc - Actual move cost = 94 - 106 = -12
> > Character's remaining move cost = 12
> > 
> > Character's done, let's move the monsters...
> > FZ_Acc = FZ_Acc - Fast Zombie's remaining cost = 150 - 50 = 100
> > Fast Zombie moves one tile...
> > FZ_Acc = FZ_Acc - Cost = 0
> > Fast Zombie (technically) moves another tile...
> > 
> > SZ_Acc = SZ_Acc - Slow Zombie's remaining cost = 95 - 5 = 90
> > Slow Zombie moves one tile...
> > SZ_Acc = SZ_Acc - Cost = 90 - 100 = -10
> > Slow Zombie's remaining cost = 10
> > 
> > Turn end...
> > Total tile's moved: Character: 1, Fast Zombie: 2 (or 3), Slow Zombie: 1
> > 
> > And so on, and so forth...
> > 
> > ```

---

_[View the full topic](https://discourse.cataclysmdda.org/t/turn-time-system-algorithm/25955)._
