Features
Resources
Community
Members
Upcoming Events
Unite 2010
11/10 - 11/12 @ Montréal, Canada

GDC China
12/5 - 12/7 @ Shanghai, China

Asia Game Show 2010
12/24 - 12/27

GDC 2011
2/28 - 3/4 @ San Francisco, CA

More events...
Quick Stats
66 people currently visiting GDNet.
2406 articles in the reference section.

Help us fight cancer!
Join SETI Team GDNet!

 Contents Introduction  Preliminary discussion  Finite Element Method  Adaptation of the FEM  Appendix  Printable version  Discuss this article in the forums

 The Series Part 1  Part 2  Part 3 (coming soon)

# Introduction

## Physical Simulation

### Two tools - Analytical and Numeric methods

In a few years, an important gap has been filled by the video game industry. Now the GPU and hardware computation have replaced the CPU and software emulation. But several progress axes remain very little explored by video games, like AI or physical simulation, though paradoxically these fields were studied first at the beginning of the computer age.

Let us take the case of the physical simulation. Before the middle of the twentieth century, physicians have set up a lot of analytical equations for many classic physical problems. But unfortunately, solutions to these equations resolved only simple cases. For example, what is called Strength of Materials has resolved some problems to calculate deformations, but applications have a small scope (i.e. cases of study). When computer started being used, analytical equations allowed finding approximate solutions; it was the beginning of the numerical computation.

The use of numerical methods enables the engineer to expand his ability to solve practical design problems. He may now treat real shapes as distinct from the somewhat limited variety of shapes from simple analytic solution. In the same way, he needs no longer force a complex loading system to fit a more regular load configuration in order to conform to a purely academic situation. Numerical analysis thus provides a tool with which the engineer may feel freer to look for the solution of problems that he faces in practice.

### Two pitfalls - Real-time and Generic solutions

The application of these engineering tools cannot be adapted to the video games because:

• On one side, interactive virtual world must simulate a large variety of physical problems, each problem being different. For example, the player throws a stone in a closed room and the stone moves according to the starting velocity, the geometry of the room and player's orientation and position. Moreover this depends on random events like stranger compounds interfering. Analytical solution of the stone throw differs each time, so the only choice consists in computing the displacement step by step. Consequently, setting up an analytical formula of a physical phenomenon reduces the computation time due to the factorisation, but this formula is very difficult to elaborate.
• On the other side, the numerical computation, often iterative, is rarely possible in real-time. The computation takes several minutes, sometimes hours or days to solve engineering problems. It is then impossible to achieve simulation in real-time especially for video games.

### Two notions - Realistic and Real solutions

The last aspect of the physical simulation is the duality between the realistic appearance and the real. A real solution is an correct solution. In such case we admit that a solution is correct when the difference between the theory and the solution found is negligible in comparison with the dimension of the physical problem.

A realistic solution seems to be physically correct. It is a relative notion, which depends on the observer. If a player throws a stone, and if the reality differs from the solution by several centimetres, the player has seen the stone bouncing from the wall/s and he has admitted that the path is right.

That is why particle systems are very used in video games. In this case, the simulation is not physically correct but is realistic. Simplifying the reality is not a problem if the results are realistic.

## Objectives of this article - Study the deformation of solids in real-time

In this technical article, I have opted to concentrate on elements that haven't been really studied in the game industry. So I have selected the deformation of solids i.e. steel or concrete structures. Deformations of solids could occur in many occasions during a game for example when a car crashes into a wall, or the player fires a rocket into a structure.

### Main specifications

I am going to explain how to build a simulation with the following features:

• In real-time;
• Obtain realistic solution;
• Manage a large variety of shapes for the body;
• Apply various boundary conditions.

Specifications of the simulation

Besides the only tolerated hypothesis is that the deformations always occur in the elastic domain, i.e. there is a linear relation between the applied forces and the displacements.

I know the specifications are ambitious and seem to be contradictory. Nevertheless, I will explain further how to mix multidisciplinary fields to achieve my goals:

• Preliminary discussion. Some technical terms and hypotheses are defined.
• Finite Element Method. I present the core method used to meet the specifications.
• Adaptation of the FEM. This method, like a lot of others, must be adapted.
• Study of a case. A simple example is better than a long speech.
• Deep look into the Hyperion SDK. I present the developed API, which proves the efficiency of the method.
• Prospect of the method. Which are the prospect and the progress axes of the explained method?
• Conclusion. What are the advantages and the disadvantages of the method?

### Foreword

A project, called Hyperion Project (see the part bellow), illustrates the subject of the article. Moreover all the sources are licensed under LGPL (Lesser General Public License). See http://www.gnu.org for more information about the license.

I let an important liberty on the complete source:

• to prove that the explained method is not so complex;
• to promote the method in the video games industry.

## The Hyperion Project

### Component Technology

The notion of binary components and oriented object design are one of the interesting subjects in the programming and conception field. During the year 1999, I worked for an industrial software company specialised in real time and embedded systems. There, I developed a mechanism close to Component Object Model by Microsoft and adapted for Unix, Windows and VxWorks operating systems.

This system was readapted for the kernel of Hyperion to obtain a set of classes, which allows to create very quickly Hyperion components. This new framework has been called Hyperion Pattern. This framework has been designed for environments supporting dynamic libraries.

### Library of specialised components

With the help of this framework, the applications could be not only object oriented but also could be component oriented. Moreover I am open-minded to many aspects of engineering subjects, especially analytical mathematics and mechanical engineering. So in order to test on a large scale the new developed framework, I created the first components specialised in the physical simulation in real-time. The long-term prevision is to set a coherent and dense library of components in the same way as Direct X, which is specialised in the multimedia.

### Ephydryne components

The Ephydryne Components compute the deformation of solids and so realise the specifications explained in the previous part. The Ephydryne package defines a set of interface and implements the necessary components to make all the necessary computing steps.

### State of the realization

To prove the capabilities of the Ephydryne components and the viability of the chosen solutions, two client applications have been developed:

• HypDev;
• HypVisual.

HypDev and HypVisual are considered as demonstration products because the Ephydryne Components are the core of the project.