2
\$\begingroup\$

I am wondering: how does someone make levels for a game like Linerunner or any other game that uses similar patterns?

About Linerunner (game)
You are a stick man running, you have to jump or crawl without hitting boxes. Google Play is very illustrative.

The algorithm I am looking for
How does the game engine know that if it places a box here and here and here, the user will be able to make it without hitting any of the boxes? Two possible solutions came to mind, but neither of them seem very good.

  1. Design the entire level.
  2. Create an array of small patterns the user can win in and then join the patterns to create a level.

I hope someone understands what I am talking about, otherwise I am willing to explain in depth what I want to accomplish.

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

Your ideas are good, but I think with a little bit of math and empirical testing, you can figure out how to make these levels dynamically. You have a few factors that effect the placement of the blocks:

  • How fast the character is running
  • How long does it take to reach the minimum height to clear a box?
  • How long does the character remain above the minimum height to clear a box?
  • How long does it take for the character to touch the ground again and be ready to jump after one jump? This shouldn't be affected by the horizontal speed
  • How long does it take to get below the minimum height to get under a box?)

With that information, you can figure out the following measurements:

enter image description here

A: How far apart two "paired" ground boxes can be placed. These are the boxes where the user is expected to jump late enough to clear two boxes. Calculated using the time above the minimum height to clear a box and the speed of the character.

B: How close together two ground boxes can be placed. Calculated using the speed of the character and the time it takes for a jump.

C: How close together a ground box -> air box pair can be. Where the character needs to jump over a box, then duck under the next box. Calculated by the time it takes to reach the minimum height to clear a box (because it'll be the same as the time it takes to clear a box and hit the ground) and the speed of the character.

D: How close together a air box -> ground box pair can be. Where the character needs to duck, then jump.

E: (Not pictured because I forgot) How close together two sky boxes can be. Calculated using the speed of the character and the time it takes to duck.

There will be some room for setting the difficulty here. You can make the jumps tight or loose depending on the difficulty. A tight jump would just barely clear the edges:

enter image description here

Where a loose jump would have much more play on either side of the boxes. That's where the empirical part comes in, you need to test and see how reasonable it is to get those jumps in with the input device you're using.

\$\endgroup\$
1
  • \$\begingroup\$ Cool, thanks.. This gave me a little idea of how to develop it. :-) \$\endgroup\$ Commented Jan 29, 2013 at 16:39

You must log in to answer this question.

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