Log In  

4

Cart [#38134#] | Copy | Code | 2017-03-10 | Link
4

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/

map tutorial procedural generation
P#38135 2017-03-10 12:05

::

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 ^^

P#39713 2017-04-16 07:29

::

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
P#39714 2017-04-16 08:30

Log in to post a comment

user:
password:

New User | Account Help
:: New User
X
About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2017-05-23 10:51 | 0.185s | 1572k | Q:16