A downloadable template

Download NowName your own price

A simple algorithm for procedural level generation in Construct 3. Whether you are about to start making your Rogue-like and cannot be bothered to write the level generation code yourself or would like to see how one works in action I got your back!

In brief,  the code (and the algorithm) works like this:

  1. Initialize an empty array. In our case, 0 means there are not rooms in that cell, 1 - there is a room.
  2. Choose a starting position. By default it always chooses the middle of the array. You can also choose it to be random (see in code).
  3. Choose a random direction (up, down, left, right). See if that direction is within the array grid, if so mark that cell with a 1. Do this a "walk_length" of times.
  4. Repeat 2-3 "number_of_walks" times.
  5. Once done, loop through the array and create a room at a position where 1 is present.

The code is briefly commented out and includes some tips to how you can adjust the level generation to fit it in your game.

Distribution license:

All materials here are free to use for both personal and commersial projects. Selling it (adjusted or not) is not permitted.

PS

If you need help with the code, have found a bug, have some ideas on how to make it better please reach out to me on twitter @AtwoodPer

Tagging me on Twitter or just linking to this itch.io page would be very nice, but not mandatory. Consider donating if this helped you out and you would want me to make more of similar things.

StatusReleased
CategoryAssets
Rating
Rated 5.0 out of 5 stars
(1 total ratings)
Authorpoppants
Tags2D, assets, Dungeon Crawler, Open Source, Roguelike, sourcecode

Download

Download NowName your own price

Click download now to get access to the following files:

The Drunkard's Walk.c3p 51 kB

Leave a comment

Log in with itch.io to leave a comment.