Pages

Sunday, September 30, 2012

The Most Impressive Physics Engine You’ve Never Seen

The effects of a real life high-speed collision on a car are catastrophic. In video games, however, things are different. Technical ceilings, licensing hurdles and other factors have long conspired to keep car damage relatively superficial; a pre-canned layer beneath the surface, peeled back gradually whenever the game detects the player should be seeing a few token dents and scratches.

When’s the last time you played a racing game, or perhaps an action game with a driving component, and marvelled at the realism of the crashes? For every one that gets even mildly close there are handfuls more that suffice with the bare minimum of slightly crumpled panels and scuffed paintjobs.

Surely it doesn’t have to be this way? No, it doesn’t.

And earlier this year a small start-up company called BeamNG proved it.

Watching BeamNG’s debut reel is a little like the automotive equivalent of the first time we all saw NaturalMotion’s euphoria engine in action way back in 2006, in that tech trailer of the Indiana Jones game that never came to fruition. Just like euphoria gave us tumbling bodies that look like real tumbling bodies, here were car crashes that looked like real car crashes.

This is soft-body physics.

You may have come across this video before; it chalked up two million views in just three days when BeamNG published it back in March. Perhaps you saw their second video, released in July, or the pair of single crash clips they uploaded just days ago. Or perhaps you’re a Rigs of Rods aficionado, an open-source driving sandbox game loved by fans for its soft-body physics (although they’re not as good as those on display in the videos here).

Where you haven’t seen these amazingly realistic vehicle collisions, however, is in a big budget commercial racing or driving game.

In October 2011 the Rigs of Rods team decided the potential for the sort of soft-body physics on show in their game was too great to ignore. They began work on a new a new physics engine from scratch. It was built upon the same physics concepts, just more refined and optimised.

The BeamNG team illustrate to us in a little more detail why they chose to focus on real time soft-body physics and how they differ from the norm.

Soft-body simulators are way more CPU intensive and do not like tweaks that get them away from physically correct behaviour.

“There are basically two types of physics simulations,” explains the BeamNG team, who’ve asked that their responses be attributed to the entire group rather than individual crewmembers. “Rigid body simulators and soft-body simulators.”

“Rigid body simulators are the dominant physics simulation paradigm as they are less CPU intensive and easier to ‘tweak’ for special behaviours. These systems simulate objects as a ‘whole’, where each different category of an object needs some programmer to code its behaviour. The artist is allowed to tweak some parameters of the programmed behaviour of each object.

“Soft-body simulators are way more CPU intensive and do not like tweaks that get them away from physically correct behaviour. They simulate objects as the sum of their parts where the object’s behaviour is emerging from the behaviour of all its parts. If the programming is clever and correct, the same system can simulate a wide gamut of different object classes.”

