Car Driver AI

Hi,
I have been programming a road simulator/game, and I’m having problmes
with the driver’s AI.
The game uses a tile map(with directed streets)

My algorithm has two parts:

Road Following:
-The driver knows the next 4 tiles the car will go. (tile 1 is the current tile where the car is)
-If there is a change in direction in the tiles 2 or 3, slows down the car
-For each step the dirver tries to mantain the car aligned with the road (tile direction).

Collision Avoidance:
-The driver look for cars near.
-If the car found is in front if the driver’s car and in the next step the cars are nearer, then slows down the car.

I still have problems on crossings, and the cars never stops completely. I want to include semaphores.

Do some of you have some pointers to info on programming car driver’s AI??

Rafael.-

If every tile has a vector (2d) describing the direction (and speed, if the vector isn’t normalized) the AI should be moving there, you can make it steer smoothly along corners, and make the AI get back on track after it was pushed off the road, or turn the car around etc etc. On crossings, you just set the vectors to 0,0 so that the AI will simply continue.

You can use the vectors to avoid moving obstacles too, by influencing the vectors behind/next to the opponents’ cars.

Currently the tiles have flags for the exits, the driver selects one of
the exits(randomly) and uses ti to calculate the direction vector.

There is no speed info on the tilemap.

Using vectors for collision avoidance… seems like using some kind
of repulsive potential field…
How can I take this info and represent it as steering commands??
The driver and the car are different entities, the car simulates the
physics and the driver interacts with the car using these 3 properties:
*acceleration
*brake
*steering angle

Rafael.-

EDIT: A screen from the editor.

http://www.dcc.uchile.cl/~rcarvall/juegos/Micreros/mapEditor.gif

The behaviours on this page may be helpful.

Steering Behaviors… The problem with them is that I don’t know how to represent the
steering force as commands from the driver to the car…

Here are some screenies…

http://www.dcc.uchile.cl/~rcarvall/juegos/Micreros/imageAuto1.gif

http://www.dcc.uchile.cl/~rcarvall/juegos/Micreros/imageAuto2.gif

Rafael.-

Well, in my 2006 J4k entry (http://www.javaunlimited.net/results/view.php?id=104) I used steering behaviours to control the AI cars.

For the AI steering I calculated the angle between the cars’ current direction vector and the ‘desired’ vector and based on this angle i commanded the car to rotate left or right.

The model of the car simulates the physics… the car cannot be rotated directly, only applying the
torque of the friction forces of the wheels

The next image shows all the forces applied to the car.
red:aceleration (applied in the center of the axis (this car has front drive)
light green: friction of the rotationof the wheels
dark green: sliding friction of the wheells (always ortogonal to the wheel direction)
blue: current velocity

http://www.dcc.uchile.cl/~rcarvall/juegos/Micreros/carModel.gif

In this image, the car is turning (the driver send the command to turn the wheel to the right)
This produces a change in the forces applied.

http://www.dcc.uchile.cl/~rcarvall/juegos/Micreros/carModel2.gif

Now I need to know how to send the right command to stop and avoid the collision. (As used in the separation behavior)

Rafael.-