Random "Cave" Generator - Cellular Automata

Post your own tutorials, guides and demos.

Post » Sun Aug 15, 2010 3:36 pm

Here is a .cap for random cave generation, using the Rougelike method of Cellular Automata.

Use it, abuse it, modify it if you like.

It works with any sized tile as long as your layout is exactly divisible by the tiles width and height. Works great in standard layout size with tiles that are 32x32 and 64x64.

It's not perfect but does the trick. It is commented with groups to make it as easy as possible to understand. If you can't figure it out let me know.

Thanks to Lucid and Shviller for input and general help.

[color=#FF0000:1kdi32g3]Download here:[/color:1kdi32g3] http://dl.dropbox.com/u/604141/Public%2 ... tomata.cap

[color=#FF0000:1kdi32g3]Or as EXE:[/color:1kdi32g3] http://dl.dropbox.com/u/604141/Public%2 ... tomata.rar
NOTE: The exe file is now more advanced and has new features. If I abandon working on it I will post the .cap with the updated features.

Keys to note:
G - Throws a Glowstick
B - Places a bomb
D - Detonates the bomb


~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Sun Aug 15, 2010 8:21 pm

Nice to see someone else playing with Cellular Automata.

I made a map generator using CA HERE and also a platform game with CA platforms HERE

Unfortunately your example doesn't work when I run it.

I get a error about the "For" loop reaching 1million iterations in event 3.

I have had this error before on downloaded caps that have loops but when I create my own loop it runs fine.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Mon Aug 16, 2010 2:13 am

Strange, Lucid got the same error but it works fine here :/

This was made in Construct 99.91 and he is using .92 so maybe that's the problem somewhere? I'll make it into an .exe file as well for anyone who wants to just see how it works.

I'll also be sure to check out your examples as well. I would like to refine it a little bit but not really sure where to go from this point. Thanks Minor :D

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon Aug 16, 2010 2:42 am

Wow, dungeon generators are popular lately. ;)

It doesn't run for me, either. Same error as Minor, and I'm using 0.99.92.

It had some looping that I didn't understand at the beginning of the event sheet. Such as in the very first event:

+ System: Start of layout
-> System: Stop loop "filly"
-> Wand: Set X to Tile.width/2
-> Wand: Set Y to Tile.height/2
-> System: Start loop "fillx" and run 1 times

I'll have to look into the start and stop loop thingies there, as I've never really noticed those before.

I've recently been using groups in a very similar way that you did, for flow control in tick-based loops and such. It works really nicely.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

Post » Mon Aug 16, 2010 3:17 am

I keep on getting a .cap error too.
an now I am getting an error for the .exe also.
I really want to see this.
B
21
S
4
G
4
Posts: 280
Reputation: 2,934

Post » Mon Aug 16, 2010 3:28 am

Pretty cool. The only problem I can see is that some areas have no access.

To get it to work for 0.99.92 change the condition in event 3 from
+ System: For "filly" from 1 to layoutheight/Tile.height
to
+ System: On loop "filly"

as a workaround for now...
B
79
S
24
G
54
Posts: 4,755
Reputation: 40,773

Post » Mon Aug 16, 2010 7:59 am

[quote="R0J0hound":27y5gmfd]Pretty cool. The only problem I can see is that some areas have no access.

To get it to work for 0.99.92 change the condition in event 3 from
+ System: For "filly" from 1 to layoutheight/Tile.height
to
+ System: On loop "filly"

as a workaround for now...[/quote:27y5gmfd]

Hmm problem with that, is that it will keep filling beyond the end of the layout I think.

Maybe I should download .92 and get it working in that. I just don't usually go the the latest latest build a I have learnt my lesson in the past from doing that.

I also noticed that some areas were not accessible, I hope to make a fix for that, however I thought they could act as a secret area or something should the player have a digging tool or explosives etc.

May work on this later tonight and see what other things I can add, but for now I will download .92 and see if I can get it working correctly there.

~Sol


*EDIT*
Rojo, that actually fixes it. It still stops the loop fill once it hits the end of the layout as it should. Nice one, probably saved me an hour of messing about there.

Will update the .cap and .exe now to be compatible with v99.92 users.

~Sol


*EDIT AGAIN*
Ok, so the .exe is totally broken now, it gets an error "ERROR LOADING APPBLOCK (1813)". Not sure why, but the cap should now work.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon Aug 16, 2010 8:12 am

I'm on 0.9.92 here so looks like it could be the problem.

Also for cut off rooms. This guy has a method that seems to work but I never got round implementing it.

http://pixelenvy.ca/wa/ca_cave.html
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Mon Aug 16, 2010 8:16 am

[quote="Minor":3mo1ldx8]I'm on 0.9.92 here so looks like it could be the problem.

Also for cut off rooms. This guy has a method that seems to work but I never got round implementing it.

http://pixelenvy.ca/wa/ca_cave.html[/quote:3mo1ldx8]

Problem is now fixed for 99.92 so you should be able to download and check it out if you wish. :)

Will check that link now also ;)

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon Aug 16, 2010 8:25 am

I've checked it SoldjahBoy and now it works perfectly.

Also when I've played with CA before running 2 passes can get rid of most of the cut off areas.

I also read somewhere, can't find the link at the minute, that running a pass of CA checking for neighbours 2 tiles away can remove cut off areas.
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Next

Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests