Coder Social home page Coder Social logo

run-across's Introduction

Star Dodge - Dynamic Level Generation

Click to watch the gameplay video Watch the gameplay video

Introduction

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.

Procedural Level Generation

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.

Grid-Based Approach

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.

Level Generation Algorithm

Our level-generation algorithm works as follows:

  1. 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.

  2. 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.

  3. 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.

Managing Tile Pool

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. Dynamic_tile_generation

Embracing the Randomness

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.

Play Star Dodge

Click here to play Star Dodge on itch.io

Conclusion

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!

run-across's People

Contributors

ymanawat avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.