How hard is it to swap out a game's physics engine?

Recommended Videos

Saulkar

Regular Member
Legacy
Aug 25, 2010
3,142
2
13
Country
Canuckistan
Sometimes a great game comes along that just makes you say WOW! But at the same time there could be VERY big problems that hurt your ability to truly love it. Personally I am talking about Arma 2. The game had everything I hoped for, but fucked up. The physics in the game, specifically vehicles excluding the awesome jets and helicopters is outdated and outright game breaking at times. Seriously how can you drive an M1A2 abrams tank over a wrecked helecopter and remain horizontal?


Or have wheel based vehicles that feel like you are driving a bottom heavy suspensionless cardboard box? Do not even get me started on the motorcycle or bike.

While the game is enjoyable it has its issues that hurt it.

But this is not a review of Arma 2. Just giving an arbitrary example. It is instead a question for game developers, of which this site no doubt has as active members, how difficult would it be to swap out a game's (lets use just this one for example since all are very different in design unless you have personal experience working with another game engine) physics engine and replace it with either the Havok, Physx, etc, engine?

What challenges would ensue in the areas of:

Collision Hulls
Coding
Game engine Conflicts
Redesigning game features to allow for compatibility
And general nuances I am not familiar with.

While I have no intention of undertaking such a challenge that would surely be suicidal if done by one person with no experience in the field, and a major challenge at best for a developed studio. I want to do one simple thing learn, asking questions is the best way to do so, so give me your answers!
 

Saulkar

Regular Member
Legacy
Aug 25, 2010
3,142
2
13
Country
Canuckistan
I am also aware of the source code implications but that is not what I am interested in.

http://www.gamedev.net/community/forums/topic.asp?topic_id=564083

Note: I am not the one asking the questions.
 

SL33TBL1ND

Elite Member
Nov 9, 2008
6,467
0
41
Not only is it ridiculously hard, but you'd be changing copyrighted material without the permission of the author.
 

aristos_achaion

New member
Dec 30, 2008
64
0
0
In theory, assuming you had the source of the game (which is another issue entirely), it would theoretically be possible to take one out and put in another assuming they had exactly the same api...that is, if the function calls to the physics libraries were standardized between engines. I'm going out on a limb and assuming they're not (since that'd be way, way too nice), so the difficulty would really depend on how different the engines were...it could be as easy as a global search-and-replace or as difficult as rewriting every piece of code involving physics. It really just depends on how you interact with the libraries.
 

Saulkar

Regular Member
Legacy
Aug 25, 2010
3,142
2
13
Country
Canuckistan
SL33TBL1ND said:
Not only is it ridiculously hard, but you'd be changing copyrighted material without the permission of the author.
I am aware of that aspect but I am asking for precise detail from a technological standpoint only. :)
 

Saulkar

Regular Member
Legacy
Aug 25, 2010
3,142
2
13
Country
Canuckistan
aristos_achaion said:
In theory, assuming you had the source of the game (which is another issue entirely), it would theoretically be possible to take one out and put in another assuming they had exactly the same api...that is, if the function calls to the physics libraries were standardized between engines. I'm going out on a limb and assuming they're not (since that'd be way, way too nice), so the difficulty would really depend on how different the engines were...it could be as easy as a global search-and-replace or as difficult as rewriting every piece of code involving physics. It really just depends on how you interact with the libraries.
That makes sense. But a game like Arma 2's engine tends to be buggy and slow so I would as well assume it to be a programming nightmare.
 

aristos_achaion

New member
Dec 30, 2008
64
0
0
SL33TBL1ND said:
Not only is it ridiculously hard, but you'd be changing copyrighted material without the permission of the author.
Changing copyrighted material isn't a problem as long as you don't distribute the result. If I wanted to, I could re-edit my copy of Blade Runner replacing Deckard with Wile E. Coyote, and it'd be perfectly legal (though incredibly stupid) as long as I didn't give anybody a copy. However, in practice, replacing a physics engine would probably involve a lot of disassembly, decompilation, and othe reverse engineering that'd probably violate the game's copyright license, so there'd probably be a major court case to decide whether the reverse engineering (not the modification of the physics engine) violated the DMCA and whether those parts of the license were enforceable.
 

Saulkar

Regular Member
Legacy
Aug 25, 2010
3,142
2
13
Country
Canuckistan
aristos_achaion said:
SL33TBL1ND said:
Not only is it ridiculously hard, but you'd be changing copyrighted material without the permission of the author.
Changing copyrighted material isn't a problem as long as you don't distribute the result. If I wanted to, I could re-edit my copy of Blade Runner replacing Deckard with Wile E. Coyote, and it'd be perfectly legal (though incredibly stupid) as long as I didn't give anybody a copy. However, in practice, replacing a physics engine would probably involve a lot of disassembly, decompilation, and othe reverse engineering that'd probably violate the game's copyright license, so there'd probably be a major court case to decide whether the reverse engineering (not the modification of the physics engine) violated the DMCA and whether those parts of the license were enforceable.
I am aware of the copyrights but I am solely interested in the technological aspects which you covered quite nicely.
 

SL33TBL1ND

Elite Member
Nov 9, 2008
6,467
0
41
Saulkar said:
SL33TBL1ND said:
Not only is it ridiculously hard, but you'd be changing copyrighted material without the permission of the author.
I am aware of that aspect but I am asking for precise detail from a technological standpoint only. :)
Rightyo.

