Maze generation

  • I'd like to create random mazes like this one. Does anyone have some existing code to share? I've read lots of posts on the forum, like this one and had a go at implementing an algorithm directly in C2, but if I could leverage others' efforts it would be great. I've also tried the Roguelike plugin, which is awesome, but the difference between what I want and those solutions is that a wall takes up a cell, which is not what I want. My aim is to navigate player and monster sprites around the maze, with each maze cell equal to a player movement position.

    Thanks!

  • Been meaning to try this method:

    http://en.wikipedia.org/wiki/Maze_gener ... ion_method

    But recursion in C2 is a bit wanky.

  • Yeah I've tried the randomized Prim off that page. I could probably get it to work eventually but the wording of the algorithm is a bit ambiguous to me. And the pure mathematical descript?ons are beyond me

  • Thats why I was interested in the division method, its just pick a wall, divide a wall... with a some recursion.

    Its the picking that gets complicated.

    On the other hand it fits well for tile-based stuff.

  • There are a few ways to randomize maps. Most of the ways I found in Unity used Perlin noise. here is one plugin :

  • Thats why I was interested in the division method, its just pick a wall, divide a wall... with a some recursion.

    Its the picking that gets complicated.

    On the other hand it fits well for tile-based stuff.

    hmm might have a look. I was thinking of taking some existing Javascript and just e?ecuting it with ExecJS Putting it in a plugin is obviously nicer but I didn't want to have to get into that..

    There are a few ways to randomize maps. Most of the ways I found in Unity used Perlin noise. here is one plugin :

    Unfortunately that's a Construct class plugin :/ There's a lot of CC threads talking about maze generation.

  • The issue of the wall being a grid is purely a cosmetic one. In the attached capx cells are even positions in the array and walls are odd. After the maze is generated I loop over the cells and choose an animation frame for the sprite based on what walls are around the cell using this equation:

    right + 2*down + 4*left + 8*up

    You could also just as easily create thin walls around the cell depending on what walls are there.

  • The issue of the wall being a grid is purely a cosmetic one. In the attached capx cells are even positions in the array and walls are odd. After the maze is generated I loop over the cells and choose an animation frame for the sprite based on what walls are around the cell using this equation:

    right + 2*down + 4*left + 8*up

    You could also just as easily create thin walls around the cell depending on what walls are there.

    Thanks! That's very interesting. I'm sure I can do something with this.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ooh interesting. I might use something similar as well.

  • I have had success emulating this method:

    http://tinysubversions.com/spelunkyGen/

  • I have had success emulating this method:

    http://tinysubversions.com/spelunkyGen/

    Looks cool but seems to generate maps for rogue-like type games whereas I was after traditÑ–onal maze types, but another great resource, thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)