Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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: - its a college project, my first game, but have 4 years academic programming experience - Just want a basic platformer with a few levels, nothing fancy - 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 its a physics simulation engine its going to be realistic, whereas typical in air controllable physics for platformers arent realistic. I have to make a box with wheel body fixture under it to have this effect and its glitchy and doesnt 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 alot things to save me time, mainly being able to do slopes easily was nice and the freedom to draw collision bounds wherever i liked, rather then restricted to a grid, which gave me more freedom for art design also.

In conclusion i don't know which method to pick, i want to use a method which will be the most straight forward way to implement and wont give me a headache later on, preferably a method which has an abundance of tutorials and resources so i dont get "stuck" doing something which has been done a million times before!

Let me know i haven't provided enough information for you to help me!

Thanks in advance, Hugh.

share|improve this question
    
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. –  Christian Nov 19 '12 at 16:36
    
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! –  Hugh Nov 19 '12 at 18:12
    
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. –  Christian Nov 20 '12 at 8:14
add comment

2 Answers 2

up vote 5 down vote accepted

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.

share|improve this answer
    
"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. –  dreta Jan 2 '13 at 15:38
    
@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? –  Andrew Russell Jan 3 '13 at 0:33
    
(Oh actually I even linked my source already, in the answer!) –  Andrew Russell Jan 3 '13 at 0:38
1  
@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! –  Andrew Russell Jan 4 '13 at 3:53
1  
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. –  Andrew Russell Jan 4 '13 at 3:53
show 14 more comments

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.

share|improve this answer
1  
Braid is not tile based, btw. –  Kikaimaru Nov 24 '12 at 23:44
1  
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. –  Stephen Tierney Nov 25 '12 at 1:09
    
thank you stephen, a useful point! –  Hugh Jan 5 '13 at 15:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.