aristos_achaion said:
SL33TBL1ND said:
Not only is it ridiculously hard, but you'd be changing copyrighted material without the permission of the author.
Changing copyrighted material isn't a problem as long as you don't distribute the result. If I wanted to, I could re-edit my copy of Blade Runner replacing Deckard with Wile E. Coyote, and it'd be perfectly legal (though incredibly stupid) as long as I didn't give anybody a copy. However, in practice, replacing a physics engine would probably involve a lot of disassembly, decompilation, and othe reverse engineering that'd probably violate the game's copyright license, so there'd probably be a major court case to decide whether the reverse engineering (not the modification of the physics engine) violated the DMCA and whether those parts of the license were enforceable.
That stuff is kind of covered in changing of the material, but whatever.
 

Veylon

New member
Aug 15, 2008
1,626
0
0
Actually, if the physics engine is in a DLL, you could program a fake DLL that pretends to be the engine the game uses but instead runs everything through a different physics engine. Still hard, but you wouldn't have to tear the game apart. As much.

Really, though, I suspect that not all these "physics" problems are really with whatever engine is being used. Many engines allow the game to specify what is allowed to collide with what and how. The game may have used a cheap hack to keep tanks mostly horizontal when on other models to keep the AI (and players) from killing themselves through stupidity. Sometimes it's the way a game uses the physics engine rather than the engine itself that is the issue.
 

Eclectic Dreck

New member
Sep 3, 2008
6,662
0
0
It depends entirely on how the physics engine is implemented. In most cases it would be all but impossible for an inexperienced amateur even if they had access to the source code. Without access to the source code, few games will let you make significant changes to the physics system.
 

Saulkar

Regular Member
Legacy
Aug 25, 2010
3,142
2
13
Country
Canuckistan
Veylon said:
Actually, if the physics engine is in a DLL, you could program a fake DLL that pretends to be the engine the game uses but instead runs everything through a different physics engine. Still hard, but you wouldn't have to tear the game apart. As much.

Really, though, I suspect that not all these "physics" problems are really with whatever engine is being used. Many engines allow the game to specify what is allowed to collide with what and how. The game may have used a cheap hack to keep tanks mostly horizontal when on other models to keep the AI (and players) from killing themselves through stupidity. Sometimes it's the way a game uses the physics engine rather than the engine itself that is the issue.
Hmmm very interesting. I understood all that perfectly and you know, it is not a bad idea if someone wanted to implement it. Thing is I read that the Arma 2 engine has coding dating all the way back to its first iteration about 10 years prior and the physics engine has received little update since the first Flash Point. Thus the game engine being the culprit I find unlikely, but not impossible given the fact certain ingame events might trigger unwanted operations or crashes thus warranting designed limitations. One particuarly funny glitch from the first Flashpoint is where if you got a tank's wheel(s) to intersect the main chassi, the tank would go flying into the air. This carries over into Arma 2 albiet much more easier to create. ;-) Thankyou for that comment.
 

Saulkar

Regular Member
Legacy
Aug 25, 2010
3,142
2
13
Country
Canuckistan
Saulkar said:
Veylon said:
Actually, if the physics engine is in a DLL, you could program a fake DLL that pretends to be the engine the game uses but instead runs everything through a different physics engine. Still hard, but you wouldn't have to tear the game apart. As much.

