Data structure choice
The first PCG algorithm we will develop will create the game environment that our player will explore. We are going to build a game world that never ends; that is, as long as you have enough memory. As the player explores the world, our algorithm will create and place more pieces of the Game Board.
Remember, the Game Board is what we are calling the ground area in which the player will walk on. The Game Board is made up of small, rectangular, 2D sprites that we refer to as tiles. In this chapter, we will start with floor tiles, which the player will walk on. We will then randomly add wall tiles to a new layer as an obstacle to the player.
The concept of the 2D Game Board can be visualized as a grid. A grid can be easily implemented as an array or list data structure to track the tiles we layout for the Game Board. As the player explores, we will add to our list references to our newly created tiles. We can then use this list to look up any tile on our Game Board. The...