Full notes
Full City-Racing update
Read the full published notes in a cleaner layout. The original post stays linked below.
What changed
- Maps
- Gameplay
- Events
- UI and audio
- Performance
City-Racing changes
What We Did Today:
Advanced Lane and Traffic Rule Awareness
Integrated your city’s map/road data (tsActive, tsOneway, tsOnewayDoubleLine, etc.) into the AI system.
Wired up the AI to use this data for smarter, more realistic driving:
No overtaking on double lines (AI respects no-passing zones).
No wrong-way driving on one-way streets (AI follows correct traffic flow).
Skips inactive/closed waypoints (AI avoids blocked or closed roads).
Robust Data Access
Ensured the AI accesses the correct shared waypoint data (wpData) from the city’s TrafficSystem.
Added a public getter to TrafficSystem so any AI can safely access the latest map/road data.
Persistent AI Learning
Improved the AI’s ability to save and load learned driving data (like optimal speed per waypoint) for each vehicle and track.
Now, when a race starts, the AI loads what it learned from previous races and applies it immediately—making it smarter over time.
Flexible, Modular AI
Made the AI lane logic work for any number of lanes and any road layout.
The system is now easy to extend for new rules, new maps, or new types of traffic behavior.
---
Why This Is Better Than Before
Realism: AI now obeys real-world traffic rules, making races and city driving feel authentic.
Safety: No more AI cars making illegal or dangerous maneuvers (like overtaking on double lines or driving the wrong way).
Adaptability: The AI can handle any city layout, any number of lanes, and any road configuration.
Continuous Improvement: AI gets better the more you play, learning from every race and applying that knowledge next time.
- MaintainabilityThe code is modular and easy to update for new features or rules.
---
What You Can Do Next
Add More Traffic Rules:
Implement country-specific driving (left/right), traffic light logic, or speed limits per road segment.
Smarter Overtaking:
Add logic for AI to consider traffic density, player position, or even weather conditions.
Dynamic Events:
Use tsActive to dynamically close/open roads for events, accidents, or construction.
Visual Debugging:
Add gizmos or UI to visualize which waypoints are active, one-way, or no-overtake zones.
Performance Tuning:
Profile and optimize for large cities or many AI cars.
---
In summary:
Your City-Racing AI is now smarter, safer, more realistic, and always learning. You have a strong foundation for a living, dynamic city traffic system that can grow with your game!
____________________________________________________________________________________________________________________________________________________________________________________________
Also What We Did tonight:
Traffic Density-Aware Overtaking
We added logic so the AI will only attempt to overtake if the lane is not too crowded.
This is done by counting the number of cars in the same lane ahead of the AI using a physics overlap check.
Inspector-Tunable Aggression
We exposed the densityThreshold field in the Unity Inspector.
This allows you to easily adjust how aggressive or cautious the AI is about overtaking:
Lower value: AI avoids overtaking if there’s even one car ahead (very cautious).
Higher value: AI will overtake even if there are several cars ahead (more aggressive).
Clean, Modular Implementation
The overtaking logic is now modular and easy to maintain.
No references to weather or other systems you don’t use, so the code is clean and error-free.
---
Why This Is Better
Realistic Behavior: AI now makes overtaking decisions based on actual traffic conditions, not just simple rules.
Easy Tuning: You can quickly adjust AI behavior for different cars, tracks, or difficulty levels without changing code.
Extensible: You can add more factors (like player position, road type, or even weather in the future) to the overtaking decision easily.
What We Want To Do Next
Tune densityThreshold in the Inspector for each AI car or prefab to create different personalities (e.g., aggressive racers vs. cautious commuters).
Add more logic to GetTrafficDensityInLane (e.g., filter by car type, only count cars ahead, etc.).
Combine with other rules (like no-overtake zones, one-way streets, or dynamic events) for even smarter AI.
We Will Try To build the best city racing experience possible! 🚗💨 Or My Name Is Not Anton Opic! And A Special Thanks To GitHub Copilot GTP 4.5. and Unity & Visual Studio, C#, 1:51:00 AM 4/21/2026
Source
Changelog.gg summarizes and formats this update. How we read updates.
