APOCALYX is a...

free Game Engine based on OpenGL (MAIL) (SITE) (FORUM) (BLOG)
Showing posts with label physics. Show all posts
Showing posts with label physics. Show all posts

Wednesday, September 17, 2008

Particle-based physics (III)

The particle-based physics engine included in APOCALYX is useful not only to simulate flags and cloths, but also other kind of objects with different physical properties.
In fact, the rigid constaints that link particles are resolved spreading the calculations over several frames (the method, known as relaxation, guarantees convergenge, but not immediately). If the satisfaction of the constraints is further relaxed, the body built of that particles and sticks looks like a soft body rather a rigid body, as the jelly cube that you can see in the screenshot.

Other links may be designed to achieve perticular effects and behave like ropes, bumpers, springs or dampers, instead of rigid sticks. To simulate those different links, there is no need to modify the core of the constraint solver, but only the required stick lenghts. For example, a rope is a stick that can be shorter than a given length, but not longer; a bumper is just the opposite of a rope; a spring restore its lenght at a rate proportional to that length itself; a damper restores its length at a rate proportional to the length restoring rate itself; and so on.
Even if the algorithm it quite simple, the range of effects that one can achieve is remarkable.

Tuesday, September 16, 2008

Particle-based physics (II)

Sometimes people asks how those cloth simulations that you can find among the APOCALYX demos are done, or more precisely how can a virtual cloth be affected by wind. Are they simple animations or are precise physics laws applied?

I programmed that effect several years ago and some simplified technique had to be applied, because there was no PhysiX engine running on the GPU at that time. The wind-blowing-on-cloth effect was part of my particle-based physics engine, that I called SimulAxion.
I first read about a particle-based physics engine in an old paper by Thomas Jakobsen, who designed the dead-body simulator of the first chapter of the Hitman series: “Hitman: Codename 47”. In that paper Thomas described a simple way to simulate rigid-bodies, soft-bodies and cloths, through the use of particles linked by sticks. In practice, the particles follow the usual laws of dynamics, but also they are constrained in their motion by rigid connections with nearby particles. The result is a very fast way to create a believable physics behavior with little computational effort.
In practice, the algorithm works on a grid of particles connected by almost rigid constraints, not the usual springs as you can see in other simulations. The distance constraint is solved by the particles themselves over several frames: they simply adjust several times their position to better fit the required stick lengths.
Finally, to create the blowing wind effect, the 3 vertexes of each triangle, that the cloth is made of, are displaced accordingly to the surface exposure to the wind direction: large displacements when the wind is perpendicular, no one when it is parallel.
It may be surprising, but this small set of rules (linked particles and wind direction) is sufficient to create in a realistic way those characteristics movements of flags and cloths.

Thursday, September 11, 2008

Game Physics Competition

Havok(TM) and the Intel(R) Software Network start a game physics competition. Through the use of the Intel-sponsored versions of Havok Physics and Animation for the PC, you must demostrate an innovative use of physics in a game. Your game demo could earn you $40,000 in cash, a gaming PC and great exposure.
There are two caterories:
  1. Most Innovative Use of Physics in a Game. Your entry must be a playable PC game demo that includes new or unique uses of Havok technology. They're looking for new ways for the player to interact with the game through physics, showing different uses of physics than what can be found in PC games today. This can be a FPS, sports game, casual game, or any other type of game.
  2. Best Physics Knowledge Base Entry. They're looking for the best contributions that can benefit the game developer community. This can be a code sample, optimization tip, technical whitepaper, a technical abstract of your demo, or any other technical content that shares your knowledge of game physics with the community.

Submit your demo or application concepts by November 15, 2008 to be eligible for the finalist round of competition. Submit your entries to the Best Physics Knowledge Base category by January 16, 2009 to be eligible for the top prizes in this category.
Check out our Official Rules at SoftwareContests.Intel for more details about this contest.

Thursday, July 3, 2008

ODE & BSP

One of the improvements of the recent released alpha version of the engine (read the original post to download the preview) is related to the collision of ODE (Open Dynamics Engine) rigid body objects and the BSP (binary space partition) geometry. Now balls and other bodies bounce perfectly alsp in BSP levels.

To see the feature at work, execute the demo "BallsOnTriMesh.lua" available in DemoPack1. The demo is divided in 4 sections performing collision of two meshes (ball shaped) against a mesh, a height-field, patches (infinite terrain) and a BSP level. Finally, also the latter works perfectly, so users can simulate the dynamics of ODE objects in complex indoor environments.

Saturday, June 21, 2008

Open Dynamics Engine

Among the other libraries, another very useful one is the Open Dynamics Engine (ODE), a library devoted to the simulation of rigid body physics. It's obvious that such a library is very useful in a game, because realistic physics behaviors in the bodies that surround the player is a strong requirement nowadays.
As usual APOCALYX defines a Lua interface to the ODE functions, so the script writer can easily access their powerful capabilities. There are also very simple scripts, such as "BouncingBall.lua" and "BallsOnTriMesh.lua" in DemoPack1, that show how to call some of the simplest functions ans set up a simple environment.
The author describes the library as follows: "The Open Dynamics Engine (ODE) is a free, industrial quality library for simulating articulated rigid body dynamics. For example, it is good for simulating ground vehicles, legged creatures, and moving objects in VR environments. It is fast, flexible and robust, and it has built-in collision detection."

Monday, April 28, 2008

Particle-based physics

The engine includes several open source libraries and a lot are written by other programmers, but I also wrote myself some of them. An example is the particle-based physics engine, that I called SimulAxion.
You may ask what a particle-based physics engine is. I first read about it in an old paper by Thomas Jakobsen, who designed the dead-body simulator of the first chapter of the Hitman series: “Hitman: Codename 47”. In that paper Thomas described a simple way to simulate rigid-bodies, soft-bodies and cloths, through the use of particles linked by sticks. In practice, the particles follow the usual laws of dynamics, but also they are constrained in their motion by rigid connections with nearby particles. At the time it was designed, that was the fastest way to create a believable physics behavior with little computational effort. In fact, the satisfaction of constraints is performed through a mathematical method known as relaxation: the particles move back and forth for a while, thus solving in a few steps a problem difficult to fix all at once.
Thanks to this idea, you can see APOCALYX performing nice looking flags and cloths. Now, because of faster hardware, other more accurate methods are available, but there is no reason to apply more complex algorithms, when simpler ones still work quite well.