5
\$\begingroup\$

I would like to get some opinions on whether I should develop my game using a physics engine (Farseer Physics seems to be the best option) or follow the traditional tile-based method.

Quick background:

  • It's a college project, my first game, but have 4 years academic programming experience
  • I just want a basic platformer with a few levels, nothing fancy
  • I want a shooting mechanic, run and gun, just like contra or metal slug for example
  • Possibly some simple puzzles

I have made a basic prototype with Farseer, the level is hardcoded with collisions and not really tiled, more like big full-screen sized tiles, with collision bodies drawn manually along the ground and walls etc. My main problem is I want a simple retro feel to the jumping and physics, but because it's a physics simulation engine, it's going to be realistic, whereas typical in air controllable physics for platformers aren't realistic. I have to make a box with wheel body fixture under it to have this effect, and it's glitchy and doesn't feel right.

I chose to use a physics engine because I tried the tile method initially and found it very hard to understand. The engine took care of a lot things to save me time. Being able to do slopes easily was nice, as was the freedom to draw collision bounds wherever I liked, rather then be restricted to a grid. This also gave me more freedom for art design.

In conclusion, I don't know which method to pick. I want to implement this in the most straightforward way, so it won't give me a headache later on. Preferably, a method which has an abundance of tutorials and resources so I don't get "stuck" doing something which has been done a million times before!

\$\endgroup\$
3
  • \$\begingroup\$ I'm pretty sure tile-based and physics-based are not mutually exclusive. Also, you'll probably be downvoted for asking opinions, because your question does not have a clear answer and this site is not for discussions. You might try a forum instead, for example at gamedev.net. \$\endgroup\$
    – Christian
    Commented Nov 19, 2012 at 16:36
  • \$\begingroup\$ should i remove the question so? because there is no factual answer is there, it is a question of which method suits my scenario best, maybe its too broad for this site! \$\endgroup\$
    – Hugh
    Commented Nov 19, 2012 at 18:12
  • \$\begingroup\$ I'm not sure, I'm not a mod :) It's just that whenever I see a somewhat open ended question, it usually doesn't take more than a few minutes or hours at most until a mod shows up saying that this site isn't for discussion, and in most cases the question ends up closed. \$\endgroup\$
    – Christian
    Commented Nov 20, 2012 at 8:14

2 Answers 2

7
\$\begingroup\$

The answer is simple: a physics engine is not a platformer engine.

While you can get kind-of platformer-like behaviour out of a physics engine, you simply do not have enough control to get that really "fluid" gameplay feel of a proper platformer.

For example: The classic Mario-style jump requires changing the gravity for the player at different stages of the jump - as well as directly setting the velocity in a few places.

The reason for this is that you want the jump to start as soon as the player presses the button (responsive), and the height will be specified after the jump starts (by the player releasing the key - which also must be responsive). The reason is that it feels good.

To give another example: the friction experienced by an object sliding (or rolling) along the ground is very different to the behaviour of a walking biped - or a player's expectations of how a traditional platformer character will accelerate and decelerate.

If you want to use a physics engine, these are two of the many places where you must customise the engine to get the behaviour you want. For my own game I have found that you even have to heavily customise things like collision detection to get things to feel right (sticking to the ground, not sticking to the ground, falling off ledges, etc).


It's very important to note that using a physics engine is orthogonal to the question of whether or not to make your platformer tile-based or vector based. N, for example, is tile-based but uses many techniques you'd find in a physics engine.


To answer your question directly, here is a decision tree:

  • If you want to get something up-and-running quickly, and you don't need a good, polished platformer feel, by all means use a physics engine. There are even lots of tutorials on how to get kinda-sucky platformer behaviour out of one.

  • If your game design revolves deeply around platforming (ie: movement), then a tile-based engine is probably best (eg: Mario, N, Super Meat Boy, etc). It will make it easier for everyone involved - movement designer, level designer, and ultimately the player - to focus on the movement mechanics. And tile-based is easier to program in the long term.

  • If your game is not movement-based (eg: Braid), then a vector based design allows for more varied, natural levels.

  • Obviously a game that has physics as a game-play component (eg: Limbo) requires a physics engine.

  • If you're absolutely crazy (like me), you could make a vector-based game with deep movement on a physics engine. It's not impossible - just difficult.

