NFSU.cc / RE Atlas / Driving & Physics

Car physics and handling (Speed.exe PC)

Driving & Physics 53 verified Speed.exe addresses Speed.exe (2003, x86)

Marks: V = read in code or bytes this session, I = inferred, U = open. Tools: G = Ghidra (gpar.sh on /root/ghidra_named, decomp and xref), N = named decompile /root/re/named_export, C = capstone tools/recomp/asm.py, D = data read from the exe or GLOBALB.BUN (carinfo.py layout). Rows for every function are in census/names_physics.tsv.

Answers

(a) Rear assist 0x4773f0. Yes, it raises rear grip with slip angle, and speed too. V (N, C, D)

Every one of the 35 cars has phys+0x280 = 0.0 and phys+0x284 = 2.5 (D, GOLF included). 0x735fa4 and 0x735fa8 have no writer, so they are 0.

ramp = [this+0x7c], 0.5..1.0 (falls 20/s while the handbrake input is >= 0.5, rises 1/s).

speed5 deg15 deg30 deg
15 m/s (34 mph)0.1090.3270.35 (cap, raw 0.65)
30 m/s (67 mph)0.2180.35 (raw 0.65)0.35
45 m/s (101 mph)0.3270.350.35

The cap binds when |slip| > 0.864/v rad: 8.3 deg at 15 m/s, 4.1 deg at 30 m/s, 2.7 deg at 45 m/s.

cumulative in the wheel loop (stack slot [esp+0x20]), so RL gets the factor once and RR gets it twice (about 1.82 at the cap). (3) The slip fed in is 0 when forward speed < 1 m/s. Only rear wheels (offset >= 0x40) and only outside drift events (flags below).

(b) Yaw assist 0x479350. Yes, it damps only yaw that widens the slide. V (C, N)

yaw_rate = CarState+0x98 = body+0xc8 (angular velocity z). Positive yaw raises heading, so same signs means |slip| grows. The sign of body+0xc8 as counter-clockwise is I (right-handed, z up); the formula is built on it.

g (table 0x779b70, built at 0x68a130): 0 at 0, 0.7 at 45, 0.9 at 75, 1.0 at 89 deg, then 0 at 90 deg and beyond (flat end). At 5/15/30 deg g = 0.078 / 0.233 / 0.467.

Column = difficulty [0x78a3fc] 0..2. Row 0 -14/-11/-7, row 1 -9/-7.5/-5, row 2 -10/-9/-8.

or drag. Player and AI both (global flags, no driver test). 0x479510 is the twin for [0x78a346]/[0x7361a0] with fixed -25.

(c) Cap 0.35 -> 0.18 and yaw row x0.6. The two knobs live in different modes, so they never act together. V for the code, I for the driving result.

longer gains grip as the slide grows, so the tail lets go earlier and does not come back. Risk is oversteer snap at high speed in long fast corners and on lift-off or nitro exit, worst for cars with big drive-torque (RWD). Straight line and slip < 2 deg are unchanged. The RL/RR imbalance shrinks, which is a side effect.

RWD hard (-8) x0.6 = -4.8. Limits: body+0x1e0 (17.0 when CarState+0x3c0 == 0) clamps yaw torque in 0x585410, so at high yaw rate the damper is already saturated and x0.6 only matters at low and middle rates.

(0x476cf6, 0x473fc0), and 0x479640 reads columns 19..23 (0x6f100c). Scale only floats 0..2 of each row (0x6f0fc0 + row*0x6c).

(d) car+0x404 through 0x479160. It works: scale of engine, drag and grip (checked by the lane owner: the first version of this note read 0x6ffe54 as 0). V (C, D)

written to car+0x404 is used. Writers of car+0x404: RacerAI::UpdateRubberBand 0x44bff5 (AI) and Racer::UpdateTwoHumanCatchUp 0x429b8b (player, only with 2 players).

body+0x1e8 (drag scale in 0x585410), wheel+0x17c on all 4 wheels (multiplies both the sliding and the static limit in 0x587330/0x587830). A second call at the end of 0x4774a0 uses car+0x484 (override when != 0 and car+0x86c == 0).