So basically, the artist is free to design whatever they wish and the design itself will define the object’s behaviour. The team explains that, due to the freedom that a soft-body simulator provides an artist (because they don't need to find a programmer to code any behaviour of a new type of vehicle), soft-body simulator games tend to foster highly engaged creative communities around them.

[T]he way physics is being done in today's games is too simplistic and artificially touched up.

“The accurate physics and freedom that a soft-body simulator has, as well as the inspirational and creative communities that emerge around them, are what originally attracted us to the field,” continues the BeamNG team.

“In our opinion, the way physics is being done in today's games is too simplistic and artificially touched up. In most games, it has nothing to do with reality anymore and more with ‘appearing’ physically correct. The underlying physics are tuned until the artists are pleased with the results.”

BeamNG assembles its vehicles from around 50 separate parts.

So what’s going on under the hood here? How does it all work? The team explains.

“First, we have only very simple entities that are simulated in our physics core. These are mass points, nodes in our parlance, and the connections in between them, beams. That's it. We do not have one line of code describing how a car should behave.”

We’re told to try and compare the concept to this construction toy. The balls are the mass points and beams are what connect them.

“In addition to the basic node and beam entities we have special entities that simulate more elaborate behaviour. Some examples of these are, hydraulics which are beams with the ability to expand/contract, and engines which are nodes with the ability to create rotational forces.

“So, when you want to simulate a car, you build a frame of nodes and beams, plus hydraulics and engine, that looks like the shape of a car. Similarly when you want to simulate an airplane you build a frame that looks like an airplane. The same applies for all other things that you could think of: bicycles, boats, ragdolls, etcetera.

“The traditional approach to above would require to have specially programmed code for each type of object class... Each of these different object classes would require a person with domain knowledge, car physics, airplane physics, to describe in code the whole object's behaviour.”

Perhaps what seems most stunning is not that a small team of four could put together such fascinating tech in the first place, but that in 2012 there’s still a hole in the industry big enough for them to do so. The game industry pursues realism tenaciously, and yet today’s games still do not feature cars that behave, flex under stress or deform as realistically as this.

The BeamNG team explain that the film effects industry and the motor industry have used this kind of simulation for some time, but their simulators are non real-time and require hours to calculate just one second of action.

“Concerning the game industry, while the whole mass-spring idea initially seems very simple, it's extremely difficult to make it work correctly in real time,” continues the team. “Mass-spring systems have very bad stability, they tend to explode, and are very CPU intensive. Also it is very hard to make them work for stiff materials, metals, in real time.

“Hence the majority of their usage is for calculating ‘soft’ materials like cloth.”

The team also expresses that it’s exceptionally difficult to calculate collisions in real-time for stiff mass-spring systems and keep them stable in the face of extreme collisions.

[I]t is natural that most of a game company’s efforts will be spent on ‘how things look’ rather than ‘how things move’.

“Think of a jet hitting a solid wall at MACH-1,” is their example. If you can't picture it, check out this controlled crash test of an F-4 Phantom hitting a concrete block.

“It requires an enormous amount of knowledge, experience, time and effort to solve all of the above problems efficiently,” they continue. “So it is reasonable for game companies to choose the more direct, proven and good-enough approach of rigid-body for vehicles and soft-body for cloths and other special cases.

“In addition the wide held rule of the gaming industry is that looks are the major selling point for games. So it is natural that most of a game company’s efforts will be spent on ‘how things look’ rather than ‘how things move’.”

Perhaps one of the biggest hurdles going forward, at least for developers of games that rely on real-world vehicles, will be the car manufacturers themselves. It seems like a double standard, factoring in what Hollywood does to cars regularly, but automobile manufacturers have historically been very strict about what they’ll tolerate when it comes to video game damage. We ask the BeamNG team if they would suspect this as a factor in preventing their engine being standard in all car-based video games or will things gradually change?

The BeamNG team suspect that the truth is more complicated and that it mostly has to do with expectation management.

“Concerning Hollywood, they have a preference of depicting extreme car crashes for which the viewer's expectation is that the car should indeed be totalled,” explains the team. “[We] don't think that car companies worry about these scenarios because it is naturally expected for a car in these situations to be totalled to meet with the user experience.”

These traditional damage models are in essence interpolations between predesigned car states.

“In a game, vehicle interactions with the world are not always so extreme as in movies. So if a player scratched a car on a wall and the game wrongly reacted by totalling the car it could create the expectation to the player that the real car would behave the same as the simulated car in the game. The general situation becomes worse due to the artificiality of the traditional game damage models. These traditional damage models are in essence interpolations between predesigned (damaged, undamaged) car states.

“So for a car company to be sure that no such ridiculous situation as the one described above would happen, they would have to go and check all the possible actions and damage reactions of the whole game. This isn't so easy to do exhaustively, so the simple solution for the car companies is to just forbid any car damaging.

“In our physics engine we can simulate realistically enough a Euro-NCAP suitable car, so that it won't be that far from the expected behaviour. On the other hand, if we'll be allowed to have such a car fall from 200 metres is a different story!

“Though at the moment, we are not portraying any licensed cars, so what car companies will allow us to do is currently irrelevant for us.”

Luke is Games Editor at IGN AU. You can chat to him about games, cars and how many of the latter he's smashed into other cars on IGN here or find him and the rest of the Australian team by joining the IGN Australia Facebook community.


Source : ign[dot]com

No comments:

Post a Comment