If you're not using the rigid-body simulation, then the use of a physics engine for a vector-based platformer is really a toss-up. On the one hand you get a lot of functionality for free. On the other hand: there's a lot of functionality you'll have to override and modify and circumvent.

\$\endgroup\$
17
  • \$\begingroup\$ "For example: The classic Mario-style jump requires changing the gravity for the player at different stages of the jump - as well as directly setting the velocity in a few places." This isn't true at all. If you want variable jump heights, you can keep applying force to the character as long as the player holds the jump button. It doesn't require any hacks. \$\endgroup\$
    – dreta
    Commented Jan 2, 2013 at 15:38
  • \$\begingroup\$ @dreta The Mario jump is more sophisticated than that (source: Steve Swink's Game Feel, chapter on "Super Mario Brothers"). Why would I make that up? \$\endgroup\$ Commented Jan 3, 2013 at 0:33
  • \$\begingroup\$ (Oh actually I even linked my source already, in the answer!) \$\endgroup\$ Commented Jan 3, 2013 at 0:38
  • 1
    \$\begingroup\$ @dreta I think you've missed my overall point, by nit-picking my example. Yes, velocity changes can be expressed in terms of forces and impulses. But a pragmatist - something all game developers should strive to be - will simply set velocity directly if that is the desired result. However, that was just the example. To build a good platformer on a physics engine requires things like setting positions directly, overriding collisions, and so on. Theoretically you could also probably achieve the same result with forces and impulses - but you'd be insane to do so. Game developers cheat! \$\endgroup\$ Commented Jan 4, 2013 at 3:53
  • 1
    \$\begingroup\$ Story time: One thing that helped me really "get" this concept - that it is OK to "cheat" - was watching the directors commentary of The Incredibles. They were talking about hair and cloth simulation. To get things to look great, they would feed the simulation wildly non-physical parameters (wind, gravity, etc). Similarly, with games, you can and should throw realism out the window in order to get a better "feel" (or productivity). And, let's not forget, your initial suggestion to apply a continuous force is also completely non-physical. \$\endgroup\$ Commented Jan 4, 2013 at 3:53
2
\$\begingroup\$

Physics engines and tile based platformers are not mutually exclusive. For example you can combine the Farseer Physics engine and the XNA Platformer Starter Kit (This will also explain a pure tile based approach to you). Simply remove all exisiting collision detection code (from the Player class) and give the Tiles and Player class Bodies and associated Shapes for Farseer to perform collision on.

In reality combining the two together is not ideal. Moving the player body across a series of adjacent tiles (floor, walls etc) will cause problems and not provide smooth motion. See this great article for further explanation.

Most modern platform games simply draw the game elements as tiles but have an underlying physics environment which matches the geometry as much as possible. This is why you can sometimes see the players feet dip below the surface of the "floor". Here is an example from an early prototype of Braid:

Braid prototype

In the Farseer physics engine you are able to control the gravity of the world, drag coefficients and player movement enough so that you should get the old-school platformer feel to it. Simply find a set of drag, mass and movement velocities and play with these settings until you get the right feel.

Use what you are most comfortable with.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Braid is not tile based, btw. \$\endgroup\$
    – Kikaimaru
    Commented Nov 24, 2012 at 23:44
  • 1
    \$\begingroup\$ Yes I know. I am trying to illustrate the point that the underlying geometry of the world does not always match the graphics and illustrations. \$\endgroup\$ Commented Nov 25, 2012 at 1:09

You must log in to answer this question.

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