Back when Sportsball was a humble XNA prototype, I had assumed the physics would be really basic. Mainly because I didn’t want to write a whole physics engine. Now that I’m writing the game in Unity, that problem is taken care of in the most fancy-pants way possible. That is to say, Unity usesNVIDIA PhysX Physics out of the box!
The question was whether to use 2D physics or 3D physics. Since Sportsball is a 2D game, it might make sense at first to consider 2D physics. But if you think about a classic sports game, like NBA Jam, it’s not really all that 2D. The characters on screen move up, down, left and right, but the ball actually leaves the ground as well. That’s X, Y and Z folks, and that’s 3D. So suddenly I was looking at writing a game that was 3D on the inside, and 2D on the outside.
Here’s a super duper early look at the game-in-progress (warning: programmer art ahead):
In the image above, we see some “classic” programmer art. Just looking at the sprites, there’s a football man throwing a bowling ball. But there’s something else going on too. On the left, there’s a box. That box is actually a 3D goal area. Immediately to the right, you can see the bowling ball high in the air. The much-too-big shadow below it shows where it exists in X/Z space (directly in front of the football man). The distance from the shadow to the ball shows where it is in Y space (height above the ground). There’s also a sphere inside the shadow. That’s actually the 3D ball. What we’re actually seeing here is sprites in front of a top-down 3D view of the play area. Check it out in 3D:
Now you can see the goal clearly, the round ball in the air, and even some players. The players are simple shapes in 3D for collision. You may have noticed their purple boxes in the top view 2D screen shot.
By the time we have the real art in place, the 3D simulation will be completely invisible to the player and everything will behave “as it should”, and hopefully that means it will come with some crazy physics-based emergent gameplay. But it’s a bit early to tell yet!