Can a street type with overlaid passing lanes fake overtaking on single-lane roads? #13

Open
opened 2026-10-05 21:33:27 +00:00 by haylan · 1 comment
Owner

Part of #1

Question

Can a custom street type fake overtaking on single-lane roads by overlaying passing lanes on the oncoming lanes? Idea from the human: a street template that looks like country_new_small (one lane per direction, 14 m), but whose laneConfigs give each direction a second, overlaid lane placed on top of the opposite lane (for example width 0 at the centre line plus an offset into the oncoming lane). The engine then treats it as a multilane road and uses its own lane switching, which looks like pulling out into the oncoming lane to pass.

Settle with an in-game prototype (custom *.street_template.lua in mod/):

  1. The units and sign of LaneConfig.offset, and whether zero-width (or narrow) lanes are accepted.
  2. Do vehicles prefer the normal lane and use the overlaid lane only to pass, or do they cruise in it? On country_new_medium vehicles mostly used the inner lane.
  3. What happens when a passer meets oncoming traffic in the overlaid lane (expected: they drive through each other, since scripts can't steer lanes).
  4. Does it connect cleanly to normal small roads at nodes (lane connections)?

HITL: the human builds a stretch of the custom road between normal roads with a fast/slow pair on it; the logging probe on prototype/vehicle-probe records lanes. Outcome: go/no-go for overlaid passing lanes as the single-lane overtaking mechanism.

Context: lane layouts of all base street templates (offsets ±1 sidewalks, ±0.5 outer lanes, 0 inner lanes) are in base/content/infrastructure/street.zip. The engine lane-switches at segment ends (GetNextEdgeTrafficPenaltyAndAlternatives). Findings so far: docs/research/vehicle-probe.md on branch prototype/vehicle-probe.

Part of #1 ## Question Can a custom street type fake overtaking on single-lane roads by overlaying passing lanes on the oncoming lanes? Idea from the human: a street template that looks like `country_new_small` (one lane per direction, 14 m), but whose `laneConfigs` give each direction a second, overlaid lane placed on top of the opposite lane (for example width 0 at the centre line plus an `offset` into the oncoming lane). The engine then treats it as a multilane road and uses its own lane switching, which looks like pulling out into the oncoming lane to pass. Settle with an in-game prototype (custom `*.street_template.lua` in `mod/`): 1. The units and sign of `LaneConfig.offset`, and whether zero-width (or narrow) lanes are accepted. 2. Do vehicles prefer the normal lane and use the overlaid lane only to pass, or do they cruise in it? On `country_new_medium` vehicles mostly used the inner lane. 3. What happens when a passer meets oncoming traffic in the overlaid lane (expected: they drive through each other, since scripts can't steer lanes). 4. Does it connect cleanly to normal small roads at nodes (lane connections)? HITL: the human builds a stretch of the custom road between normal roads with a fast/slow pair on it; the logging probe on `prototype/vehicle-probe` records lanes. Outcome: go/no-go for overlaid passing lanes as the single-lane overtaking mechanism. Context: lane layouts of all base street templates (offsets ±1 sidewalks, ±0.5 outer lanes, 0 inner lanes) are in base/content/infrastructure/street.zip. The engine lane-switches at segment ends (`GetNextEdgeTrafficPenaltyAndAlternatives`). Findings so far: docs/research/vehicle-probe.md on branch prototype/vehicle-probe.
haylan added the wayfinder:prototype label 2026-10-05 21:33:27 +00:00
haylan self-assigned this 2026-10-05 21:34:29 +00:00
Author
Owner

Progress / handover (2026-10-06, paused, not resolved)

Prototype: mod/content/streets/overtake_proto_b.street_template.lua on branch prototype/vehicle-probe. It's a copy of country_new_small with a 0.5 m passing lane per direction at the centre line (offset B -2.5 / F +2.5, BUS/TRUCK only, 20 m/s; normal lanes 22.22 m/s). Variant A (opposite signs) was wrong and is removed. On the prototype road, lane 4 = normal forward, lane 3 = forward passing (left).

Results so far (details in docs/research/vehicle-probe.md):

  • The street type loads and looks right; vehicles can drive on the passing lanes.
  • One real overtake: fast 29251 passed slow 29851. But the slow one was in the passing lane, and the fast one passed on the normal lane.
  • The engine gives a vehicle a lane when it enters a stretch and keeps it; it doesn't move over when blocked. A lower passing-lane speed (20 m/s) didn't change lane choice.
  • Town cars used the passing lane before it was restricted to BUS/TRUCK.
  • Visually, the lane change at nodes is abrupt (about 5–6 m sideways in a near-zero-length node). Vehicles stop when merging back at the end of a stretch.
  • Entry control by hand with the native crossing tool (UI::LaneModifier): in the last run, slow buses still entered in lane 3 at segments 21304 and 29012. It's unknown whether the edits were saved, or where.

Next step:

  1. Ask the human what the crossing tool allowed at a simple two-segment joint.
  2. Reload the save. The probe now logs NODE seg= node= userModified= conns= for both nodes of every occupied prototype segment.
  3. If the edits aren't stored, set the entry connections by script (SimpleStreetProposal.nodeConfigsToAdd with BaseNodeConfig.laneConnections: normal lane → lane 4 only).

Still open for the go/no-go: even with entry control, nothing found so far makes a blocked fast vehicle move into the passing lane. Then decide between (a) entry control plus a trigger, and (b) accepting "random" passing. The smoother-transition work (smaller offset or transition segments) was deferred.

Workflow notes: street templates only load at game start (restart the game); scripts load on save reload; log at <Steam>/userdata/94065030/3493540/local/crash_dump/stdout.txt.

## Progress / handover (2026-10-06, paused, not resolved) **Prototype:** `mod/content/streets/overtake_proto_b.street_template.lua` on branch `prototype/vehicle-probe`. It's a copy of `country_new_small` with a 0.5 m passing lane per direction at the centre line (`offset` B -2.5 / F +2.5, BUS/TRUCK only, 20 m/s; normal lanes 22.22 m/s). Variant A (opposite signs) was wrong and is removed. On the prototype road, lane 4 = normal forward, lane 3 = forward passing (left). **Results so far** (details in `docs/research/vehicle-probe.md`): - The street type loads and looks right; vehicles can drive on the passing lanes. - One real overtake: fast 29251 passed slow 29851. But the slow one was in the passing lane, and the fast one passed on the normal lane. - The engine gives a vehicle a lane when it enters a stretch and keeps it; it doesn't move over when blocked. A lower passing-lane speed (20 m/s) didn't change lane choice. - Town cars used the passing lane before it was restricted to BUS/TRUCK. - Visually, the lane change at nodes is abrupt (about 5–6 m sideways in a near-zero-length node). Vehicles stop when merging back at the end of a stretch. - Entry control by hand with the native **crossing tool** (`UI::LaneModifier`): in the last run, slow buses still entered in lane 3 at segments 21304 and 29012. It's unknown whether the edits were saved, or where. **Next step:** 1. Ask the human what the crossing tool allowed at a simple two-segment joint. 2. Reload the save. The probe now logs `NODE seg= node= userModified= conns=` for both nodes of every occupied prototype segment. 3. If the edits aren't stored, set the entry connections by script (`SimpleStreetProposal.nodeConfigsToAdd` with `BaseNodeConfig.laneConnections`: normal lane → lane 4 only). **Still open for the go/no-go:** even with entry control, nothing found so far makes a *blocked fast* vehicle move into the passing lane. Then decide between (a) entry control plus a trigger, and (b) accepting "random" passing. The smoother-transition work (smaller offset or transition segments) was deferred. Workflow notes: street templates only load at game start (restart the game); scripts load on save reload; log at `<Steam>/userdata/94065030/3493540/local/crash_dump/stdout.txt`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: haylan/tpf3-overtake#13