Adding Spatial Memory

Learn how to give the player a memory of where they’ve been.

Whether the adventurer is unspooling thread as they work through a minotaur’s labyrinth or scribbling a map as they explore, it’s reasonable to expect them to have some memory of where they’ve been.

The adventurer’s memory also gives the player valuable clues as to which parts of the dungeon they haven’t explored yet, reducing player frustration. In this section, we’ll give the player the ability to recall where they’ve been and render areas they remember but aren’t currently visible differently.

Revealing the map

Add a new vector named revealed in map.rs, containing the revealed status of each tile. If the player has seen the tile, the tile’s entry in revealed is set to true. If they haven’t, it’s false. Create a new vector and set the entire revealed vector to false:

Get hands-on with 1200+ tech skills courses.