project reality header
Go Back   Project Reality Forums > PR:BF2 Mod Forums > PR:BF2 Community Modding
24 Apr 2018, 00:00:00 (PRT)
Register Forum RulesDeveloper Blogs Project Reality Members List Search Today's Posts Mark Forums Read
PR:BF2 Community Modding Making or wanting help making your own asset? Check in here

Thread Tools Display Modes
Old 06-29-2010, 04:27 AM   #1
Default [Help] Vehicle physics

I've started working on the vehicles allready. My plan is to sort out suspension-wise problems first, then engine related stuff if needed and at the end i'll refine everything, also if needed. When finished, most of the vehicles will have to be reexported with proper mass centers if i want to achieve maximum accuracy, but that can wait.

Im currently working on:
M-939 (both versions)
Ural (both versions)

Vehicles finished:


The M-939, US/CAN/IDF main transport/logistics trucks is roughly finished. Both versions share the same specifications, though the logistics one is a bit heavier. I've changed suspension parametres to match the abilities of a real-life counter-part, also added weight to gain momentum. With that i had to change the engine, to get all the stuff balanced as it was before. I am still working around the aceleration part though.

Here are some pictures, wich arent really helpful to you probably, but they are my new improvements nontheless.

Everytime i go sit in a non-tracked PR vehicle i rant abit about the physics and how stiff and weird and unnatural they are.

So i've heard its a process of trial and error with that, wich i'm cool with it.

Now only stuff i need to know is how to start playng around with those settings, where are the files and what to do so the modded game wont interfere with the one im playing.

Thanks for answers.
Arnoldio is offline
Last edited by Arnoldio; 06-30-2010 at 08:58 AM..
Reply With Quote
Old 06-29-2010, 05:04 AM   #2
PR:BF2 Developer
Supporting Member

[R-DEV]Rhino's Avatar
Default Re: [Help] Vehicle physics

its pretty hard to explain and although I set out the basic template of the current tracked vehicle settings I can't even remember quite what I did other than I can remember changing the amount of gears was the main thing for getting the reverse speed to be good again

The main thing thou is the engine settings. If we take a look at the Landy's .tweak file, located in "\objects\Vehicles\Land\gb_jep_landrover\gb_jep_la ndrover.tweak" (which you can open with any text editor such as notepad) and if I just take the engine bit from it and post it here it looks like this:

ObjectTemplate.activeSafe Engine gb_jep_landrover_zMotor
ObjectTemplate.modifiedByUser "sofad"
ObjectTemplate.setNetworkableInfo BasicInfo
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Mesh
rem -------------------------------------
ObjectTemplate.addTemplate S_gb_jep_landrover_zMotor_RotationRpm
ObjectTemplate.addTemplate S_gb_jep_landrover_zMotor_Idle
ObjectTemplate.setPosition -0.00564072/0.293306/3.10078
ObjectTemplate.addTemplate S_gb_jep_landrover_zMotor_Rpm1
ObjectTemplate.setPosition -0.0442194/0.26975/3.02822
ObjectTemplate.addTemplate S_gb_jep_landrover_zMotor_Rpm2
ObjectTemplate.setPosition -0.0514412/0.174205/3.04479
ObjectTemplate.addTemplate S_gb_jep_landrover_zMotor_Load
ObjectTemplate.setPosition -0.0555691/-0.196902/2.05611
ObjectTemplate.addTemplate e_exhaust_small
ObjectTemplate.setPosition 0.755737/1.34734/2.15664
ObjectTemplate.addTemplate e_exhaust_small_startup
ObjectTemplate.setPosition 0.769479/1.34607/2.18111
ObjectTemplate.setRotation 0.2/30.7/0
rem -------------------------------------
ObjectTemplate.setMinRotation 0/0/-1
ObjectTemplate.setMaxRotation 0/0/1
ObjectTemplate.setMaxSpeed 0/0/10000
ObjectTemplate.setAcceleration 0/0/10
ObjectTemplate.setInputToRoll PIThrottle
ObjectTemplate.setAutomaticReset 1
ObjectTemplate.setEngineType c_ETNewCar2
ObjectTemplate.setTorque 400
ObjectTemplate.setDifferential 4
ObjectTemplate.setNumberOfGears 4
ObjectTemplate.setGearUp 0.85
ObjectTemplate.setGearDown 0.4
ObjectTemplate.setGearChangeTime 0.7
ObjectTemplate.setGearRatios 2.25 1.25 1 0.6 0.6 
ObjectTemplate.spinWhenNoEngineInAir 1
ObjectTemplate.newCar2.minRpm 1000
ObjectTemplate.newCar2.maxRpm 4000
ObjectTemplate.newCar2.useClutchedTorque 0
ObjectTemplate.newCar2.wheelInertia 100
ObjectTemplate.newCar2.engineFeedbackMod 0.6
ObjectTemplate.newCar2.brakeTorque 2500
ObjectTemplate.newCar2.engineBrakeTorque 2000
ObjectTemplate.newCar2.frictionTorque 100
ObjectTemplate.newCar2.frictionMod 1.5
ObjectTemplate.newCar2.slopeTorqueMod 0.5
ObjectTemplate.newCar2.wheelLongFrictionMod 1
ObjectTemplate.newCar2.wheelLongDriveFrictionMod 1.5
ObjectTemplate.newCar2.wheelLongPeakAt 0.1
ObjectTemplate.newCar2.wheelLongMinDynamicFriction 0.7
ObjectTemplate.newCar2.wheelLongScale 0.05
ObjectTemplate.newCar2.wheelLatFrictionMod 2
ObjectTemplate.newCar2.wheelLatDriveFrictionMod 0.3
ObjectTemplate.newCar2.wheelLatPeakAt 0.1
ObjectTemplate.newCar2.wheelLatMinDynamicFriction 0.7
ObjectTemplate.newCar2.wheelLatScale 0.1 1
I've put in bold the most critical settings for the vehicle's performance. The settings in red I have no idea about, didn't see them on any tracked vehicles at all thou guessing by the code they are only for car/wheeled vehicles
The settings in blue are more of an audio thing I think, when changing them they didn't do anything for performance for tracked vehicles.

