Maze generation

Get help using Construct 2

Post » Wed Feb 18, 2015 10:23 pm

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!
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Feb 18, 2015 10:45 pm

Been meaning to try this method:
http://en.wikipedia.org/wiki/Maze_gener ... ion_method
But recursion in C2 is a bit wanky.
Image Image
B
164
S
49
G
114
Posts: 7,671
Reputation: 79,541

Post » Wed Feb 18, 2015 11:17 pm

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 :D
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Feb 18, 2015 11:26 pm

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.
Image Image
B
164
S
49
G
114
Posts: 7,671
Reputation: 79,541

Post » Wed Feb 18, 2015 11:26 pm

There are a few ways to randomize maps. Most of the ways I found in Unity used Perlin noise. here is one plugin : perlin-noise-plugin_t56955
B
28
S
8
G
4
Posts: 767
Reputation: 5,940

Post » Wed Feb 18, 2015 11:34 pm

newt wrote: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 :D Putting it in a plugin is obviously nicer but I didn't want to have to get into that..

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


Unfortunately that's a Construct class plugin :/ There's a lot of CC threads talking about maze generation.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Feb 19, 2015 8:53 pm

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.
You do not have the required permissions to view the files attached to this post.
B
84
S
27
G
70
Posts: 4,934
Reputation: 49,560

Post » Thu Feb 19, 2015 9:16 pm

R0J0hound wrote: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.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Feb 19, 2015 11:36 pm

Ooh interesting. I might use something similar as well.
B
14
S
5
G
1
Posts: 189
Reputation: 1,536

Post » Fri Feb 20, 2015 4:42 pm

I have had success emulating this method:
http://tinysubversions.com/spelunkyGen/
B
64
S
16
G
9
Posts: 371
Reputation: 8,696

Next

Return to How do I....?

Who is online

Users browsing this forum: bambo and 1 guest