Prototype a script lane switch on multilane roads #10

Open
opened 2026-10-05 20:32:51 +00:00 by haylan · 1 comment
Owner

Part of #1

Question

On a same-direction multilane road, can a script make a held-back passer move to a lane the blocker isn't in? Prototype it in game. First candidate: rewrite the passer's MovePath.path so its next segment uses the free parallel lane (EdgeIdDir with a different EdgeId.index), and apply it with api.cmd.debug.makeComponentExchangeCmd sent without a callback. Before that, check whether the exchange is applied at all (for example, does a changed dyn.timeToIgnore show up in the next dump?). Also note whether it only works with debug mode on. HITL: the human runs a save copy with a fast and a slow player vehicle on a 2+ lane road. Outcome: whether a script lane switch works, and what it needs (debug mode, timing at segment boundaries).

Context: probe findings in docs/research/vehicle-probe.md on branch prototype/vehicle-probe. The engine already switches lanes at segment boundaries (GetNextEdgeTrafficPenaltyAndAlternatives).

Part of #1 ## Question On a same-direction multilane road, can a script make a held-back passer move to a lane the blocker isn't in? Prototype it in game. First candidate: rewrite the passer's `MovePath.path` so its next segment uses the free parallel lane (`EdgeIdDir` with a different `EdgeId.index`), and apply it with `api.cmd.debug.makeComponentExchangeCmd` sent **without** a callback. Before that, check whether the exchange is applied at all (for example, does a changed `dyn.timeToIgnore` show up in the next dump?). Also note whether it only works with debug mode on. HITL: the human runs a save copy with a fast and a slow player vehicle on a 2+ lane road. Outcome: whether a script lane switch works, and what it needs (debug mode, timing at segment boundaries). Context: probe findings in `docs/research/vehicle-probe.md` on branch `prototype/vehicle-probe`. The engine already switches lanes at segment boundaries (`GetNextEdgeTrafficPenaltyAndAlternatives`).
haylan added the wayfinder:prototype label 2026-10-05 20:32:51 +00:00
Author
Owner

Observation from the segment-rebuild prototype (closed ticket "Can rebuilding a road segment move a passer past its blocker?"): on country_new_medium (2 lanes per direction), after 3 of 3 replaceSegment rebuilds under a held-back pair, the leader moved from lane 4 to lane 3 (right away or one segment later), and in 1 case the follower got past. Not proof, since the engine also switches lanes at segment ends by itself. Also: makeVehicleSetLineCmd doesn't force a lane change, and engine-thread scripts can't send makeComponentExchangeCmd (GUI thread untested at the time). Details: docs/research/vehicle-probe.md on branch prototype/vehicle-probe.

Observation from the segment-rebuild prototype (closed ticket "Can rebuilding a road segment move a passer past its blocker?"): on country_new_medium (2 lanes per direction), after 3 of 3 `replaceSegment` rebuilds under a held-back pair, the *leader* moved from lane 4 to lane 3 (right away or one segment later), and in 1 case the follower got past. Not proof, since the engine also switches lanes at segment ends by itself. Also: `makeVehicleSetLineCmd` doesn't force a lane change, and engine-thread scripts can't send `makeComponentExchangeCmd` (GUI thread untested at the time). Details: docs/research/vehicle-probe.md on branch prototype/vehicle-probe.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: haylan/tpf3-overtake#10