Rocket Jumper: random level generation? 4

Wan • 5 years ago on 6th Kajam entry  Rocket Jumper

I've been making good progress with my jumping game, with the core mechanic now mostly done (…although physics were harder than expected to set up).

The next steps will be to draw final art… and more importantly, balance the difficulty. That difficulty part is quite tricky, as a good level design should be able to avoid "impossible situations" where deaths are forced. How could we do that yet keep the game hard, and even make it get harder with time? I see two main approaches:

  1. Keep the levels procedurally generated, and do some clever coding to make level generation harder & harder without being unfair ;
  2. Use pre-made "level chunks" of various difficulties, that would be playtested by hand.

Solution 2 would be too time consuming & unexciting, not mentioning I'd need to playtest again from scratch if I decide to tweak physics constants… So yeah I'll stick with fully procedural levels. To quickly get something I can ship, I've wanted to avoid being too concerned about imperfect levels: a trick was to introduce an "oxygen management" mechanic. The way it helps with level design is that it lets players do (limited) air jumps, which means that even if there's a huge hole in the level it still leaves a chance to survive.

Now, for the ideal solution…

The main idea I've had for "100% solvable" level generation is to place an AI player below the screen, before rockets are even spawned, that "plays" exactly like the player would. It would randomly decide to swap sides & jump, the trick being that the AI also decides when it lands: When reaching one of the 3 "rocket lanes", he'd be able to trigger rocket generation. A rocket would then magically appear right where the AI is, so we're 100% sure that the game is playable :)

We could then adjust the difficulty in various ways:

  • Especially in early phases of the game, filling voids with some additional rockets would help make things easy and the "AI path" not too obvious
  • The AI could play with increasingly tight timing
  • The rockets could be made shorter, or positioned so that there's little margin for error

I'm not sure how widespread this technique of using an AI is, but it may be fun to try. To be continued…

Comments (4)

Ztuu
 • 5 years ago • 

This looks really slick, I like the game speed and the physics. The drop from one rocket to the next without jumping is satisfying to watch for some reason. Great job :)
Your AI player idea is pretty cool, I would never have thought of that.

innomin
 • 5 years ago • 

Interesting AI technique, though I would say that games have used solution 2 to good effect by just adding some randomness to the patterns themselves. Super Hexagon and the super gravitron from VVVVVV come to mind, because even though they might seem like complete randomness at first there are obvious chunks of objects the more you play, which helps a ton with practicing and getting better over time.

With three lanes instead of six it might not work as well in your game, but short patterns randomly selected often create more compelling gameplay moments for me on average than pure randomness does. Some example ideas for your game:

  • middle, two edges, middle, two edges, middle.
  • two slow rockets stacked on top of each other and moving down, with one tiny rocket moving up quickly next to them on a random side to make the jump up between them.
  • rockets alternating on either side with no middle rockets, and just enough height distance between them to barely make the jump.

…and I just realized this game is done and very playable. I'll post this anyway for level gen technique discussion, I guess.

Wan
  • 5 years ago • 

@innomin This is a really interesting topic yes. The approach you mentioned would be good as well, the main issue for me was how it requires more effort to rely on handcrafted patterns. At least it felt this way while I wasn't sure exactly how to balance the game physics.

Working on this gave me quite some respect for the games you mentioned, because all those patterns only work within a fixed set of constants. I mean, what if in Super Hexagon the dev chose to adjust the cursor speed in a certain difficulty level, or change the overall speed at which the hexagons close in? Suddenly some patterns may become impossible/too easy, so every pattern needs to be playtested and tweaked again.

Compared to Super Hexagon my game doesn't have nearly as much character in terms of level generation. But now that you mention it, the cool news is that with some effort, we could just as well introduce patterns in the AI itself (eg. "do a very long jump from left to right", "do a series of fast little jumps on tiny rockets" etc.). Could be a way to get the best from both worlds…

innomin
 • 5 years ago • 

Oh yeah, definitely, a hybrid approach would ensure it was solvable and let you set upper + lower flex at the same time. The super gravitron in particular has some overlap in the patterns, which makes me think there are some repeating patterns which are unsolvable, even if encountered very rarely (i.e. / \ / \ / \ / \, if you're familar with it). Having an AI play first might be better than hard-coding ways out of every edge case like that. And you're right, all of the patterns are locked to a specific set of physics, though personally I try to lock that down in my games before ever starting on the level design, since they are so linked in games like this.

This AI idea is cool, though, and something I might look into in the future. Seems like it would be fun from a math standpoint to calculate intersections with a range of trajectories. Gravity is acceleration based, so you'd probably need some calculus to linearize its current and future actions. I'm sure there are faster approaches, but I like the challenge of stuff like that. =)

Login to comment