Skip to content

169 deterministic sim 14 the drones

Alex Diakovsky edited this page Nov 21, 2026 · 3 revisions

169. Deterministic sim 14: the Drones in 16.16 (stage S5.5d)

Update (document 177): the port's fallbacks for missing pack keys are spelled as the raw values (Pack.fx_of(fl, "turn_ahead", 0x6666) ...), the same integers Pack.fx made of the old float defaults.

Question: how does the Drone (class 9, "Drone") fly, aim and spawn on the original's integers? And what changes when the port steps it the same way (document 155, issue #133)?

The deterministic simulation series: document 155 is the plan. Documents 156 to 160 are stages S0 to S4. Documents 161 to 165 are S5.1 to S5.4. Document 166 is S5.5a, document 167 S5.5b (the gun turrets) and document 168 S5.5c (the foot soldiers). This is S5.5d, the last object of S5.5.

The Drone was first traced in document 115 and document 130, and built from them (issue #76). This document re-reads its behaviours, its spawner and its record pool for their exact integer form. It found eight things the port did differently, four of them wrong numbers in the pack. Documents 115 and 130 are updated.

Glossary

Term Meaning
16.16, raw As in document 161: 0x10000 is one unit. A raw unit is 1/65536.
angle 22 bits: 0x400000 is a full turn, 0 is north, clockwise. A step is 0x10000 (5.625 degrees). Pitch is positive nose down.
row One of the 64 heading rows at 0x481390 / 0x481394 (the unit vector of a whole step), picked by angle >> 16. In the port, Vehicle.dir_fx.
T[n] The Drone's constants block at 0x443118 (fifteen dwords). The object keeps a pointer to it in obj+0x70, and every behaviour gets it as its second argument.
record The Drone's 32-byte record (obj+0x6c), taken from its side's free list. It holds the gun's pitch and the shot timer, and it outlives the Drone.
the clock DAT_00480d38, ticks since the level began. The port's MatchController._drone_clock.
turn FUN_004319e0(&angle, want, step): turn the short way by at most step, landing on want. Returns whether it landed. The port's Projectile.turn_toward_fx.
move toward FUN_0042cdd0(cur, want, step): the same for a plain number. The port's Drone.move_toward_fx.
the move test FUN_0042c830(obj, delta): moves the object by delta and tests it against the cells round it; the callbacks decide what blocks. Returns 1 if the move was blocked (and undone).
view A float property that reads an integer one (position of pos_fx), kept for drawing, the computer players and the tests.

The answer, up front

  1. The Drone is integers now: pos_fx, z_fx, heading_fx, speed_fx, vel_fx, roll_fx, pitch_fx and the match clock now. position, heading, roll and the rest stay as views.
  2. Four pack numbers were rounded wrongly. T[0] is 0x3d7 (0.015), where the pack had 0.0149 (0x3d0). T[9] (the acceleration), T[10] (the gun's turn rate) and the climb rate are 0x4ccc, where the pack's 0.3 makes 0x4ccd. The aim window is 0xe38e each way, where 0.8889 makes 0xe38f. With 0x4ccc the Drone reaches full speed (0x18000) on its sixth tick, not its fifth. tools/data/drone.json now has the exact values: re-import the pack.
  3. The record outlives the Drone. Each side has a free list of cap records (at most 5). A Drone takes the head and gives it back when it ends. Only the link and the bumper are cleared on the way out, and killed on the way back. So the next Drone of that side starts with the last one's gun pitch, gun and shot timer. Its timestamps are the level's clock, not ticks since the Drone was made.
  4. A refused spawn point tries the next lane. The spawner rolls rand(4) for the lane, then tries up to four lanes in turn while another player's rectangle refuses the point. The port gave up after the first.
  5. The aim is exact. The bearing to the vehicle is the 22-bit arctangent and the distance is in whole units, FUN_0042cd70(self, target). The elevation is atan2(dz, distance) >> 2. The shot leaves at those exact angles; only the muzzle's offset is turned by whole-step rows.
  6. The bank is scaled by an integer speed. FUN_0040a480 takes the whole square root of the velocity in 1/256 units, shifted back up, and the roll and pitch targets are mul(that, T >> 16 * row). The pitch gain −3.5 is used as −4.
  7. Shells meet a Drone in the shot test. A Drone now stands in the cells of shell_hits_fx with its two shapes. A shell's mask (0x43) meets only the body. A hit below 1.0 is answered 0 and the shell flies on. A Drone's shot can now hit another Drone.
  8. The bump test walks the two chains. The Drone's body (16 units) and its space box (64 units) meet another object's shapes through Collision.chains_hit_fx. The first pair that meets decides: two bodies block, a space box only bumps.

Step 1: the record pool, FUN_00409ea0 and FUN_00409fa0

void FUN_00409ea0(int cap) {                    // at the level's start
  if (5 < cap) cap = 5;
  rec = &DAT_00457fb0;
  for (side = 0; side < 2; side++) {
    DAT_00457f60[side] = 0;                       // the side's free list
    for (n = cap; n > 0; n--) {
      rec->next = DAT_00457f60[side];  rec->side = side;  DAT_00457f60[side] = rec;   // push: the last made is the head
      rec += 32;
    }
  }
}

int FUN_00409fa0(int cls, obj, rec) {           // the Drone's init
  if (rec == 0) { /* pop the head of the side's list */ }
  rec[1] = obj;
  obj->speed = 0;  obj->roll = 0;  obj->pitch = 0;  obj->vel = (0, 0);
  obj->record = rec;  obj->+0x70 = &T;  obj->+0x64 = 0;
  return 1;
}

Translation: each side has cap records on a free list. The spawner pops the head and clears only +0 (the link) and +0x18 (the bumper). The init zeroes the object's speed, roll, pitch and velocity, not the record. The end handler FUN_0040a010 pushes the record back on the head and clears +0xe (killed). So +0x14 (next shot), +0xd (which gun), +0x1c (the gun's pitch) and +8 (last drawn) carry over to the next Drone of that side.

# game/match_controller.gd
func _drone_pool(side: int) -> Array:
	if _drone_pools.is_empty():
		var cap := _drone_cap()
		for s in 2:
			var list := []
			for _i in maxi(cap, 0):
				var r := Drone.Record.new()
				r.side = s
				list.append(r)
			_drone_pools.append(list)
	return _drone_pools[side]

The head is the back of the array: pop_back takes it and append gives it back. The pools are built on the first spawn with the cap of that moment; the original builds them at the level's start (the cap is fixed by then in both).

Step 2: the spawn, FUN_0040a7b0 and FUN_0040aa90

lane = FUN_0041d3d0(4);
if (camper->class == 1) { ex = rec[0x27c] * 0x100000;  ey = rec[0x280] * 0x100000; }   // 16 units a point
else                    { ex = ey = 0x2000000; }
rect = (-ex, -ey, ex, ey);
for (try = 0; try < 4; try++) {
  if (FUN_0040aa90(lane, &at, camper, &rect)) {
    side = camper->team ^ 1;
    rec = DAT_00457f60[side];
    if (rec == 0) return 0;                       // no free record: no Drone
    /* pop it, clear +0 and +0x18 */
    obj = FUN_0042c290(0x443838, side, at.x, at.y, 0x320000, rec);   // 50 units up
    ...                                           // the hum, the target link, the radar blip
    return obj;
  }
  lane = lane + 1;  if (3 < lane) lane = 0;
}
return 0;

int FUN_0040aa90(lane, &at, camper, rect) {
  at = camper->pos;
  w = rect.right - rect.left + 1;  h = rect.bottom - rect.top + 1;
  lane 0: at.x += rand(w >> 16) * 0x10000 - (w >> 1);  at.y += rect.top;
  lane 1: at.x += rect.right;   at.y += rand(h >> 16) * 0x10000 - (h >> 1);
  lane 2: at.x += rand(w >> 16) * 0x10000 - (w >> 1);  at.y += rect.bottom;
  lane 3: at.x += rect.left;    at.y += rand(h >> 16) * 0x10000 - (h >> 1);
  for (p = 0; p < 2; p++) {
    v = FUN_0040b3c0(p);                          // player p's vehicle
    if (v != camper && v != 0 && FUN_0041d5b0(&at, &v->pos, v's rectangle)) return 0;
  }
  return 1;
}

Translation: the first lane is random. Each try rolls the point on that lane's border (the roll comes before the refusal test, so a refused try still uses a die). A point inside another player's own rectangle is refused, and the next lane is tried, four in all. The free record is taken only after a point is accepted.

# game/match_controller.gd
	var lane := rng.below(int(sp.get("lanes", 4)))
	var at := Vector2i.ZERO
	var found := false
	for _try in int(sp.get("tries", 4)):
		at = _drone_point(lane, v, rect)
		...
		if not _drone_point_refused(at, v):
			found = true
			break
		lane = (lane + 1) & 3
	if not found:
		return null   # every lane refused: no Drone this time
	var side := v.player_index() ^ 1
	var pool := _drone_pool(side)
	if pool.is_empty():
		return null   # the side's records are all in use
	var r: Drone.Record = pool.pop_back()
	r.bumper = null   # the only fields taken afresh (+0 and +0x18)
	var d := Drone.new(cfg, side, at, v, r)

_drone_point is FUN_0040aa90's arithmetic, raw: (rng.below(w >> 16) << 16) - (w >> 1) + p.x. _drone_point_refused is Collision.point_in_box_fx (FUN_0041d5b0, edges included) against each other player's rectangle. As before, a computer player's rectangle refuses nothing (document 140, issue #77).

The camp test that calls the spawner is unchanged except that it runs on the integer clock, and the tile is pos_fx >> 21.

Step 3: the tick, FUN_0040a150

void FUN_0040a150(int cls, int *obj) {
  r = 0;
  do {
    if (obj->behaviour == 0) { FUN_0042c0f0(obj); return; }        // removed
    r = obj->behaviour(obj, obj->+0x70 /* T */, obj->+0x6c /* record */, r);
  } while (r != 0);
  ...                                             // the nearest Drone's position for the hum and the view
}

Translation: ATTACK answers 1 only when its target is gone (after switching to DRIFT), so DRIFT runs in the same tick. DRIFT answers 1 after clearing the behaviour, so the Drone is removed in that tick too.

# game/drone.gd
func step(clock: int) -> void:
	if finished:
		return
	now = clock
	if drawn.is_valid() and bool(drawn.call(self)):
		rec.last_drawn = now
	if state == State.ATTACK:
		if _attack():
			return
	if state == State.DRIFT:
		_fly()
		if rec.last_drawn + _t["undrawn"] < now:
			finished = true   # FUN_0040a6a0 clears the behaviour, FUN_0040a150 removes the object

Step 4: ATTACK, FUN_0040a280

if (target == 0) { obj->behaviour = FUN_0040a6a0; return 1; }
FUN_0040a480(obj, T, rec);                                  // fly first
a = FUN_00422e70(&obj->pos, &target->pos);                  // the exact bearing
off = a - obj->heading & 0x3fffff;
d = FUN_0042cd70(&obj->pos, &target->pos);                  // whole units
if (off < 0x100001 || 0x2fffff < off) rate = T[1];          // ahead
else if (T[4] < d)                    rate = T[3];          // behind, far
else                                  rate = T[2];          // behind, close
FUN_004319e0(&obj->heading, a, rate);
elev = FUN_00410b80(d, obj->z - target->z) >> 2;
rel = elev - obj->pitch & 0x3fffff;
if (rel < 0x200001) { can = 1;  if (T[11] < rel) { can = 0;  rel = T[11]; } }
else if ((int)rel < (int)(0x40 - T[11])) { can = 0;  rel = 0x40 - T[11]; }   // never: 0x40 - 0x50000 < 0
else can = 1;
arrived = FUN_004319e0(&rec->gun_pitch, rel, T[10]);
if (arrived && can && rec->next_shot < clock && T[13] < d && d < T[14]
    && (obj->heading - a + 0xe38e & 0x3fffff) < 0x1c71c) {
  m = &DAT_00443160[rec->gun];                              // (-8, -8, 0) or (8, -8, 0)
  if (0x20000 < target->z) {                                // above 2 units: a Heli
    FUN_00415480(&obj->pos, m, a, elev, 3, obj->team, obj); // the tracer
    if (DAT_0048c310 != 0) { rec->next_shot = clock + T[12];  return 0; }
  }
  if (FUN_00415480(&obj->pos, m, a, elev, 0xb, obj->team, obj)) {
    rec->gun ^= 1;  rec->next_shot = clock + T[12];
  }
}
return 0;

Translation: the Drone flies, then turns toward the vehicle: slowly when it is within a quarter turn ahead, hard when it is behind and over 75 units away, gently when behind and close. The gun's wanted pitch is the elevation to the vehicle against the body's pitch, cut to 5 steps (and then it may not fire). It fires when the gun has arrived, the timer has passed, the vehicle is between 32 and 80 units away, and the heading is within 0xe38e of the bearing. At a Heli it first sends the tracer; cover of its own side in the way costs the shot and restarts the timer.

# game/drone.gd
	var tp: Vector2i = target.pos_fx
	var a := Projectile.bearing_fx(pos_fx, tp)   # FUN_00422e70: exact, not a whole step
	var off := (a - heading_fx) & ANGLE_MASK
	var dist := Projectile.distance_fx(pos_fx, tp)   # FUN_0042cd70(self, target): whole units
	var rate: int
	if off <= 0x100000 or off >= 0x300000:
		rate = _t["turn_ahead"]
	elif _t["far_distance"] < dist:
		rate = _t["turn_behind_far"]
	else:
		rate = _t["turn_behind_close"]
	heading_fx = Projectile.turn_toward_fx(heading_fx, a, rate)
	var elev := Fx.atan2(Fx.wrap32(z_fx - int(target.call("z_fx"))), dist) >> 2
	var rel := (elev - pitch_fx) & ANGLE_MASK
	var can_fire := true
	if rel <= 0x200000:
		if _t["pitch_limit"] < rel:
			can_fire = false
			rel = _t["pitch_limit"]
	rec.gun_pitch_fx = Projectile.turn_toward_fx(rec.gun_pitch_fx, rel, _t["gun_pitch_rate"])
	var arrived: bool = rec.gun_pitch_fx == rel
	if arrived and can_fire and rec.next_shot < now and _t["min_distance"] < dist and dist < _t["max_distance"] \
			and ((heading_fx - a + _t["aim_half"]) & ANGLE_MASK) < 2 * int(_t["aim_half"]):
		_shoot(a, elev)

The distance's argument order matters: FUN_0042cd70 cuts each difference b - a to whole units with an arithmetic shift, so (self, target) and (target, self) can differ by a unit. The disassembly at 0x40a2e1 pushes the target, then the Drone, so the Drone is the first argument.

The shot (_drone_fire) is FUN_00415480 as the turret's (document 167): the muzzle (x, y, 0) is turned by the pitch row and the heading row of the shot's angles (whole steps), and added to the Drone's position and height; the projectile gets the exact heading a and pitch elev. The tracer is _probe_line_fx from the same muzzle, with the Drone as the shooter.

Step 5: the flight, FUN_0040a480

h = obj->heading;
s = T[0] * dt;
obj->vel.x = FUN_0042cdd0(obj->vel.x, mul(obj->speed, row(h).x), s);
obj->vel.y = FUN_0042cdd0(obj->vel.y, mul(obj->speed, row(h).y), s);
delta = (obj->vel.x * dt, obj->vel.y * dt, 0);
if (obj->z != 0x320000) delta.z = clamp(0x320000 - obj->z, -0x4ccc * dt, 0x4ccc * dt);
if (FUN_0042c830(obj, &delta) == 1 && delta.z != 0) { delta.z = 0;  FUN_0042c830(obj, &delta); }
if (obj->speed < 0x18000) obj->speed += T[9] * dt;
if (0x18000 < obj->speed) obj->speed = 0x18000;
i = (obj->heading - FUN_00422e70(&DAT_00482010 /* (0,0) */, &obj->vel) & 0x3fffff) >> 16;
mag = FUN_00410df0((vx >> 8) * (vx >> 8) + (vy >> 8) * (vy >> 8)) << 8;      // the whole root, unsigned
FUN_004319e0(&obj->roll,  mul(mag, (T[5] >> 16) * row(i).x), T[6]);
FUN_004319e0(&obj->pitch, mul(mag, (T[7] >> 16) * row(i).y), T[8]);
if (rec->bumper != 0) {
  b = rec->bumper;  rec->bumper = 0;
  push = 0x20000 - (FUN_0042cd70(&obj->pos, &b->pos) >> 4);
  if (0 < push) {
    k = FUN_00422e70(&b->pos, &obj->pos) >> 16;                              // away from it
    obj->vel.x += mul(row(k).x, push);  obj->vel.y += mul(row(k).y, push);
  }
}

Translation: the velocity creeps 0x3d7 a tick toward the speed along the heading's row, so the Drone swings wide. It climbs back to 50 units at most 0x4ccc a tick (a blocked climb is retried level). The speed grows by 0x4ccc to 1.5. The angle between where it points and where it goes picks a row; the roll and the pitch turn toward that row times the speed's magnitude times −6 and −4. A touch last tick pushes it away from what it touched, 2.0 less a sixteenth of the distance.

# game/drone.gd
func _fly() -> void:
	var dir := Vehicle.dir_fx(heading_fx)
	var vs: int = _t["velocity_step"]
	vel_fx = Vector2i(move_toward_fx(vel_fx.x, Fx.mul(speed_fx, dir.x), vs), move_toward_fx(vel_fx.y, Fx.mul(speed_fx, dir.y), vs))
	var hold: int = _t["hold_z"]
	var climb := 0
	if z_fx != hold:
		climb = clampi(Fx.wrap32(hold - z_fx), -int(_t["climb_rate"]), _t["climb_rate"])
	if _move(vel_fx, climb) and climb != 0:
		_move(vel_fx, 0)   # blocked while climbing: once more level
	if speed_fx < _t["speed_cap"]:
		speed_fx += _t["accel"]
	if speed_fx > _t["speed_cap"]:
		speed_fx = _t["speed_cap"]
	var idx := (heading_fx - Projectile.bearing_fx(Vector2i.ZERO, vel_fx)) & ANGLE_MASK   # its step picks the row
	var row := Vehicle.dir_fx(idx)
	var vx := vel_fx.x >> 8
	var vy := vel_fx.y >> 8
	var mag := Fx.wrap32(Fx.isqrt(Fx.wrap32(vx * vx + vy * vy)) << 8)
	roll_fx = Projectile.turn_toward_fx(roll_fx, Fx.mul(mag, Fx.wrap32(int(_t["roll_gain"]) * row.x)), _t["roll_rate"])
	pitch_fx = Projectile.turn_toward_fx(pitch_fx, Fx.mul(mag, Fx.wrap32(int(_t["pitch_gain"]) * row.y)), _t["pitch_rate"])
	var b := rec.bumper
	if b != null:
		rec.bumper = null
		if is_instance_valid(b):
			var bp: Vector2i = b.get("pos_fx")
			var push: int = int(_t["push_strength"]) - Projectile.distance_fx(pos_fx, bp) / int(_t["push_divisor"])
			if push > 0:
				var away := Vehicle.dir_fx(Projectile.bearing_fx(bp, pos_fx))
				vel_fx = Vector2i(Fx.wrap32(vel_fx.x + Fx.mul(away.x, push)), Fx.wrap32(vel_fx.y + Fx.mul(away.y, push)))

The turn stores want itself when it lands, not want & 0x3fffff, so a roll toward a negative target holds a negative number. The views mask it; the scene's tilt (signed_steps) is unchanged. The climb and the speed cap are numbers in the code, not in T; the pack's climb_rate, speed_cap and spawn.z carry them, with the exact values.

Step 6: touches, FUN_0040a760, and the move test

int FUN_0040a760(int a, int b) {
  if (a->class == 9) a->record->bumper = b;
  if (b->class == 9) b->record->bumper = a;
  if (DAT_0047c914 != &DAT_004436c0 && DAT_0047c918 != &DAT_004436c0) return 5;   // two bodies: blocked
  return 0;                                                                           // a space box: no block
}

Translation: the move test walks the Drone's chain (the body 0x443700, layer 1, mask 0xff, ±8 units; then the space box 0x4436c0, layer 0x20, mask 0x22, ±32 units; both z −4 to 6) against each object's chain in the scanned cells, and FUN_0041e4c0 stops at the first pair that meets. DAT_0047c914 and DAT_0047c918 are that pair. The handler makes each Drone remember the other. Two bodies block; a pair with a space box only bumps. Against a vehicle the Drone's handler answers (priority 110 against 100), so a vehicle at the Drone's height blocks and pushes it.

# game/match_controller.gd
func _drone_collide(d: Drone, at: Vector2i, z: int) -> bool:
	var chain := _drone_chain()
	var space: Dictionary = chain[1]
	var blocked := [false]
	_scan_cells(at, DRONE_SCAN_REACH, func(t: Vector2i) -> bool:
		for v in _vehicles_in_cell(t):
			if v.docked:
				continue
			var vh := Collision.chains_hit_fx(at, z, d.heading_fx, chain, v.pos_fx, v.z_fx(), v.heading_fx, v.hit_chain_fx)
			if not vh.is_empty():
				d.rec.bumper = v
				if vh["a"] != space:
					blocked[0] = true
					return true
		for o in drones:
			...
			var oh := Collision.chains_hit_fx(at, z, d.heading_fx, chain, o.pos_fx, o.z_fx, o.heading_fx, chain)
			if not oh.is_empty():
				d.rec.bumper = o
				(o as Drone).rec.bumper = d
				if oh["a"] != space and oh["b"] != space:
					blocked[0] = true
					return true
		return false)
	return blocked[0]

The scan reach is the draw descriptor's +0xc, 32 units. No tile is tested: the tallest tile shape in the game ends at 31 units, and the Drone's body starts at 46.

Step 7: hits and the end, FUN_0040a6e0 and FUN_0040a010

int FUN_0040a6e0(int obj, int hitter, int damage) {
  if (damage < 0x10000) return 0;                  // the shell flies on
  if (hitter->class == 0) { /* a kick of half the speed along the heading */ }
  obj->record->killed = 1;  obj->record->+0x10 = hitter->heading;
  FUN_0042c4d0(obj);                               // removed
  return 2;
}

int FUN_0040a010(int cls, int obj) {               // the end handler
  rec = obj->record;
  if (rec != 0 && rec->killed) {
    FUN_0042e080(obj->team, obj->x, obj->y, obj->z, &PTR_DAT_00444c80, 0);   // the explosion, at its height
    FUN_0042b4e0(&obj->pos, obj->team, 0x44aa90, obj->draw, obj->heading, obj->pitch, &LAB_0040a120);   // flying pieces
  }
  /* push rec on its side's list: rec->next = head; rec[1] = 0; rec->killed = 0; head = rec */
  return 1;
}

Translation: a shell meets only the body (its mask 0x43 has no 0x20). The handler ignores a hit below 1.0, and the shell goes on. A harder hit marks the record, and the end handler makes the explosion and the pieces, then gives the record back. The kick for a class-0 hitter is lost with the Drone.

# game/match_controller.gd: shell_hits_fx, after the soldiers
		for d in drones:
			if d == shooter or d.finished or (d.pos_fx.x >> 21) != t.x or (d.pos_fx.y >> 21) != t.y:
				continue
			if not Collision.chains_hit_fx(cur, cur_z, 0, chain, d.pos_fx, d.z_fx, d.heading_fx, _drone_chain()).is_empty():
				hits.append({"drone": d})

func _shell_moved(p: Projectile) -> bool:
	var hits := shell_hits_fx(p.prev_fx, p.prev_z_fx, p.pos_fx, p.z_fx, p.shooter)
	p.prev_checked = p.position   # also takes the height
	if not pack.drone.is_empty():
		var least := Pack.fx(pack.drone["hit"]["min_damage"])
		hits = hits.filter(func(h): return not h.has("drone") or p.damage_fx >= least)
	if hits.is_empty():
		return false
	_apply_shell_hits(p, hits, p.position)
	return true

_apply_shell_hits calls Drone.hit and then _end_drone, which is FUN_0040a010. The old float test _shell_hits_drone is gone, and so are the float tracer walk _probe_line and _tile_on_segment that only the Drone still used. The computer players' prediction shell_drone_hit stays on their float views.

The golden check

Five scenes on RFMAP002 with the match seed fixed and two Drones a side, logging every Drone's state, position, height, heading, speed, velocity, roll, pitch, gun pitch and gun every tick, and every Drone shot:

  • a Tank standing (a Drone made at once, a second from the camp timer);
  • a Jeep driving with two Drones made on two ticks;
  • a Heli held at 20 units;
  • a Tank camping with no Drone made by hand;
  • a Tank killed after 250 ticks (the Drone drifts).

Before and after:

  1. Spawns: the same ticks, lanes and points in every scene. Two points differ by 1 and 4 raw units: the old code added float offsets to the vehicle's float position (Vector2 is 32-bit).
  2. The first tick: speed and gun pitch are 0x4ccc, not 0x4ccd (finding 2).
  3. The second tick on: the velocity steps 0x3d7 (983), not 976 (finding 2). The pitch is 4096, not 3906: the integer magnitude of finding 6 (the velocity (0, −983) is (0, −4) in 1/256 units, root 4, times 256 is 1024; times 4 is 4096).
  4. The roll: the new value holds a negative number where the old one held it wrapped (−55136 against 4139320); the same angle within the rounding of finding 6.
  5. Shots: each scene's first shot comes one tick sooner, from about the same place (the faster velocity of finding 2), at the exact bearing and elevation. Shot counts, before and after: 7 and 7, 11 and 12, 7 and 7, 16 and 16, 0 and 0.
  6. The Jeep scene: with the shots' timing changed, the Jeep dies at tick 765 instead of 895, somewhere else. Its Drones drift and leave the 288-unit "drawn" square sooner, so they are removed at 1087 and 1141 (the old ones at 1181 and 1204).

Every difference above comes from one of the eight findings.

Tests

  • New engine check drone_fx_check:
    • T[0..14] in 16.16 from the pack, the gains as T >> 16, the 0x4ccc values, the aim window 0xe38e;
    • the turn-rate thresholds exactly at off 0x100000, 0x100001, 0x2fffff and 0x300000, and behind and close;
    • the shot leaves at the exact bearing and atan2 >> 2 elevation;
    • one tick of the flight: the velocity moves 0x3d7 a component, the roll turns toward mul(mag, -6 * row.x);
    • the push: 16 units off, 2.0 − 1.0; 40 units off, none;
    • DRIFT: last drawn at 100, still there at 160, gone at 161;
    • the pools: the head is taken, given back at the head, and the next Drone takes it with its gun pitch, gun and shot timer; a full side makes none;
    • the lane's point is on its border, the free coordinate a whole unit.
  • drone_check runs on the 16.16 fields, the match clock and the shot step (_shell_moved). Full speed now takes six ticks.
  • two_player_rules_check: the refusal in 16.16, and a refused top lane passes to the right border.
  • ai_combat_check places its Drone in 16.16.
  • SimHash skips the Drone's float views.
  • float_lint_check: drone.gd and the Drone section of match_controller.gd lose their floats; 1728 uses in all to 1519.
  • openfire's drone_pack_check shoots through _shell_moved.

Known differences from the original, kept

  • The records start zeroed every match. The original's records are globals: a level starts with what the last level left in them.
  • The camp test runs before the Drones' ticks, not inside the vehicle's own tick. A new Drone gets its first tick in the same frame either way.
  • "Drawn" is still the port's stand-in (within 288 units of a player's vehicle), not the draw callback's stamp.
  • The order of objects inside a cell is not the original's linked list: the move test meets vehicles before Drones, the shot test vehicles, soldiers, then Drones.
  • The computer players' shot prediction (shell_drone_hit, AIGunner) reads the Drone's float views.
  • A computer player's rectangle refuses no spawn point (issue #77, a port choice).

Where the code is

  • Engine game/drone.gd: Record, constants, step, _attack, _shoot, _fly, _move, hit, muzzle_fx, move_toward_fx.
  • Engine game/match_controller.gd: _drone_pool, _drone_chain, _update_drones, _camp_tick_slot, _drone_rect, _spawn_drone, _drone_point, _drone_point_refused, _drone_fire, _drone_probe, _drone_collide, _end_drone, shell_hits_fx, _shell_moved, _apply_shell_hits.
  • openfire tools/data/drone.json: the exact constants.
  • Engine tests/drone_fx_check.gd.

Commits: engine f9bc080, openfire 871f673.

S5.5 is done. Next: S5.6, wrecks and gameplay debris (document 170).

Clone this wiki locally