Gauntlets of Recursion (+3)

Times, trials, and turbulence.

Drowning in physics.

Well, sort of.

Like I’ve been raving about for the past few entries, I’ve been focusing on the physics engine that Gloom will be powered by. The original plan was to have it fully dynamic and fancy-pants-èsque, which I regret having had to decide to water down. I’m quite confident that, given enough time, I could complete this goal. However, I’m really tired of working on it, so a simplification is in order.

By fully dynamic, all objects would react to eachother in terms of linear and angular effects (velocity, acceleration, forces and torques) within a polygonal environment. What I had was somewhat close, but my limited knowledge and experience in physics programming left it still a little buggy and dysfunctional — mostly in collision response. I’ve decided to aim a little lower by creating a rift between two types of objects: static and dynamic.

Static objects, as the name implies, are immobile. They do not react to forces or torques, and so can be thought of as in ‘suspended animation’. Although static, the player can still fully interact with them in terms of non-physics interactions (opening a door, activating a switch, etc.. The reason for this is to prevent the more complicated case of dynamic objects colliding with other dynamic objects. Calculating this response is much more complicated, so I’m averting it by only allowing dynamic objects to collide with static objects, and vice versa.

Dynamic objects are objects in motion. These bounce off of the ground, ricochet of walls, and land on top of innocent static ammunition crates. Once a dynamic object reaches full rest (no linear/angular velocity) it becomes a static object. Special objects (like the Player) are always dynamic, even when stopped. (This system makes it fiendishly easier to sort out collision detection, too. :))

Limitations? Some. Certainly the world won’t be as flexible and dynamic as I originally hoped, but as I play more Shadowrun and read more Neuromancer, I’m leaning towards less hardcore action (a la Deus Ex) and more strategy/storyline/tactic (a la Shadowrun (and, strangely, Resident Evil — only a bit though ;))). The physics engine will still be able to let the user do plenty of cool things. Up to and including throwing potted plants at people. It’s a must.

There is also the idea of ‘Z Physics’, such as the screenshot below. This will allow (albeit basic) physics of objects stacking upon objects, and an illusion of height for objects that require it (eg. grenades, thrown rocks, shrapnel, etc).

Physics Fun


9 responses to “Drowning in physics.

  1. ravuya August 8, 2007 at 8:36 pm

    When developing computer physics systems, it’s best (IMNSHO) to keep as much static as possible. When I implemented a few physics sims I spent a lot of time figuring out when an object was ‘inert’ or close to it and disabling simulation to save frame time.

    Also, I hope you’re doing your physics with integration and the like instead of how I tend to do it. 🙂 Integration tends to smooth out a lot of the weird oscillations and little glitchy behaviours that are common to amateur physics simulator implementations.

    Another important issue is the timing of physics; I’m sure you’ve read the many, many, MANY articles on frame-based vs. timer-based physics by now and my posting about it here is almost an insult.

    Finally, still looks really good. You’re making great progress.

  2. Selkrank August 8, 2007 at 11:58 pm

    Why aren’t you using a physics engine such as ODE, Bullet or PhysX? Physics is really hard to get just right and glitch-free, and these guys have done that for you already.

  3. Stephen August 9, 2007 at 6:01 am


    Thanks! Things should really move faster now that the groundwork has been lain for the cool stuff.

    No, I’m also a physics-slacker like you, it seems. The whole physics engine is very simplified, which is how I like it (given my little knowledge in the subject). Still, with this new static/dynamic system I’ve seen no strange behavior yet. Yet. 🙂

    And yes, I wouldn’t touch a frame-based approach with a 40-foot pole.


    To be honest, I don’t feel comfortable enough with physics to use something that large and, if I may, ‘hardcore’. There’s SOOO much going on under the hood with those physics libraries that if anything breaks (which routinely happens to me) I’m forced to mainly guess-work to fix it. Given that, I really prefer the safety blanket of home-made physics where I fully understand what is going on under the hood. Hopefully after the physics course I have this Fall I’ll feel bold enough to try and integrate Newton or ODE into a (small) game project.

  4. brian.ripoff August 10, 2007 at 1:10 pm

    I have used ODE and I found it *much* easier than I expected. Making a test program to stress it out will tell you everything you need to know about stability and such. Well, apart from what to do if it is unstable in some area =)

    Also, someone on gamedev has a “2D physics blog” – might be worth reading. Thread:

    In it he recommends “chipmunk” as a good 2D physics engine.

    I would use a premade physics engine because I couldn’t be bothered writing all the math to implement my own physics engine. Come on Steve, what business are you in – game dev or physics dev? =D

    Good luck with your own engine should you choose to go tha way however.

  5. Stephen August 10, 2007 at 6:33 pm

    @Brian: Awesome linkage; thanks! Chimpmunk looks very awesome, and that blog has lots of interesting topics (albeit mostly over my head). As per your second-last sentence — even if you meant it sarcastically 🙂 — I’m really not sure at this point. If physics keeps on catching my interest like it has been, I might move from gamedev to physics — who knows? But the main thing is learning learning learning to no end. I could just plug in a 3rd party library and lay back, but I find it infinitely more cool to study and understand how it does its magic.

    In reflection though, I agree that the physics in the game would end up far more cool if I had opted for a physics lib. I’m actually tempted even now to do so, but with already over a week spent on what I have now, I really can’t justify the extra time that would be needed to learn and integrate another physics system.

    Thanks hugely for the comment! 🙂

  6. brian.ripoff August 11, 2007 at 7:16 am

    I understand completely, I do the same myself. Learning to no end sums it up nicely.

    But then again there is nothing like having really cool physics in exchange for doing almost no work.

    Either way keep up the good work, and the good blog!

  7. The Visible Man August 11, 2007 at 9:18 pm

    Looking awesome! I can’t wait to see how it plays!

    Also, are you planning to allow ‘Z Physics’ in the map editor? Or at runtime only? *crosses fingers*

    P.S. Liking the new CSS! Reminds me of the good old 8-bit days.

  8. Stephen August 11, 2007 at 9:31 pm


    Thanks as usual; ZOMG is looking very sleek too with that nice custom UI and zombie-gore. 🙂

    How are you imagining the Z-Physics to work within the editor? I mean, the purpose of the map editor is to make maps and place objects, not fling stuff around. 😉 But if you mean from the stand point of making it easier to drop boxes on top of eachother via stacking, then I think that’s a valid point. However, I don’t think the Z-Physics will have a big enough role to warrant this, since it’s rather awkward displaying things with height in an overhead POV anyways. I doubt I’ll have modders lined up outside my door for the game anyways, hehe.

  9. The Visible Man August 11, 2007 at 10:19 pm

    Thanks! I spent a while working on it. In fact, I just recently got the weapons working how I want:

    “How are you imagining the Z-Physics to work within the editor?”

    Well, obviously there will need to an ability to stack objects simply for the atmosphere. However, now that I try to think of specific examples for the physics, I can’t come up with any. Maybe once the game play itself is more defined, an advantage will become clear to having pre-mapped stacks of stuff. Until then, I’ll keep trying to think of something 😛

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: