Programming traffic...
Blitz3D Forums/Blitz3D Programming/Programming traffic...
| ||
Has anyone programmed a traffic system or know of a link with more info? I've done some searches, but I get too many hits dealing with web traffic and not car traffic. I'm not looking for anything too advanced,... my first test will basically be a 4 block square with one four way intersection in the middle. 2d or 3d does not matter, I'm mostly trying to figure out a good way to make it work. My initial guess is to have many waypoints for each lane, and at the intersections have the car choose a random waypoint to go towards. Other issues would be to make sure cars do not run into other cars whenever possible, or do not get jammed in a corner or something. Anyways,... anyone have anything? Thanks |
| ||
Have a look here: http://pages.cpsc.ucalgary.ca/~yu/projects/traffic/traffic.html |
| ||
Hmmm,... interesting little program. Not quite sure it can help me any though, so I'll clarify a bit. I know I said traffic simulation, but I'm actually looking for a way to create a game along the lines of Crazy Taxi. I need to have other cars that drive around in the level, and (I think) I will need them to be able to do some basic things like stop at intersections and make turns. They don't have to be particularly smart about how they drive, since they are pretty much just obstacles that move, But I do want to create the illusion of a town that has some activity going on. Also, if it makes a difference,...depending on what I can do with the traffic, I see the final gameplay being either a 2D style top down game, or a 3d game that is viewed from a top down or iso camera mode. (Similar to the GTA series before it went 3D) I should also mention that although I do program, my real strengths are as an artist, so if anyone is interested working on this with me, please contact me. |
| ||
Well.. it really don't think it takes anything more then a 3d waypoint system, a pathfinding algo such as A-star(A*), and some light AI on the vehicles to traverse the pathfinding network. Look into those things and you'll have a good view of what to do. |
| ||
http://books.nap.edu/html/hs_math/tl.html maybe do a search for "traffic light timing" If they aren't timed you may end up with gridlock or a build up in places. The town I live in just spent 40,000 dollars just to do a survey on a road to think about getting it timed properly and they'll spend several hundred thousand to fix the problem. Yes an A* path finding routine, there are a few floating around. Look on blitzcoder. You could also do a table of predefined paths, that would be better for optimization you'll need to set up your intersections in a timing loop to change from red to green to yellow. for each car as it is driving check for distance from each each intersection if the car is in proximity to the intersection and heading towards it, if light is red or yellow slow car down using a curve value based on the stop mark for the intersection and the distance the car is from that stop mark. When the light is green just use the normal acceleration and have the car continue on its path. |
| ||
beeps from binary-people made a game called swot that has traffic in it...very well design maybe send him an email he might help ya |