How the pieces fit (all V unless marked)

Per frame 0x4774a0: inputs -> wheel scales -> substeps (0x46aa40 Euler, dt/n) -> 0x4783c0 post step (drift yaw damping) -> CarState refresh 0x4789d0.

Objects (this of 0x4774a0, built by ctor 0x476840): +0x20 body (RigidBody), +0x28..+0x34 four Suspension (class name "Suspnsn"), +0x38..+0x44 four Wheel (FL, FR, RL, RR; class name "Wheel"), +0x48 Engine, +0x4c DriveTrain (gear at +0x54), +0x54 CarPhysicsInfo, +0x58 CarState (= car+0x40), +0x5c Car, +0x78 base grip scale, +0x7c handbrake ramp. Controls (this+4): +0x1d0 steer short, +0x1dc throttle, +0x1e0 handbrake, +0x1e4 brake (0x461650 writes them).

FieldMeaningProof
wheel +0x108wheel torque; brake and handbrake torques subtract against spin0x587330
wheel +0x10clocked by brake (spin set to 0)0x587220
wheel +0x155contact flag0x586f10
wheel +0x158load = suspension force * alignment factor (min 0.3)0x586f10
wheel +0x160longitudinal slip speed = radius*spin - ground speed0x587330
wheel +0x16cper-wheel flag from bit i of car+0x86c; when set the suspension builds an extra rotation (0x588580). Meaning I (special wheel state)0x4774a0, 0x588580
wheel +0x170 / +0x174brake / handbrake input (rear only for handbrake); 0x4774a0 adds +0.5 to handbrake when 3c0 != 0 and slip > 0.3 rad under 80 mph...0x4774a0, 0x587330
wheel +0x178per-frame grip scale (assist, 0.85, nitro/launch factors)0x4774a0, 0x479640
wheel +0x17cglobal power/grip scale from 0x4791600x479160
wheel +0x180drift-mode rear slide scale, default 1.00x479350, ctor 0x5868e0
wheel +0x168grip useF/limit, 0..10x587830
this+0x78base grip scale, ctor 1.0, x0.85 outside drift/drag when 3c0 == 0. Other writers U0x4774a0
this+0x7cassist ramp 0.5..1.00x4774a0
body +0x1e0cap on yaw torque, 17.0 (phys+0x288) when 3c0 == 00x585410, 0x4774a0
body +0x1e4 / +0x1e8drag coefficient (phys+0x290) / drag scale from 0x4791600x585410
CarState +0x374heading angle16; +0x30 velocity; +0x390 forward speed; +0x394 speed; +0x98 yaw rate0x4789d0
CarState +0x3c0mode int, default 0 (ctor 0x464860). Set to 1 by 0x4bef54 when the player toggles per-player option [0x78a386+p*0x38]. Reads: x0.85 base grip, assist k, handbrake limit factor, engine braking x0.4. What the option is: Uxrefs
CarState +0x3c8..+0x3d4launch wheelspin pulse state0x479640
phys +0x27cfront brake share (0.5..0.6); rear = 1 - it; brake torque factor = 2sharebrake0x4774a0
phys +0x1c0rear drive split 0 FWD, 0.5 AWD, 1.0 RWDD (all 35 cars) and rows of 0x6f0fc0
phys +0x288/+0x28c/+0x290yaw cap 17.0 / alt cap 0.0 / drag 0.0 (stock)0x4774a0, D

Mode flags (V): [0x78a344] drag event, [0x78a345] drift event, [0x78a346] third (U), [0x7361a8/a4/a0] the same three from the other setter, [0x735fa0] drift mode (read by RideInfo::RebuildPhysicsInfo and IsDriftModeActive). Career sets them from event type [ctx+0x58a8]: 1 drag, 3 drift (0x4b5f32..0x4b5fcc).

Weight transfer, aero, drivetrain:

(0x586f10); the body integrates the sum, so load moves with pitch and roll.

DriveTrain 0x46d9f0/0x46e020 (see names_car.tsv); not re-read here.

Inside the static limit the lateral force is a curve of slip angle; past it the force is the sliding limit along the slip vector.

Not done / open