
A very basic world representation would simply consist of a graph that defines where streets are in the world. Here, you can see this kind of basic street graph.

The less information that this graph contains, however, the more sophisticated the vehicle AI has to be. For example, with such a simple world representation, vehicles will need to “know” that they should drive only in the correct lane and not all over the street.
In a preprocessing step, we can easily extend this graph to include this driving lane information. Here you can see our more complex street graph.

Now every street has a separate lane for each direction. Here all "incoming" lanes are connected with all "outgoing" lanes via splines.
With this new kind of street representation, vehicles can drive in the right-hand lanes and can choose random directions at intersections. The vehicles, however, don’t need to know anything about the world in order to navigate through it. You can put even more effort into this preprocessing step to improve the graph, without having to change the data layout. For example, you can remove connections to intersections that are too steep, or turn selected streets into one-way streets by creating and connecting the lanes differently.
So far, our street graph only represents static information. To implement proper traffic management, however, it’s not really important for vehicles to know what other vehicles are doing. The only thing that vehicles need to know is where they can NOT drive. For example, they should not drive (or crash!) into the car in front of them; or they should stop at an intersection, if another vehicle is currently going through it.
One way to achieve this is to have vehicles "reserve" space for their exclusive use and have them slow down and stop, if they cannot reserve the space that they want to drive into. The following screenshot shows this concept in our street graph.

To make this work, every vehicle needs a unique ID and every vertex on the street graph needs to have a variable where a vehicle can write its ID into. Now while they are driving, vehicles can reserve vertices in front of them. If they detect an already reserved vertex, they can slow down or stop to prevent crashing into an obstacle.
Intersections need some special handling. For intersections, we can implement traffic lights and crosswalks, and allow them to also reserve vertices. This way, cars will stop in front of them without needing to know anything about traffic lights or other obstacles. This allows them to appear very intelligent, without actually making them intelligent.
The information for this report is based on a report by Jan Krassnigg, a former master student intern at xaitment.
The video below shows a traffic simulation implemented as described above.
The following video shows a much more sophisticated traffic simulation, which was implemented by xaitment using similar methods.
Download our Unity Plug-Ins for NavMesh creation, pathfinding, movement, character behavior modeling, and game logic.
Here's your chance to see the Unity Plug-Ins for xaitMap and xaitControl in action. Request a meeting today.
no comments available.