How to deal with random spawning of obstacles and pickups for an endless runner

Started by
2 comments, last by LorenzoGatti 10 months, 2 weeks ago

HI,

I'm currently developing an endless runner as a side project, The game has 3 lanes and is infinite. I would like to spawn obstacles and pick ups at random. I want the obstacles to different sizes, I want there to be coins and other type boost pick ups. I am not sure how to go about this properly, I want to make sure that there is enough room for obstacles, and pick ups but also for the player to not get trapped with and have no path to continue.

What is the best approach to handle such random spawning that does not make the game unplayable or look strange?

Thank you

None

Advertisement

Never done anything like that, but make an obstacle “bigger” in the sense that it also includes an escape path? Similarly you don't have 1 obstacle, you have as many obstacles as you have sizes of them.

If you also leave some room below and/or above it and make sure obstacles cannot be placed on top of each other, you can probably ensure truly blocked paths won't happen.

Requirements about obstacle and pick up item locations should be easy to express as a system of constraints with a regular structure: after the position of an object of type X (the various obstacles and powerups), objects of type Y cannot be placed for a certain extent of the track (specified separately for the same lane, adjacent lanes and nonadjacent lanes). For example:

  • Guaranteed empty space (no obstacles, possibly harmless powerups) after obstacles; in the same lane for forward jumps and the like, in adjacent lanes for swerving.
  • No unreachable powerups, which would be an insult, either in the small unreachable areas after obstacles or outside the cone that can be reached from the position of the previous powerup
  • Adequate “cooldown” after major obstacles and powerups before encountering another one.

Omae Wa Mou Shindeiru

This topic is closed to new replies.

Advertisement