Traffic AI
It DOES sound like a monster project! Good luck!
Dave Mark
President and Lead Designer
Intrinsic Algorithm Development
"Reducing the world to mathematical equations!"
[edited by - InnocuousFox on April 5, 2002 5:49:05 PM]
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"
Trying is the first step towards failure.
Driving from A to B can be thought of as passing through a set of waypoint, each located at an intersection... and staying on the road (or footpath) as much as possible!
Consider approaching a left turn at the next intersection... you would need to:
a) move to the left lane;
b) decelerate
c) make the turn
which could be broken down into:
a.1) find an opening in the next lane
a.2) indicate a lane change to the left
a.3) move one lane to the left
a.4) if not in left most lane, return to a.1
(this model assumes driving on the left side of the road... if you want them to drive on the right, you''ll need to add a stop condition that tests if they''re on the left most lane heading in their direction!)
c) might break down as:
c.1) indicate the turn
c.2) give way to other traffic
c.3) turn into nearest lane of new road
You can see from this that you might want to consider a heirarchical planning system. These are fairly widespread in the game industry these days and there''s plenty of literature online about them.
You are certainly taking on a big project, but don''t let that stop you. Just approach it incrementally and set yourself sub-goals to achieve... like designing an agent that can drive in a single lane of traffic and speed up and slow down to accomodate other drivers in the lane... then add the ability to respond to traffic signals... then add changing lanes... etc, etc,...
Good luck and keep us posted as to your progress!
Timkin
Dave Mark
President and Lead Designer
Intrinsic Algorithm Development
"Reducing the world to mathematical equations!"
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"
a.1) find an opening in the next lane
a.2) indicate a lane change to the left
a.3) move one lane to the left
a.4) if not in left most lane, return to a.1
and thinking that to find an opening in the next lane would require an awareness of all surrounding vehicles, thus meaning that you would probably want some type of tree structure to store the location of all the vehicles (or spend a really long time iteratively searching for vehicles in the way ). I figure, that it would be a lot easier to just make each section of road "in control" of a set of cars, and make sure that they don''t crash, and that they change lanes and what not.
Then, when you want to give way to other traffic, you again have to seach for other cars, plus, if there are other conditions (say a green light for you, indicating that you can turn, or the path is clear but you have a red light), then it gets even more complicated.
I don''t know, I am 100% certain that you would have had more experience than me , so maybe you have a better way of implementing it to what I am thinking.
Trying is the first step towards failure.
Dave Mark
President and Lead Designer
Intrinsic Algorithm Development
"Reducing the world to mathematical equations!"
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play
"Reducing the world to mathematical equations!"
quote: Original post by ragonastick
Timkin, I would suggest that rather than treating the vehicles and pedestrians as intelligent agents, treat the roads an intersections as the brains - giving the pedestrians and vehicles orders which they will mindlessly follow. I''m looking at something like this:
a.1) find an opening in the next lane
a.2) indicate a lane change to the left
a.3) move one lane to the left
a.4) if not in left most lane, return to a.1
and thinking that to find an opening in the next lane would require an awareness of all surrounding vehicles, thus meaning that you would probably want some type of tree structure to store the location of all the vehicles (or spend a really long time iteratively searching for vehicles in the way ). I figure, that it would be a lot easier to just make each section of road "in control" of a set of cars, and make sure that they don''t crash, and that they change lanes and what not.
Then, when you want to give way to other traffic, you again have to seach for other cars, plus, if there are other conditions (say a green light for you, indicating that you can turn, or the path is clear but you have a red light), then it gets even more complicated.Original post by ragonastick
I don''t know, I am 100% certain that you would have had more experience than me , so maybe you have a better way of implementing it to what I am thinking.
Hehe… don''t be so sure of that! I''ve never implemented a traffic system before! All I am doing is compiling ideas from different problems that I have worked on - and read about - and applying them to your problem. For instance, as IFox mentioned, there was an article regarding the use of Fuzzy State Machines for the acceleration/deceleration problem… it was in Game Programming Gems (I) though, as I have it on my shelf at home (and I still haven''t picked up volume II from the campus bookshop!)!
I think the question of ''what'' should be in control is an excellent question to ask. I can see very valid arguments for both sides: i.e., agents (cars, bikes, pedestrians) in control vs environment in control. Perhaps the answer is a combination of these, as IFox suggested with environment objects polling surrounding agents.
As for the lane changing problem, I don''t really see that as a problem at all… if there is no opening beside the car (or bike) then it can choose to speed up or slow down to come closer to an opening. Using it''s indicator should send a signal to the car behind the opening to slow down (if they are courteous) and let the other car change lanes.
Like I said, this is going to be a very complex system you design, whatever the approach you choose. Don''t be daunted… just decide on the model you want to implement (be it your own idea or someone elses) and go for it! I''m sure members of this forum would be happy to help out with solving problems along the way!
Cheers,
Timkin
Please post any ideas you have as to how you would describe driver personalities and how they would affect the simulation!
Cheers,
Timkin