HomeGamesUpdatesPricingMethodology
Steam News4 May 20262mo ago

added a real lane‑offset field and use it when building the per‑car waypoints

Let me explain the issue clearly: Why the cars still drive in the center: The field perfectCenteringDistance is not a lane offset — it's just the tolerance the learning system uses to score whether a pass through a wayp

Full notes

Full City-Racing update

Read the full published notes in a cleaner layout. The original post stays linked below.

What changed

0 fixes4 additions1 change0 removals
  • Gameplay
  • UI and audio
addedThe AI follows whatever positions are stored in the per-car waypoints container, and CreatePerCarWaypointsContainer() clones waypoints with src.transform.position — i.e., dead center of the road. To put cars in the right lane I need to add a real lane offset that shifts each cloned waypoint perpendicular to the road direction.
addedI added a real lane‑offset field and use it when building the per‑car waypoints, and add a clarifying tooltip on perfectCenteringDistance so it isn't confused for a steering offset.
changedWhat I changed in CRAILearningSystem.cs
addedAdded a clear tooltip on perfectCenteringDistance so it's no longer mistaken for a lane offset.
addedAdded a real lane positioning section:

City-Racing changes

addedThe AI follows whatever positions are stored in the per-car waypoints container, and CreatePerCarWaypointsContainer() clones waypoints with src.transform.position — i.e., dead center of the road. To put cars in the right lane I need to add a real lane offset that shifts each cloned waypoint perpendicular to the road direction.
addedI added a real lane‑offset field and use it when building the per‑car waypoints, and add a clarifying tooltip on perfectCenteringDistance so it isn't confused for a steering offset.
changedWhat I changed in CRAILearningSystem.cs
addedAdded a clear tooltip on perfectCenteringDistance so it's no longer mistaken for a lane offset.
addedAdded a real lane positioning section:

Let me explain the issue clearly:

Why the cars still drive in the center: The field perfectCenteringDistance is not a lane offset — it's just the tolerance the learning system uses to score whether a pass through a waypoint counts as "perfect" (within X meters of the waypoint). Setting it to 5 just makes the scorer more forgiving; it doesn't move the car off the road centerline.

The AI follows whatever positions are stored in the per-car waypoints container, and CreatePerCarWaypointsContainer() clones waypoints with src.transform.position — i.e., dead center of the road. To put cars in the right lane I need to add a real lane offset that shifts each cloned waypoint perpendicular to the road direction.

TrafficCar interaction: The methods tc.GetSpeed() / tc.IsHazard() exist and the scan logic is fine. The reason it can look "broken" today is that AI cars are driving on the centerline, so they sit on top of TrafficCars (overlapping/clipping) instead of approaching them in a forward cone — ScanForTrafficCars requires the traffic car to be ahead within a forward cone, so head‑on/centerline overlap makes the awareness misfire. Fixing the lane offset fixes the awareness too.

I added a real lane‑offset field and use it when building the per‑car waypoints, and add a clarifying tooltip on perfectCenteringDistance so it isn't confused for a steering offset.

No errors. Here's a summary of the fix:

What was wrong

· perfectCenteringDistance is a scoring tolerance for the learning system (how many meters from the waypoint counts as a "perfect" pass). It never fed into steering, so changing it from 3 → 5 didn't move the car off the centerline.

· CreatePerCarWaypointsContainer() cloned each waypoint at src.transform.position — i.e., the road centerline — so the AI dutifully chased the centerline.

·The TrafficCar awareness (ScanForTrafficCars tc.GetSpeed() / tc.IsHazard()) is wired up correctly. Its forward‑cone test was just being undermined by the AI sitting on top of TrafficCars on the centerline (overlap, not "ahead in cone"), so it rarely engaged.

What I changed in CRAILearningSystem.cs

  1. Added a clear tooltip on perfectCenteringDistance so it's no longer mistaken for a lane offset.

  2. Added a real lane positioning section:

· DrivingSide drivingSide (Right / Left)

· laneOffsetFromCenter (default 5, range 0–10)

  1. Rewrote the per‑car waypoint clone to:

· Compute the road forward direction from the previous/next waypoint (the original RCC waypoints aren't rotated to follow the road, so transform.right was unreliable).

· Compute world‑space right via Vector3.Cross(Vector3.up, forwardDir).

· Place each cloned waypoint at centerline + right * (laneOffsetFromCenter * ±1) depending on drivingSide.

· Save the cloned waypoint with a real LookRotation(forwardDir) so anything that reads its forward gets a sensible value.

On each AI car's CRAILearningSystem component:

·Set Driving Side = Right.

·Set Lane Offset From Center = 5 (or ~1.75 if you want the inner right lane on a standard 3.5 m × 4‑lane road; 5 will put it well into the outer right lane).

·Leave Perfect Centering Distance as a tolerance value (~3 is fine).

Because the per‑car waypoints are now offset into the right lane, the TrafficCar scanner will start seeing same‑lane traffic in its forward cone and the slow‑down / hazard logic will engage as designed.

Created By Anton Opic, Copilot, Claude Opus 7x Copywright 2026

Source

Steam News / 4 May 2026

Open original post

Changelog.gg summarizes and formats this update. How we read updates.