Physics Simulation

So one of my hobby projects that I've been putting an average of about two hours a month into for the past 5 years is a Pocket PC first person shooter that grew out of a voxel terrain demo I put together in Java about 10 years ago. When 2002 rolled around I had been playing Halo (on an Xbox at work) and fell in love with the visual design. So morphed the terrain demo - very slowly - into a "Pocket Halo" (later renamed "Halo Mobile").

(It's something I'll never finish, since it borrows all of the media from the game, soundtrack CD, and other fan projects (e.g. Halathon) and I'm sure Microsoft/Bungie wouldn't be huge fans of it. When I was working at Microsoft I showed it off to a few people, but I didn't give out copies. Please don't ask.)

Doing it on a Pocket PC (~300MHz ARM processor, ~32MB memory, 240x320 screen, no hardware 3D, no floating point unit) gives it a bit of a retrocomputing aspect as well. (To be fair, it also compiles for Win32 so I can develop on the desktop and create mobile builds every so often). More than anything, it's an excuse to prototype parts of an FPS game.

Thus far, the technologies have been:
  • Voxel terrain rendering
  • Game loop and event handling code (based on GapiDraw)
  • UI dialog and widget toolkit, event model and dynamic layout engine (to handle screen resizes)
  • Input abstration layer, multiple data-driven control schemes
  • Fixed point data types
  • 3D software rendering engine, with texture mapping, lighting and shading, mesh support, etc
  • Game module logic (menus, levels, etc) and rendering pipeline (e.g. menu UI renders on top of 3D animated titles)
  • Sound mixer - although I later swapped this for FMod leaving my C++ wrappers in place
  • Game object logic using data-driven, dynamic instancing (There's one Enemy class; different Enemy types are prototypes distinguished solely by data, and then there are multiple instances representing each enemy unit. Ditto for weapons, vehicles, etc.)
  • Physics engine
(Yes, there's no AI yet. That's probably next.)

Since my in-laws arrived for the holidays on Wednesday I've spent a little bit of time each evening going from a completely bogus physics model with gravity, drag, and "if something collides, reverse its velocity". This was enough to get vehicles, the player, enemies and projectiles working but actual collisions looked horrible. I poked at it enough to get much better collision detection, multiple physics steps per frame, and actual real collision response. It went from a joke (albeit amusing) to looking like a pinball simulation when firing "test spheres" onto a flat surface. W00t!

Comments