Three Hundred :: Mechanic #084
  Squidi.net Sites:     Webcomics   |   Three Hundred Mechanics   |   Three Hundred Prototypes
 Three Hundred
   - Index Page
   - About...
   - By Year

 Collections
   - Comp-Grid
   - Procedural
   - Tactics
   - Tiny Crawl
   - Misc


 
PreviousMechanic #084Next

  Mechanic #084 - PCG Platformer
Posted: 07/05/08

Returning to the world of procedural generation, how to generate a platform game like Mega Man 2.


  Rocking like a Rock Man

Boy, I bet you guys are getting sick of this procedurally generated content stuff, huh? I'll have to make an effort to start coming up with ideas in genres outside of the tactics / roguelike / pcg stuff that I have been doing. But this mini-series is something I've wanted to go into detail about for a while - and in honor of the glorious announcement of the NES-like Mega Man 9, I'm energized once more with the spirit of procedural platforming.

But wait, you are saying, there is already a MegamanRL, isn't there? There is, though I've not played it. I have, however, gone through its XML files, and as near as I can call it, the levels are generated by the classic pre-built module system (randomly select a pre-built area and glue it onto the previous one). This is something a little more interested in building a FUN platform game - that is, effort is being taken not to simply create a random landscape, but create one in which enjoyment is factored into its design. It'll make sense in a second.


  Jumps

[jump1.png]

The basic building block of a platform game is a jump. If you think about it, there are a finite amount of jumps that can be made from an end block. In fact, most of your variations are going to be jumping down to a platform below.

A platform game can be thought of as a linear path that goes: floor, jump, floor, jump, floor, jump, etc. This does not include obstacles, which is a larger subject I'm saving for later. Right now, I'm just talking about building the basic environment - and that environment consists of floors punctuated by jumps.

A floor is simply a connecting path between the end point of a jump and the beginning point of the next jump. A jump is the connecting glue that puts these things together. Creating a path is simply a matter of randomly selecting floors and jumps.

[jump2.png]

In this shot from Mega Man 2, you can see my point. Creating something like this would be relatively easy. Because there are conveyor belts, there are additional jumping opportunities not normally present. A belt moving towards a jump allows you to jump further, while moving away from a jump would prevent you from jumping as far as you could otherwise.

To create some sort of logic here, the different jumps are given difficulties, and a path would have some sort of philosophy about this. For instance, a path might decide to have a low density of jumps, meaning more room for obstacles. It might decide that it needs a flow of difficult - easy - easy - difficult, such that the player makes some progress between difficult jumps.

Likewise, the difficulty of the jumps might be increased based on certain factors. If there is no floor below it, the difficulty rating is increased. If the jumps must be timed or the blocks disappear after a while, the difficulty is increased. And so on.

In the above example from Metal Man's stage, you can see that at the end, the path branches into two paths. It instantly comes to mine that the best way to build a platforming level would be through a branching tree. Man, what is it about procedural content and trees? I think this approach, using branches to represent separate diverging paths through a level to be the best approach. You can even lock paths based on certain abilities - like requiring a double jump or a gadget that lets you climb walls.

In general, Mega Man tends to have fairly short, optional side paths, but there is one really important way that branching paths can be used. In the case of jumps where failure just means climbing back up the ladder to try again, that area below the jumps that catch failures can be treated as an alternate path that loops back around. The jump difficulty is reduced due to the lowered cost of failure and the level generator knows how to build such a path back into the main level flow.

Obstacles can be placed on a floor or in the middle of a jump. For instance, you can add a fish that jumps up at random intervals that you have to miss while jumping over it. This adds difficulty to a jump and may have additional rules, such as only being possible if the jump is within the bottom five rows of tiles. The fish jumping obstacle has an added difficulty of being a timing based puzzle. Both timing obstacles and obstacle linking will be discussed in a later entry.

Levels themselves are made up of zones. A zone is simply a path which shares a specific theme and set of obstacles. For instance, Wood Man's stage begins in the woods with jumping ostriches, then goes under ground to fight giant dogs, then across branches up in the air, and so on. A zone is basically just a set of obstacles that are possible - similar to a deck for the PGC Cards idea. Creating a zone with compatible obstacles, jumps, and floor terrain generation is largely in the hands of a person creator, though once the set is presented, the game should be able to build quality zones - and link like zones in a single theme to create an entire level.

Bosses at the end are probably not going to be very randomly generated at all, though some of the Mega Man games feature bosses which have several patterns which are only seen at a higher difficulty level. It could be possible to create a set of behaviors and then have the game randomly select a few, but I think the reward for the extra work would probably not mean much to the player in the end.

 

 





Copyright 2007-2014 Sean Howard. All rights reserved.