Designing a Movement System
Brainstorming
I need the game to reflect that some creatures are faster than others. I don't like the time systems that most roguelikes use because they're opaque. I prefer the standard "move + action" turn structure used by Fire Emblem et al.
So on they player's turn, they will move up to N
tiles and then select an action. There's a couple ways to handle this:
- The player is shown a highlighted circle of tiles they can move to. Then they select a path and confirm.
- The player moves 1 tile at a time with WASD until they run out of movement or cancel the move.
Option 1 requires extra UI work and extra inputs, but the user gains the ability to backtrack during a move.
Option 2 requires little UI work and minimal inputs, but the user is committed to each move they make.
I prefer option 2, as it's less UI for both me and the user to deal with. Also, it makes move interruptions very intuitive. For example, if the player steps on a trap or blunders into an enemy the trap should immediately trigger and the rest of their turn get cancelled.
Turns
In order for the movement system to be a meaningful change from what I currently have, I'll add another player unit.
Each unit has a field movement: Int
determining how many tiles they can move on their turn. Then it switches to the other player's turn.
Data Model
There needs to be a queue to track whose turn it is:
turn_queue: Queue EntityID
The game also needs a state machine:
sum GameState
= SelectingMove { moves_left: Int }
| ExecutingMove { next_coord: Coord }
| EndingTurn
Criteria
- The each unit moves with the WASD keys, and there is a UI element saying how many moves are left in their turn.
- When a unit runs out of movement or cancels, it becomes the next unit's turn.
- Since the units are allies, the user should see everything that any unit can see.