Click to watch the gameplay video
Welcome to Star Dodge, an endless arcade game that features dynamic level generation! In this exciting game, players take control of a star, dodging obstacles in a procedurally generated world. Creating endless and unpredictable levels that keep players engaged and challenged.
In the realm of procedural level generation, there are several approaches to consider. I chose a grid-based (TileMap) approach, as it provided us with the flexibility and control we needed for generating our endless levels.
The grid-based approach divides the game world into a grid of cells, with each cell representing a tile in our game. Tiles can be anything from lines to obstacles, and we place them on the grid to construct our level.
Our level-generation algorithm works as follows:
-
Calculating Y-index: To ensure that the level remains within the screen boundaries, we calculate a
y_index
based on the screen height, which defines the row where the tiles will be placed. -
Placing Tiles: We place random lines first and then alternate with obstacles for diversity. Each generated tile is assigned to a specific cell on the grid using
(x, y_index)
coordinates. -
Infinite Progression: To create the feeling of infinite gameplay, we continuously move the
x
coordinate of the tile position. As the player progresses, the grid seamlessly generates new tiles ahead, creating the illusion of an unending world.
To ensure optimal performance and avoid excessive memory usage, we implemented a dynamic tile management system. We only generate and keep tiles that are close to the screen, and as the player moves forward, we remove tiles that are no longer visible.
The true beauty of dynamic level generation lies in the element of surprise. No two gameplay sessions are alike, thanks to the randomness infused into the level-generation process. Players must adapt quickly to new challenges, making each playthrough an exciting and unique experience.
Click here to play Star Dodge on itch.io
Star Dodge's power of procedural generation, we create an ever-changing world of obstacles and challenges for players to conquer. Embrace the unpredictability, test your reflexes, and embark on an infinite journey!