Giter Site home page Giter Site logo

gamemakerdiscord / random-level-gen-gms2 Goto Github PK

View Code? Open in Web Editor NEW
47.0 6.0 11.0 50 KB

A random level generation example (similar to Nuclear Throne) using GameMaker Studio 2

License: MIT License

Game Maker Language 100.00%
gms2 gamemaker example

random-level-gen-gms2's Introduction

Random Level Generation

A random level generation example (similar to Nuclear Throne) using GameMaker Studio 2.

Maintained by: uheartbeast

This example project uses a DS Grid to generate a random level. This level generation process looks somewhat like this:

  • Create a grid
  • Fill the grid with VOID cells (some number that represents an area that can't be walked on)
  • Create a controller at the center of the grid
  • Move the controller in a direction (0, 90, 180, 270) and create a FLOOR cell (some number that represents an area that CAN be walked on) in each location
  • If the controller hits a wall reverse the direction
  • Every step the controller has a random chance of choosing a new direction
  • Run the controller for a fixed amount of steps (400 or so)
  • Once the level has been generated, loop through and remove any isolated VOID cells (This just makes the level look cleaner and a bit less "random")

After generating the level, we fill the game room with tiles using the bitmasking method taught in this article: https://gamedevelopment.tutsplus.com/tutorials/how-to-use-tile-bitmasking-to-auto-tile-your-level-layouts--cms-25673

Finally, we use binary math to detect for collisions in the level's DS Grid.

random level gen gif

random-level-gen-gms2's People

Contributors

benjaminkanderson avatar jujuadams avatar sidorakh avatar uheartbeast avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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