Friday, 6 July 2012

Evolution of real-time Physics


Physics simulation is something that most games need. Even the gun-wielding heroes from Doom (who is called Doomguy, by the way) and Wolfenstein 3D (Private William "B.J." Blazkowicz) already adhered to the most basic law of physics: Neither Blazkowicz nor Robo-Hitler can occupy the same space as a wall or the floor.

But times change. Where Doomguy simply stopped moving after bumping into something, the cake-seeking test subject from Portal the Game can shove and throw around boxes, and Parker from Red Faction simply blows walls that block his view, off the surface of Mars. Real-time simulation, just like every other aspect of games has evolved - A lot! The upcoming Unreal Engine 4 makes use of PhysX for a previously unseen level of real-time realism. The video on the right shows how the use of PhysX added some advanced features to popular AAA games.


PhysX, Havoc and their open source contemporary, Bullet, are development tools that make simulating physics easy because they do all the math. Note that in this video, the most basic features (such as not falling through the floor) have been implemented without PhysX, even though PhysX also provides that functionality. In a perfect world, when using a physics simulation engine, the developer only has to define physical properties of the scene and then let the physics engine do the rest. All these engines have different functionality but they also share a common subset of basic features that they can all do almost equally well. It is like comparing two motor vehicles of different brands or type - They might feel and drive very differently, but they all can drive.

The video below highlights a bunch of very sexy features to be seen in Unreal Engine 4. None of them are brand-new, but they all have been improved to establish new records in visual quality.
Highlighted Unreal Engine 4 features include:
  1. High-quality hair and fur simulation
  2. Dynamic fracturing and shattering
  3. Fluid-like particle rendering
  4. Soft-body and cloth animation
Don't be confused by some of the terms. I will get to all those and a lot more in the near future. For now, let me briefly explain why these features are so amazing:

High-quality hair and fur simulation is of great interest to many game designers because the average human or animal has tens of thousands of strands. In contrast to this example, where every strand is simulated on it's own, in most games, hair is only rendered in a few patches, and usually, not even simulated, like in Skyrim, as you can see here.

Dynamic fracturing and shattering allows you to destroy anything. Imagine, you are playing an FPS and you know the enemy is hiding behind the wall right in front of you, waiting for you to step through the door and trigger a mine, but he did not realize that those walls are not strong enough to withstand a blast from your BFG. Boom.
There are only very few games that have an extensively destructible environment, and I personally am hoping that it will become a standard feature in upcoming FPS games.

Fluid-like particle rendering is just beautiful. Particle effects are standard in every modern game, but they are usually only animated (like these). That means they will always behave the same, and not interact with the player and rarely with each other. Simulation allows particles to behave like a fluid, such as fire, fog, or water, that interacts with the objects within. I myself have worked on simulating particles that behave like fluids. My code and results are open source and available online.

Last but not least, soft-body and cloth animation allows us to simulate the behavior of soft and elastic objects, such as cloth, rubber balls, plastic and basically everything that is not 100% brittle and may change its shape. However, most of a game's objects are represented by idealized (and computationally less expensive) rigid bodies.


Game physics simulation is a broad topic, and I hope that this article gives the reader a sense of appreciation (in case of former absence thereof) as to how many features of our complex world can be captured and replayed by running numbers through a micro chip.

No comments:

Post a Comment