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'm creating a 2.5D platformer in XNA which uses 3D models that are constrained to travelling along a 2D plane (just like Trine).

To make things tricker, however, I want the 2D plane itself to be able to curve. Consider this replay of Klonoa (you only need to watch for 10 seconds): although the player was on a 2D plane, the plane itself could wrap around the side of a mountain, effectively allowing the player to travel through 3D space - all the while constrained to the regular 2D plane of a platformer.

How should the physics be approached in a game like this?

  • Should I use a 2D physics engine or a 3D physics engine?
  • Are there any physics engines actually designed with this situation in mind?
  • For any that weren't designed for this: what hacks or tricks will be necessary to get the physics engine cooperating with me?
share|improve this question
2  
I guess that the 'curve' is purely a visual, in terms of physics, it appears to be 2D. The only trick would be converting it to GFX space, or converting it to physics space. –  Daniel Apr 18 '11 at 5:48
add comment

2 Answers

up vote 9 down vote accepted

A platformer like this is still, in its essence a 2D platformer. The 2.5D effect, even the curling around the mountain, is merely a visualisation of a world constrained in 2D. Your physics engine will probably only operate on this world and not on the visualisation of it, so a 2D physics engine will be sufficient.

That said, you might be interested in some 3D effects. In the game "Bionic Commando:Re-armed", defeated enemy characters will kinda 'roll' off the platform, making the ragdoll physics actually 3D. In addition, most 3D physics engines allow you constrain the movement along one or more axis (albeit with some tweaks like creating a joint between the road and moving characters).

Remember that not every 3D effect needs a full-blown physics engine. You could code your own 3D implementations for minor things like falling debris after an explosion, without having to resort to a complete 3D engine.

My recommendation is starting out with a 2D engine if you probably will not need physics calculations in the 3rd dimension. Otherwise pick a 3D engine and constrain the calculations in only two axis where relevant.

share|improve this answer
add comment

It depends if any of your physics can happen outside the flat player space.

As ghostonline said debris and ragdoll animations are a classic example of out-of-2D physics in an 2.5D game.

Another example is bullets: If there are any projectiles in your game, do they follow the curvature of your 2D space or do the travel straight ahead even if that means they will leave those bounds?

Also mapping a physical 2D space to a curved 3D visualization correctly is (correct me if I'm mistaken) .. not that easy. You will need an injective projection functions probably involving lots of splines or something similar.

While having curved 2D game spaces is a nice add-on, it requires quite some overhead for the code. That might be the reason why there is no such thing in Trine. But the game was fun anyway, wasn't it? I'd think twice about a feature like that.

share|improve this answer
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.