jericho wrote: ↑
09 Sep 2020, 12:15
If anyone knows how vehicles physics works in gta1, please share that information.
I'll dig thru my memory of things i remember exist, so here's what i know:
They used a rather simple vehicle model, and as i mentioned they use 2 physics models (dummy driver cars & proper physics cars ).
If we take the original g24 file documents from dma, the description is following:
Code: Select all
weight is a weight descriptor for the car.
max_speed and min_speed are descriptors of the maximum and minimum possible speeds for the car.
acceleration, braking, grip, handling and turning are descriptors of these characteristics of the car.
damagable reflects how easily the car can sustain damage
cx, cy is the pixel co-ordinates of the centre of mass of the car, relative to the graphical centre.
moment is the moment of inertia of the car.
rbp_mass is the total mass of the car.
g1_thrust is the ratio for 1s gear ( only one gear now ).
handbrake_friction is the friction of the handbrake.
footbrake_friction is the friction of the footbrake.
front_brake_bias is the front bias of braking.
turn_ratio is the turn ratio of the car.
drive_wheel_offset, steering_wheel_offset, back_end_slide_value and handbrake_slide_value are more handling controls.
BTW, please check this out, this are some really old corrections to dma documents ( dated year 1998
), and provide some corrections ( like x,y order of coords for doors is wrong):
http://web.archive.org/web/200807050822 ... topic.html
Some more details on physics are here, this is refering to setting tabs in gtacars program (if you need that program let me know):
http://web.archive.org/web/199902031206 ... ss/phy.htm
A lot of this is for the "computer controlled" car
(eg: The cars that move around with other drivers in)
Weight - The weight of the car - doesn't seem to do anything.
Max. Speed - This sets the Top Speed at which the computer will drive the car
Min Speed - Same as above but for reverse.
Acceleration - How fast the computer controlled model accelerates
Braking - More computer controlled fields
Grip - How much grip the comptuer cars have.
Damagable - This is its hit points. Setting this to 255 will make one tough car! (This is not for bullet damage)
Value - This is how much it fetches, 10 = $12,000 (mint cond.)
CG_X - Centre of Gravity on X axis: Setting this positive will make the car bear to the left when turning.
CG_Y - No effect.
Moment - The potentioal energy the car has. Setting this too low (eg: 1) will make the car spin insanly.
Mass - The weight of the car, setting this low will make it go faster but the brakes will also be more responsive (makes car go a bit strange) Setting this higher will do the reverse of the above.
Thust - This is the most important one. This is how much thrust is applied to the car model. A high thrust to low weight will result in a very fast car.
Tire Adhesion_X - Setting this higher will make the car go faster. Don't set it too high
Tire Adhesion_Y - Setting this to about 2 will make it feel like you are driving on glue. Setting it to 5 can cause GTA to blue screen!
Handling - Seems to make no difference to the game.
Turning - No difference.
Turn Ratio - Setting this lower will make the steering less responsive and seting it higher will make it more responsive.
Drive Wheel Offset - Leave this as -25. Setting it to anything else will make the car spin insanly.
Steeringwheel offset - Leave this as 25. Like the drivewheel settings but only kicks in when you steer. Setting it to 0 will make steering very sluggish!
So it looks like they say a lot of settings are not even used / important, but from what i see the main settings are:
Handbrake Friction - The amount of friction the handbrake produces against the tyres, if set high it makes a really strong brake, if set low, it means you can do cool powerslides. (0.9 is normal)
Footbrake Friction - Same as above but for the footbrake (down arrow key)
Front Brake Bias - No effect
Back End Slide - No effect
Handbrake Slide - No effect
Turn Ratio (responsivness of steering) - i suggest you list and sort all cars by turn ratio, and figure out which cars have high and low value
Drive Wheel Offset, Steeringwheel offset - probably referes to location of wheel points on the sprite - you can verify this by figuring out where car produces skidmarks (create a fully transparent car, see where skidmarks are produced in a screenshot, and then correlate and create similar system to figure out where tyres should be)
CG_X, CG_Y set mass centre on the car sprite, this can be usually fed into a physics engine of choice possibly directly.
Moment - https://en.wikipedia.org/wiki/Potential_energy
- i assume this has some factor with mass in how hard the car is to get up to speed and how hard car will push when hitting things, the whole intention of this value seems a bit confusing.
Mass - this is probably again something that can be put in physics engine directly
Thust - this seems like acceleration factor engine produces
Tire Adhesion_X - This is tyre longtitudal adhesion factor (probably also used for rolling friction)
Tire Adhesion_Y - This is tyre lateral adhesion factor
I'd first suggest you put all the gta car values into some excel table, so you can see and sort the values to see what range things have and how they corelate to big, small vehicles and shitty vs sports vehicles.
Additionally i would suggest that you build your own physics model for cars instead of trying to produce same gta behavior code - then just use GTA values for "reference" on how your car model should drive, some values might need scaling (like mass, coordinate system for tyre coordinates.. ).
Usually cars in games are still implemented as raycast cars (basically 4 points on car) where they simulate spring ground contacts and control lateral / longtitudal friction.
This actually is a rather good vehicle model, i use a this in top down city (minus the ground spring thing which is not needed in a gta-ish game), each physics engine has its own way how you do this, but approach is same, this produces most car behaviors easily including handbrake turns, j-turns, etc..
I'm willing to share code i use in my game, i use newton physics engine in my game, maybe that can get you started, what physics engine do you use?