I am currently in the concept phase for an endless runner I want to develop with libgdx in Java.

As I can not preassemble an infinite level, the generation of obstacles and power-ups needs to be "random" and during the game itself. In my last endless runner, I simply had randomness to determine the next obstacle type, as well as its position.

This time, however, I want to integrate two resources that play a major role and change the way I need to handle feasibility fundamentally.
One resource is some sort of an energy bar, which decreases over time, as well as due to collision with obstacles (possible to get over in the beginning, deadly as the game proceeds) and increases with the collection of power-ups.
The other resource is a coin-like entity, which you can collect during a run and which need to be present to a certain amount, in order to collect the energy-filling power-ups on collision.

I have a vague to solid idea of securing feasibility in terms of creating manageable obstacle-chains, but can't think of generation procedures, that ensure the possibility to collect enough power-ups while being provided the opportunity of collecting enough coins first. Furthermore, this procedure needs to increase the difficulty with the games duration.

I am not asking for code itself, but rather for adequate ways to approach my issue, such as dividing my endless runner in minilevels, that have some transition and are feasible on their own. Alternatively, experienced statements on which ways not to use and why are very welcome as well!

Feel free to ask further questions - Thanks in advance!

  • \$\begingroup\$ Try to write down what makes a given part of the game "feasable" or not. If you can come up with sentences like "there must be a minimum distance between obstacles so the player has time to react" then you have something you can translate to code. \$\endgroup\$
    – Roflo
    Commented May 3, 2018 at 14:18

1 Answer 1


Prebuild sections that you can smoothly transition between. Randomly select sections as the game is going on. The simplest one is a blank road with spawning points for obstacles and coins. When selected you randomly fill some obstacles and some coins, add some tests to make sure it's reasonable like not having coins/powerups inescapably in front of an obstacle and that there is a path through that picks up the powerup.

Every so often have a bit of free space where the player can take a breather and you can make a prelude to each difficult section that way telegraphing what the obstacle will be.

You can also vary the obstacle look even if the gameplay for them is the exact same, like something that swings in that must be jumped over or dodged. that is litterally like any other obstacle that must be jumped or dodged but it doesn't look the same.

Then you can add decorations to break up the monotony. A section of tunnel, a bush, the occasional animal jumping out of the way, creatures on the side taunting/cheering, ...

  • \$\begingroup\$ I like the idea of defined spawning points for obstacles/coins. This allows me to test easily, but takes out the randomness. Also, I would have to prebuild a lot of sections, if I don't want the attentive player to predict what's going to happen next. \$\endgroup\$
    – Rufrage
    Commented May 2, 2018 at 11:28
  • \$\begingroup\$ Having predictable segments can add to the difficulty and engage more of the brain. That way the game which used to have being purely high speed reaction/prediction will then add immediate recall. \$\endgroup\$ Commented May 2, 2018 at 11:32
  • \$\begingroup\$ Fair point. How would you go about increasing the difficulty, as the game proceeds? \$\endgroup\$
    – Rufrage
    Commented May 2, 2018 at 11:57
  • \$\begingroup\$ more obstacles, faster speed, and tighter margins on how many powerups can be missed, longer stretches between breather spots, shorter breather spots. \$\endgroup\$ Commented May 2, 2018 at 11:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .