On this page
Stances and states: stand, crouch, prone, swim, climb, fall
A soldier has four stances (stand, crouch, prone, swim) and seven speed states derived from them. Around those are the states in which something else moves him: a ladder, a parachute, free fall, a seat. And one state in which nothing does: man down. This page is the map; the input handling tick by tick is on the page before this one.
Input and sprint, tick by tick: the soldier's input.
Stance and speed state#
The stance is what the player asks for; the speed state is what the movement code uses (updateSpeedState, bf2_w32ded.exe!0x0054de30):
| Stance | Speed state |
|---|---|
| stand | 4 sprint while sprinting; 2 walk while the weapon is zoomed; else 3 run |
| crouch | 1 |
| prone | 0 crawl |
| swim | 6 while sprinting, else 5 |
Each speed state has a speed in the soldier's template (getSoldierSpeed, 0x0054e830); crouched, it is also scaled by the mouse speed modifier of a zoomed weapon.
The ramp#
A stance change does not switch the speed. executePoseChange (0x005533c0) starts a ramp: from the speed the soldier had to the new state's speed, in a straight line, over a time from a table of 7 x 7 entries indexed by the old and the new speed state (0x00885970). The entries are 0.25 s among crouch, walk, run and sprint, and 0.5 s for everything into or out of prone and the water.
It is copied once, at start-up, from engine variables named pose-<from>-<to>: changing a variable later has no effect. And the two swim rows were registered under the sprint row's names by mistake, so they hold the sprint row's values in its column order: leaving the water to a run takes 0.25 s where the default written for it says 0.5. The port keeps the table as the original computes it; a played spot in the water measured the 0.25.
The stance keys#
updateSoldierPose(lie, crouch) (0x0054fbb0) does nothing while swimming or sky diving. Otherwise:
- Prone key, at its press: from prone the request is stand; from stand or crouch it is prone, when
soldierCanGoProne(0x0054e990) allows. - Crouch key: held, it requests crouch; released, a crouching soldier stands.
- A latch per key makes a held key count once.
The timers that make the stances feel the way they do (engine variables; defaults):
| Timer | Default | Effect |
|---|---|---|
prone-delay-after-jump | 1.0 s | no going prone behind a jump (no "dolphin dive") |
jump-delay-after-prone | 1.0 s | no jump right after standing up |
stand-delay-from-prone | 1.0 s | once prone, no standing up at once |
prone-delay-from-stand | 1.0 s | once up, no going prone again at once |
fire-delay-from-prone | 0.6 s | no shot right after leaving prone |
fire-delay-after-jump | 1.0 s | no shot right after a jump |
sprint-recharge-delay-after-jump | 1.0 s | stamina does not recover right after a jump |
Mods change these: the notes record that the Special Forces mod sets prone-delay-after-jump to 0.7.
2142 registers prone-delay-after-jump as 0.2 and the three camera speeds as 0.2, and lifts a standing soldier who goes prone by 0.3 m first (g_addedHeightOnProne, BF2142.exe!0x008e07d0). The port has all three as 2142's values with their addresses.
A prone soldier cannot stay prone in water deeper than soldier-prone-inwater-limit (1.1): he drowns, dt / 8 x 100 hit points a tick, 12.5 a second.
The camera's height#
Each stance has an eye position in the soldier's template (poseCameraPosition; the setter keeps only the height). On a stance change the camera moves from one to the other at a fraction a tick (camera-movement-speed-on-stand, -crouch, -prone: 0.5 each): fast, but not a cut. Shots start at the camera, so the stance decides where a bullet leaves (projectiles).
Swimming#
There is no key for it. While the soldier's physics node reports water, the stance is 3: the stance keys and the jump are refused, and the sprint key swims faster.
Ladders#
A ladder is an object with a thin collision plate. When the soldier's collision pass touches the plate, Ladder::handleCollision (0x0059e3c0) attaches him: from then on he is the occupant of a ladder container, like a seat. The container takes his input (up, down; the sprint key slides down) and moves him; his own physics does not run. He leaves at the top, at the bottom, behind, or by the use key, and gets the exit position and angles from the container.
Falling#
Falling faster than phy-soldier-skydiveat-speed (-10 m/s) the soldier is sky diving: the stance keys are off and the input steers the fall at up to phy-soldier-skydive-speed (15 m/s). The parachute is an object the soldier enters like a vehicle: a small tree with a wing that makes its lift (wings), steered by pitch. Hitting the ground fast costs fall damage through the soldier's collision response.
Man down and revive#
A soldier's health is an armor component like a vehicle's (damage and armor). The shipped soldiers have 100 hit points and a wreck health of 320 (as the notes read the templates):
| State | Hit points |
|---|---|
| alive | above 0 |
| man down, revivable | from 0 down to above -320 |
| dead | at -320 |
One hit on a living soldier leaves him at worst at 0.8 of the way down: a soldier always goes man down first, however large the hit. Damage while down is not limited. There is no bleeding out; the body waits. A revive adds hit points through the armor; enough of them and the soldier stands up with full health and his input off for 2.1 seconds. A new spawn cannot be hurt for 1 second.
How it is tested#
| What | Check |
|---|---|
handlePlayerInput, handleUpdate and their helpers | the original's functions in the emulator against the port, both precisions |
| a walk, a climb, a slide, a swim, a fall | the same recorded input on the original server and the port's: 380 of 380 ticks, 386 of 386, 420 of 420, 119 of 119 identical, the fall's damage equal (611.794) |
| the pose change table | read from the static initializer; the swim rows confirmed by a played spot |
| the parachute | recorded runs, compared tick by tick with the input phase aligned |
Open in the notes: the formulas of fall and collision damage, and who writes the sprint's dissipation factor.
In the code#
| What | Where |
|---|---|
| input, stance, speed state, the ramp, the timers | crates/bf2-physics/src/soldier_control.rs |
| ladders | crates/bf2-physics/src/soldier_ladder.rs, crates/bf2-server/src/soldier_phys_ladder.rs |
| the parachute | crates/bf2-server/src/soldier_phys_parachute.rs |
| sprint | crates/bf2-gameplay/src/soldier/sprint.rs |
| drowning | crates/bf2-gameplay/src/kills/drowning.rs |
Notes: notes/subsystems/gameplay-soldier.md, notes/subsystems/physics-soldier.md (sections 9 to 11).
docs/dev/soldier/stances.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.