Here's a demo cart using the algorithm we used in Spaceman 8.
Some words about it: http://kometbomb.net/2017/03/10/how-levels-are-generated-in-spaceman-8/
I have a little question about the "while loop" you have in step1():
so the engine is running it until conditions are met for it to be broken ; the engine is only running one time right? i'm asking because the step1() function is called by update() (about 30 times per second), just to be sure ^^
Every time you see the cave grow (even just a single tile), the while loop in step1() has been run until it finds a suitable tile (and then that tile is set empty). The demo uses several frames to create the whole cave just so that you can see how it builds it (and of course the demo generates maps as long as you let it run so the engine is run several times also).
I guess the function is named a bit stupidly because it's actually step 3 in the article!
You can create the whole level instantly like this:
function generate(maxsize) step0() for i=1,maxsize do step1() end end
Log in to post a comment