Till now I have developed platform games in which a player can only move and detect tiles linearly. I wonder on how to implement games in which a player can move on an inclined or irregular surface.

example screenshot

I use libgdx to develop games and Tiled Map Editor to create level maps.

On research, I found RUBE is something I need for what I want to do.

Is this true? I will have to use Box 2D if I want to make such games.

Can't we do it using Tiled? If so... how to detect collision in that case?

If there is some other way through which I can do so? Thanks in advance for any suggestion.

  • \$\begingroup\$ While it is possibly to do inclines with tiles (e.g. Sonic), it is not as easy and intuitive as it would be using RUBE like you suggested. So what is the question? \$\endgroup\$
    – AturSams
    Apr 17, 2014 at 4:14
  • \$\begingroup\$ I just wanted to know.. Is there an easy solution.. RUBE is obviously the last(not easy) solution. using GLEED is also not good with libgdx. I just wanted to know if anything else exists. \$\endgroup\$ Apr 17, 2014 at 5:10
  • \$\begingroup\$ possible duplicate of Do you need to make a tileset for a platformer? \$\endgroup\$ Apr 17, 2014 at 14:04
  • \$\begingroup\$ @SethBattin Don't think so. While it's part of the question, this is more general about collision detection/design rather than "Do I need tiles?". \$\endgroup\$
    – Mario
    Apr 17, 2014 at 17:59

3 Answers 3


No, you don't have to use any specific toolset and you don't have to use any specific (physics) library either.

It's just a question of convenience, since things like Box2D will provide you other benefits as well, e.g. being able to do collision, physics simulation etc.

If you're not using tiles, you'll most likely want to write your own custom editor.

As an alternative, you could as well use tiled to draw rough outlines that are then interpolated by the game engine to create smooth surfaces (this could get tricky to edit!).

Creating smooth landscapes is actually pretty easy, but there are many things where you can optimize your algorithm.

Here's a short example of some basic "smooth landscape":

  • Your landscape or map is defined by several height points, in essence it's a 2D height map:

    Map represented by height points/information

  • To fill the gaps, you can use any algorithm you want, e.g. splines or just linear interpolation:

    Map with added interpolation

    If you worry about performance/complexity, you can use different algorithms for game logic (like collision detection) and rendering.

  • Now, once you've got your player character (or any other entity), you determine the closest height map point to the left and right of that entity. Based on that it's quite trivial to compute the actual ground height at that specific position:

    Map with an added character

    For linear interpolation, it's possible to draw/calculate the triangle the character is standing on. Once you've determined the slope (deltay / deltax) it's easy to determine the ground height where the character stands.

  • Now, to prevent your character from falling through the ground, all you have to do is move him up as long as he's under the ground. This will also allow your character to walk over the terrain if you move him left/right.

  • There's just one issue left: Don't allow the character to climb too steep ground. There are multiple possible approaches, e.g. just check the slope. If it's too steep, don't allow the character to walk towards it anymore.

Of course, this is simplified a lot and this won't allow you to create caves, floating platforms, etc. However, those can be done as easy, you'll just need a more complex algorithm. Rather than checking a chain of points, you'll have to determine whether specific parts of your character overlap with map objects (= polygons).

Edit: Since I've had a few minutes, I've created a quick example utilizing jsFiddle (Source). Just make sure to click in the results window and you'll be able to run around using the left/right arrow keys.


After a lot of research, I finally found out a way... I can use Tiled Map Editor to design my level...and create an object layer to draw shape/boundaries for collision and then to convert those boundaries/shapes as Box2D objects in my game using a Box2DParser. The results are awesome.

  • 1
    \$\begingroup\$ How about adding some screenshots of the process? This sounds like a "hacky" approach, but some screenshots might explain it a bit better. \$\endgroup\$
    – Mario
    May 4, 2014 at 13:19
  • \$\begingroup\$ I would like to do this as well. Did you use R.U.B.E? Can you answer my question here? \$\endgroup\$ Feb 6, 2015 at 19:17

A spline function is used which produces curves based on discrete control points which you place; examples of curve generation functions that use control points are Catmull-Rom or Bezier. x is known, y is unknown; so use the spline function to get the y position of the curve for that x, then place your character at that x,y position.

  • \$\begingroup\$ I didn't get... making a function for a level that i create in Tiled Editor... Would I need to do it manually for my map..??? \$\endgroup\$ Apr 18, 2014 at 0:07

You must log in to answer this question.

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