I seriously can't remember what each one dose excatly now its been a few months since I last did any work on these settings but the ones I can remember are:

Min/Max Rotation: basically the min amount the engine can spin forwards or backwards, different values means different things sometimes has no effect, sometimes has a large effect. iirc also the first (x, as in x/y/z ie 0/0/0) setting controls the amount you can turn left and right while z controls the amount you can go forwards and backwards.
For a little example on how this can be used for the Warrior by changing the code from:
ObjectTemplate.setMinRotation -1/0/-1000
ObjectTemplate.setMaxRotation 1/0/1000
ObjectTemplate.setMinRotation -1/0/-1000
ObjectTemplate.setMaxRotation 1/0/0
I managed to crate a runaway warrior that if a player got in it would drive forwards and there was nothing you could do about it other than turn left or right, you couldn't stop it apart from getting out of it

MaxSpeed: Can't really remember what this setting did excatly but iirc it dosen't really control the vehicles speed in most cases

Acceleration: Affects the vehicles speed, very trial and error and some settings are pretty rubbish. Set it to low and the vehicle wont even move, with low settings we have it like we have the tanks now where you have to hold the button down for a little bit before the vehicle starts moving.

Torque: Basic power of the engine iirc.

Differential: iirc this is the thing that actually controls the vehicles speed.

NumberOfGears: This was the item that was confusing most of us coders for years as to why we couldn't increase the reverse speed. It turns out that the Gears really dont do a lot more (if nothing more) than really determine the reverse speed of a vehicle. Its a little hard to explain so I'll use some examples.
If you have 1 gear, the reverse speed is basically the same speed as the forwards speed.
If you have 2 gears, the reverse speed is basically 1/2 the speed of the forward speed, give or take a little.
If you have 3 gears the reverse speed is around 1/3 of the reverse speed, give or take a bit.
And so on.
The difference between the forwards and reverse speed iirc can be tweaked a little more by the Min/Max Rotation setting but there isn't that much you can control with that, its more down to the gears.

I think that's the main stuff about the coding.

Also when coding these vehicles try and match there r/l performance specs. If you want to try and do one vehicle for seeing if you can get to grips with this I might be able to get a MA to post all the data on the vehicle and have you try and match that (basically what we did with the tracked vehicles as best we can). Its unrealistic to match them excatly with the BF2 engine but you can get pretty close in some areas we found

I also made this map here to help testing vehicles on ingame, mainly there performance on different materials, gradient testing, fording testing and time trials. The only really way to test a vehicles speed accurate in BF2 is to test its max speed between two set points and time it. IIRC the track I have set out is 100m long and there is simple online distance/time conversions for speed so you dont need to work it out yourself and its really a matter of trial and error from there. You can also do it a bit in the editor by timing by the grid distance thou I can't remember how far the grid goes out in the editor but it aint 100m, something like 120m or something from the centre, can find out if you need. Then you just need to drive from one point to the other with a stop watch in your hand.

Anyways here's the map if you want it: Test Track - Vehicle Testing Map - Official BF Editor Forums

Good luck with this, would be good if someone can do all this

[R-DEV]Rhino is online now Reply With Quote
Old 06-29-2010, 05:58 AM   #3
Default Re: [Help] Vehicle physics



Many thanks for explanation.

I think the tracked vehicles ingame are very good overall.
Also the engines of all vehicles are quite appropriate but im going to fiddle around with that too, just for practice.

Im focusing on suspension here, as a player of racing sims i like the realistic suspension behaviour and momentum of the car (dont get me wrong, im not trying to make PR into simulation). Funny thing is that suspension wise vanilla has quite good stuff. Thing lacking in PR is the suspension movement range. Thats because wheels dont get in touch with the ground on rough surfaces, but they should, especially looking at the trucks. Trucks dont feel heavy, just feels like they have bad brakes, wich work on flat surfaces but its weird on rougher.