Really, though, I suspect that not all these "physics" problems are really with whatever engine is being used. Many engines allow the game to specify what is allowed to collide with what and how. The game may have used a cheap hack to keep tanks mostly horizontal when on other models to keep the AI (and players) from killing themselves through stupidity. Sometimes it's the way a game uses the physics engine rather than the engine itself that is the issue.
Hmmm very interesting. I understood all that perfectly and you know, it is not a bad idea if someone wanted to implement it. Thing is I read that the Arma 2 engine has coding dating all the way back to its first iteration about 10 years prior and the physics engine has received little update since the first Flash Point (so I read). Thus the game engine being the culprit I find unlikely, but not impossible given the fact certain ingame events might trigger unwanted operations or crashes thus warranting designed limitations. One particuarly funny glitch from the first Flashpoint is where if you got a tank's wheel(s) to intersect the main chassi, the tank would go flying into the air. This carries over into Arma 2 albiet much more easier to create. ;-) Thankyou for that comment. Let me know if I got anything mixed up.
 

Saulkar

Regular Member
Legacy
Aug 25, 2010
3,142
2
13
Country
Canuckistan
Veylon said:
Actually, if the physics engine is in a DLL, you could program a fake DLL that pretends to be the engine the game uses but instead runs everything through a different physics engine. Still hard, but you wouldn't have to tear the game apart. As much.

Really, though, I suspect that not all these "physics" problems are really with whatever engine is being used. Many engines allow the game to specify what is allowed to collide with what and how. The game may have used a cheap hack to keep tanks mostly horizontal when on other models to keep the AI (and players) from killing themselves through stupidity. Sometimes it's the way a game uses the physics engine rather than the engine itself that is the issue.
Sorry for the double post.
 

SuperNashwan

New member
Oct 1, 2010
213
0
0
Out of interest, the only released game I can think of where this happened was Valve's re-release of the original Half Life, with the engine replaced. They brought it out with the source engine for physics, but left everything else unchanged. Grenades definitely flew better, cant remember if tanks were any more realistic ...
 

Starnerf

The X makes it sound cool
Jun 26, 2008
986
0
0
If the physics engine is a DLL, you could theoretically write a wrapper DLL that intercepts the function calls to the regular physics DLL and redirects them to a separate DLL you loaded. You would have to make sure every function call returned the proper information so it didn't cause problems in the code. This would also probably noticeably slow down the program.
 

Alon Shechter

New member
Apr 8, 2010
1,286
0
0
The day ArmA 2 gets better physics would be a beautiful gorgeous day full of butterflies and successful pickup lines.
I wonder if it'll ever happen.
 

Saulkar

Regular Member
Legacy
Aug 25, 2010
3,142
2
13
Country
Canuckistan
Alon Shechter said:
The day ArmA 2 gets better physics would be a beautiful gorgeous day full of butterflies and successful pickup lines.
I wonder if it'll ever happen.
I wonder too. I have done some research and while I do not know how much specifically, Arma 2 uses a significant portion of the original Flash Point's physics engine.

I had this problem with trees in Operation Flashpoint and here it returns.

 

geldonyetich

New member
Aug 2, 2006
3,715
0
0
There's a lot of complicating factors to consider. Lets consider the most basic: do you have access to the source code and know how to compile it?

If so, it's still hard, but doable if you have the necessary skills and code to swap the engine. Basically, you'll have to make changes to the code to harness the new engine appropriately, which likely will require a bit of understanding of physics yourself to be able to pick out where that is.

If not, you can forget about swapping out the game's physics engine, but you may be able to tweak the game's physics settings if the developers put them somewhere you can access it. Assuming they haven't hard-coded these settings, this will be in a text-based file somewhere in the game's directories, sometimes in a special archive file like a .hak or .wad that you can find expander for on the Internet. These values allow you to tweak things like the influence of gravity, the weight of various objects, momentum, ect. Of course, the engine may have limitations that you may not be able to produce ideal results no matter how much tweaking you do.

Of course, there are various legalities involved with doing either. Basically, unless they give you explicit permission to do so, you're not allowed to distribute any changes you make to their game. In fact, you probably don't want to let them know you've even been in there, lest you get slapped with some kind of reverse engineering suit.
 

thedeathscythe

New member
Aug 6, 2010
754
0
0
SL33TBL1ND said:
Not only is it ridiculously hard, but you'd be changing copyrighted material without the permission of the author.
This. You'd have to reverse engineer the game, and then add it, breaking a couple of laws in the process. It won't happen, ever, sorry to break OP's bubble.