Physics for Game Engines

Simulating physics in a virtual environment is a very demanding task that requires understanding of your systems capabilities and limits, as well as understanding the best way to approximate these calculations to compensate for these limits.Currently there are only a few ways that we use physics in games, but they make a huge impact on the way a game runs and feels. A good robust physics system in your game engine is they best way to make different and exciting experiences from your engine, that don't feel like the same game just re textured and re modeled.So what are the most important features of a good physics engine?Rigid Body Dynamicsfirst and foremost, you want your objects to have mass, gravity and you want each action to elicit an equal or opposite reaction. To keep these calculations discrete but also accurate, it is better to use Newtonian equations.There are basic linear dynamics which propel an object forward such as velocity, acceleration. most games could actually run on these calculations alone and you may be able to come up with some interesting gameplay.you could start with a speed variable and multiply it by a vector which represent your direction of travel.you would continuously add this to your current position upon each update call until the traversal is finished.For more interesting physics you can calculate a Force term.this is where many different possibilities arise as you can affect an object greatly depending on what force you decide to usethe standard calculation for Force is F=ma but there are so many interesting vectors that can be achieved through what came after newtons second law of motion. a good example would be gravity which is simple enough as changing the acceleration constant to a gravitational constant (plot twist its pretty much the same thing)other examples may be friction, centripetal, elastic or spring.there are also rotational dynamics such as centripetal and torque.While soft bodies are not impossible they haven't really taken off in the way rigid bodys have in games. Most soft body approximations are used for aesthetic appeal in games and aren't integral to game mechanics like rigid bodies.Particle SystemParticle systems use the basics of rigid body dynamics except with hundreds of little particles represented as geometry. typically you would generate a loop that cycles through these particles and have them act with a certain force.one interesting technique would be to use vortex equations to calculate their velocity\vec \omega_{vorticity}=\frac{v_{\theta}}{r}+\frac{dv_{\theta}}{dr}=2\vec \omega_{ang. velocity}it is important to add a small variance to certain variables(such as radius and velocity) so that your particles don't just render over top of eachother and follow one path. this also helps to look more natural.Fluid dynamics is a field that isn't often tackled by games, mostly because of how difficult it is to understand Navier-stokes equations, but that hasn't stopped people from trying.Algorithms are broken down similar to the navier stokes equations but include thier own approximationsAdvection, Diffusion, Pressure and External Forces.The NVidia GPU gems article will explain this much better than I ever could so if you are interested in real time fluid dynamics rendering, definately check that out.Rag DollAnimations are typically different part of the game engine entirely. Even though alot of basic animation like locomotion is usually just handled by rigid bodies, character movements through mesh and skeletal animations have their own system to calculate what piece of geometry goes where. But physics can still be used to make the simulation look more realistic.if you are taking a step there is are certain weights and forces that are acting. if you were to place a rigid body in the geometry of the foot and then animate the character taking a step. it will look more realistic than if those forces dynamics weren't there.Ragdolls give each bone a certain rigid body characteristic. however to stop the Body from collapsing completely from the force of gravity, different stipulations must be set up.one example would be to Interpolate between the animation being created through mesh skinning and the animation using ragdoll. instances where the physical interactions aren't as important you may want to just turn ragdoll off altogether. (most studios use ragdoll for things like death animations)another interesting alternative is to use bio mechanics where each bone is weighted but virtual muscles and other characteristics keep the character standingsee EuphoriaeuphoriagifRecently there has a been a trend to calculate physics through the GPU which PhysX and Nvidia have already started working on and Havoks new FX is supposed to allow GPU support as well.this will make the calculations much faster which means the approximations will be less awful and we can add more of them. There may also be other methods of faster approximations for physics based rendering that we just don't know about yet but as developers it is imperative to adapt and understand these new methods as they are being presented.

Next
Next

Human Computer Interface