PS. Do i have to make a copy of PR folder and mod there?
Arnoldio is offline Reply With Quote
Old 06-29-2010, 06:11 AM   #4
PR:BF2 Developer
Supporting Member

[R-DEV]Rhino's Avatar
Default Re: [Help] Vehicle physics

Ah cool.

Well then you will want to be playing around with the "Springs"

ObjectTemplate.activeSafe Spring gb_jep_landrover_whl_BL
ObjectTemplate.modifiedByUser "sofad"
ObjectTemplate.setNetworkableInfo BasicInfo
ObjectTemplate.floaterMod 0
ObjectTemplate.hasMobilePhysics 1
ObjectTemplate.hasCollisionPhysics 1
ObjectTemplate.physicsType Mesh
ObjectTemplate.grip 8
rem -------------------------------------
ObjectTemplate.addTemplate S_gb_jep_landrover_whl_BL_Rotation
ObjectTemplate.addTemplate web_wheelBig
rem -------------------------------------
ObjectTemplate.setStrength 60
ObjectTemplate.setDamping 5
Main bits highlighted in bold, might be other hidden settings too you might be able to find in the editor etc you would have to look about in the editor and other .tweak files for them but the main ones are Strength and Damping

Can't tell you what each one dose excatly off the top of my head you will just have to play about with them

And by all means try and make PR into a simulation as much as possible when it comes to vehicle performance, what we are pretty much trying as best as we can

And ye you will also want to clone your PR folder into a "pr_edit" or something to mod with otherwise you wont be able to play online etc.

Very out of date tut for setting up a pr_edit, mainly for mapping but also modding:

[R-DEV]Rhino is online now Reply With Quote
Old 06-29-2010, 06:58 AM   #5
Default Re: [Help] Vehicle physics

Ok, im all set up i think, ill post here if i have any questions.

Well, im trying to make real life-like physics wich is in the end, simulation. Like choppers, you dont have to have a joystick in order to fly them and not everybody can do it on the first try, but some people are doing it really good after days/months of practice. Thats the level of "simulation" im aiming for.

You'll just have to do a round or 3 around the block to get to know the vehicle and you should be good. I dont want to turn people away from using them just because they are hard to drive, quite opposite, i want people to get used to them and they will get a reward for that, again, same as choppers.
Arnoldio is offline Reply With Quote
Old 06-29-2010, 07:31 AM   #6
Default Re: [Help] Vehicle physics

Yeah well im back...

Phew, saved PR.

I had some problems. Seemed like pr.exe in pr_edit folder didnt connect to it properly, but if i modded in original pr folder it worked...

Will play around moar to find the solution.

Thanks to Outlawz, i am now working on it now.


Strength and Damping are quite straight forward as in real life. Strenght mean the stiffness of the suspension, wich is, how soft will the vehicle be, damping is well, damping, more of it, faster the vehicle will stop rocking and slower the suspension travel will be and vice versa.

I also found out that i will have to re-adjust the engine (and possibly gear) settings.

Im also guessing MaxSpeed only limits vehicles speed.
Arnoldio is offline
Last edited by Arnoldio; 06-29-2010 at 05:43 PM..
Reply With Quote
Old 06-29-2010, 06:55 PM   #7
Default Re: [Help] Vehicle physics

Updated first post with progress. I hope you will be able to see the Ural "done" tomorrow at this time.

After the trucks are done, im moving onto humvees for all factions.
Arnoldio is offline Reply With Quote
Old 06-30-2010, 09:15 AM   #8
Default Re: [Help] Vehicle physics

Nex question, do i need to mod humvee files in, or just, i dont know wich ones are used.
Arnoldio is offline Reply With Quote
Old 06-30-2010, 09:26 AM   #9
PR:BF2 Developer
Supporting Member

[R-DEV]Rhino's Avatar
Default Re: [Help] Vehicle physics

anything in is loaded before the old one, so if there are the same files in both, the ones loaded first (ie, in the are the loaded ones.

Also the have the most upto date files (other than the ones in the REPO of course, which you can't get ).

[R-DEV]Rhino is online now Reply With Quote
Old 06-30-2010, 09:46 AM   #10
PR:BF2 Contributor

[R-CON]sylent/shooter's Avatar
Default Re: [Help] Vehicle physics

I just want to say that the truck photo you have there, seems to me that the suspension is just a bit much. because the way it's sitting it doesn't look like the wheel will move xD You may want to rethink that a bit, or I could be completely wrong, but it's interesting what you're doing here. Hats off too ya

Killing the enemy sylently
[R-CON]sylent/shooter is offline Reply With Quote

physics, vehicle
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 08:08 AM.

Powered by: vBulletin. ©vBulletin Solutions, Inc.
All Content Copyright ©2004 - 2018, Project Reality