I'm making a tiny side-scrolling platformer game and I need to generate levels procedurally. The levels consist only of blocks, so its nothing fancy. What's the best way to go about this in Fusion?


I'm making a tiny side-scrolling platformer game and I need to generate levels procedurally. The levels consist only of blocks, so its nothing fancy. What's the best way to go about this in Fusion?

You can make it crazy - randomly generating between a max height, min height, and making sure the player can always jump it - or, you can get procedural and generate 'areas' where each area has a different generation theme - eg, flat areas, pillar areas, platform areas, etc.
Working as fast as I can on Fusion 3

There are lots of ways to go about this, depending on what exactly you want.
However you do it, you're likely going to want to store the level in an array to begin with.
For example:
* Run a fastloop to iterate through each array cell, and fill it with a random value - either 0 (empty) or 1 (solid ground).
* Run more fastloops to perform some kind of "cellular automation", to change the value of each cell based on the values of surrounding cells (google "random cave generation" / "cellular automata").
* Run more fastloops to change the appearance of tiles, based on whether there are other tiles nearby (not essential, but it makes the level look much more attractive).
eg: http://www.create-games.com/article.asp?id=1869
* Randomly place items, enemies, etc.
If you want more interesting looking levels, you might also pre-fabricate some level components (groups of tiles), and randomly add them to the level.
The big problem with a platformer, is that you have gravity to worry about. You have to find a way to ensure that the level can be completed - that important objects aren't positioned out of reach. You might do this by strategically placing ladders etc (may require a pathfinding extension), or by using some kind of terrain destruction, or by giving the player abilities such as flying or rope/grappling hook etc (like the Ninja Rope in Worms).
It also gets much more complicated if you want any kind of lock mechanisms - you'd then need to ensure that the keys are not behind the door they unlock.


Okay, my main problem is that I have no idea how to handle arrays in Fusion. Is there a tutorial for making levels using arrays? The link above explicitly states that it won't cover specific use of arrays









I have a open source World Editor on my website. It uses an array.
Marv
458 TGF to CTF 2.5+ Examples and games
http://www.castles-of-britain.com/mmf2examples.htm