Storing the Dungeon Map
Most games include a map, typically an array of tiles. For a dungeon crawler game, the map structure represents the dungeon layout. Platform games use maps to represent the location of ledges, platforms, and ladders. A Minesweeper game represents the discovered areas and the positions of mines on the map. Most two-dimensional games represent their map as a series of tiles in a grid pattern. Each tile has a type describing how that tile is rendered—and what happens if you try to enter it.
You’ll represent your map as a vector. Each entry in the vector represents one tile, so for an 80x50 map you will have 4,000 tiles. Tiles represent portions of the map, and the same tile graphic is re-used to represent tiles of a particular ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access