Moving Entities in a Turn-Based Game
Learn how to make the turn-based movements for the player and the enemy.
We'll cover the following
Most traditional roguelike games (Nethack, Rogue, Cogmind) are turn-based. You move, and then the enemies move. Many popular non-roguelike games like Diablo started as turn-based games, with the real-time movement aspect added after playtesting. Turn-based play provides for very tactical gameplay—you win games based on careful positioning and movement and not with your reflexes. It’s also required by the game design document we wrote in Design a Dungeon Crawler.
For this turn-based model, we need three states:
- Player moving
- Monsters moving
- Waiting for input
When waiting for input, our system only needs to poll the keyboard and mouse, so lets save someone’s laptop battery and minimize the number of idle actions. Separating input from action helps the game know what we want to do before simulating action, but generally allows the adventurer to be treated just like other entities in the game.
The turn structure looks like this:
Get hands-on with 1400+ tech skills courses.