It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to the home page.    

Search articles, jobs, buyers guide, and more.

by Fred Marcus
Gamasutra
[Author's Bio]
January 21, 2003

A Hand-On Approach

Translation and Rotations

Printer Friendly Version

[Back To] Physics Resource Guide

Sponsored by:

 

 


Resource Guide

What Designers Need to Know About Physics

Translation and Rotations

You can dampen things in translation and in rotation, for each axis. In translation, damping can make a box slow down progressively once pushed or it can slow down a car going too fast. Think of it as brakes. It’s up to you if you want the brakes to be very soft and progressive or if you want to bring objects to a brutal stop. Too much translation damping and the object won’t move at all though.

In rotation, you can prevent an object to roll too much. Think of a car taking a turn too fast. If you don’t want that car to roll over, you add damping on the z axis. If you put too much damping though, the car won’t rotate at all and look very unrealistic.

Learn to Love Quadratics

So, damping is great, it helps you control things. The problem is, sometimes, you want an object to behave differently at different velocities.

Maybe you want a vehicle to roll a lot at low speeds but if you keep it like that, it will definitely roll over at high speeds and that’s a no no! Well, you can ask your programmer to give you speed relative damping! Quadratics are great for that. You get a constant damping value C, valid even if the object is static. On top of that, you have a damping value B for when the object speeds up. And then, at really high speed, a third damping A value kicks in for these special cases. The thing is, damping values can be updated every frame so it’s up to you to see what your game needs and design a system that fits these needs.

Get Rid of It!

Of course, too much damping and your game doesn’t need physics anymore! That’s where the difficulty in balancing all this comes from. If your physics is too controlled by damping in order to make the game playable, you can get rid of it when you need to! For example, during a car crash, remove damping on all axis at once or progressively to see the vehicle spin all over the place in the most spectacular way. The difficulty for the designer and the programmer is to determine and recognize when a vehicle is really crashing.

Once you've learned a bit about how the physics in your game works, you'll soon encounter a number of common problems that you previously lacked the tools to tackle. This section offers a list of traps you have to avoid at all cost. They are classic problems, I see them every single time physics are implemented in a game. Make sure you read this before you start to tune.

Real Time Tuning

A key element in tuning physics is the possibility to tweak each value in real time while the game plays. You have to ‘feel’ physics, just like you need to feel the controls and the cameras in your game. Being able to tweak physics values in real time will allow you to increase your iteration rate dramatically. Ask for this feature. Better: BEG for it!

Lock your frame rate!

Variable frame rate will change your physically based behaviors. Even if you are told that they will stay the same once the code has been optimized, don’t trust believe it! It will not happen, it will change and you will have to re-tune things (hopefully you will be trained by then and it won’t take you that long).

Oversampling, a Chain Reaction Explained

Sloppy physics code can take a lot of CPU cycles. It can take so much time that your frame rate will drop from 60 to 30 frames per seconds or worst. Variable frame rate disturbs a physic simulation and usually, oversampling is used to solve the problem.

Oversampling physics means that the physics code is updated independently from the display. If the game is displayed every other frame (30 fps), physics are still updated 60 times per second. It means that the game runs through the physics code two times before an image is displayed. It helps keep the physics stable.

But wait, if the game has to run the physics code two times before it displays something, then, it eats even more CPU time. And the game can get even slower! And then you might drop to 20 fps and need to update physics three times before you display anything! This chain reaction is a classic problem and trying to get a good, fast 60fps with no oversampling is the best you can ask for. Beware of oversampling and low frame rates.

Physics LOD'd

Not everything needs to be physically based in your game. Especially when these things are far from the player’s point of view. No need to compute suspensions if the vehicle is four pixels on screen! Make sure your coder has physics LOD built in.

Another crucial thing to remember is that AI does not need to be physically based either. If you want to have tight control over what the AI does in your game, then don’t make it physically based. Physics will prevent programmers to move an object by specifying x, y and z coordinates. They will need to move objects through impulsions and forces, a more ‘analogue’ and approximated way to do it.

Final Word

Not everyone is convinced that good physics are essential to a game -- "games don’t need it to be fun” I hear every so often. It is true, absolutely.

But, each new platform brings us closer to realism graphically. Hardcore gamers complain when the art is average, the AI dumb… and sooner or later they will reach a point where they will not accept object behaviors that don’t look right. As for game designers, we have the opportunity to make sure that game physics not only look and feel right, but that they play right -- balancing realism with effective and fun tuning.

________________________________________________________

[back to] Introduction


join | contact us | advertise | write | my profile
news | features | companies | jobs | resumes | education | product guide | projects | store



Copyright © 2002 CMP Media LLC

privacy policy
| terms of service