Dev Log 3 – 3D Car Game (Traffic + World System Update)
Today the focus was on making the world feel less empty and giving AI cars more believable behaviour at junctions.
The environment now uses a grid-based road system, where roads run in straight lines across both axes. AI cars are spawned directly on these roads and are assigned a fixed direction along either the X or Z axis. This keeps traffic aligned with the lanes instead of drifting onto the grass.
A chunk-based building system was added so the world is no longer limited to a fixed square. Buildings are generated around the player as they move, based on which chunk of the map they are currently in. This makes the environment feel continuous and removes the visible edge of the map.
Intersections are now detected using the road grid. When a car reaches a point where both the X and Z positions align with a grid crossing, it is treated as an intersection. This allows the game to recognise junctions dynamically instead of hardcoding them.
A basic intersection blocking system was also introduced. Cars now check whether another vehicle is already using the same intersection. If it is occupied, the car will stop before entering and wait until it becomes clear. This prevents multiple cars from crossing at the same time and reduces overlap at junctions.
Traffic behaviour was adjusted so cars no longer rely on simple frame skipping. Instead, they actively pause movement when blocked and resume once the intersection is free. This makes the stopping behaviour more visible and consistent during gameplay.
Several bugs were fixed during this update, including incorrect chunk key formatting, a broken loop structure in the chunk generation system, a typo in traffic positioning, and inconsistencies in how cars were rotated based on direction. The intersection detection range was also widened slightly to make triggering more reliable.
There are still limitations in the current system. Cars do not yet form proper queues when waiting, and they do not make turning decisions at intersections. The blocking logic is also very simple, allowing only one car through at a time without priority rules or traffic lights.
Future improvements will focus on making traffic flow more natural. This includes adding proper queuing behaviour, introducing traffic lights, allowing cars to turn at intersections, and improving braking so cars slow down gradually instead of stopping instantly.
Comments 1
🔥🔥
Sign in to join the conversation.