Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
M00NSHiNE
22
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 21st Nov 2003 14:29
Anyone know how to make GTA style traffic follow roads/make decisions based on traffic lights etc?

I need to make 3d traffic follow defined routes and branch off to different routes to make a city seem more immersive and real - yet i need to keep them managed so that they are removed from memory when out of useful range, so they dont cause slowdown.

Any ideas?

Cheers.

ZEDWARE website coming soon... //END TRANSMISSION//
hmm
22
Years of Service
User Offline
Joined: 11th Oct 2003
Location:
Posted: 21st Nov 2003 22:57
If you are using a matrix you can store information about each matrix tile. i.e. road_type(x,z)=1. Then using the information, you can write a function to control decision making of the ai cars when they are on a tile.

If not using a matrix, or if you don't want to write ai, you can make a simple program where you load in a level, then create a loop around the city. Then when you need to, position cars on that loop somewhere near to the camera and let them follow the path. By making a very long path that retraces hunctions etc. you can make it appear as though the cars are branching off at junctions.

I use the first method in my 'random city' programs because it is much simpler once you have thouight about a way of handling it.

As for keeping cars close range, just reposition them closer when they're too far. You should use the 'getdistance' function for this.

coincidence? how about pure cosmic convergence!
ReD_eYe
23
Years of Service
User Offline
Joined: 9th Mar 2003
Location: United Kingdom
Posted: 21st Nov 2003 23:13
have you ever had any experience with mapping for unreal tournament or any other game based on that engine? they use a thing callled path nodes, these are like waypoints, by placing them around your city you could have the cars drive towards them and each node has infomation contained in it, so when a car reaches a node it checks things such as any other nodes it can go to from their and maybe if it needs to stop for traffic lights, if a car has a choice of places to go you just get it to choose randomly. the hardest part is making it look right as cars go from 1 point to another.


GO TO THE ETERNAL DESTINY FORUMS!!! http://forums.eternaldestinyonline.com
Do it now!!!
M00NSHiNE
22
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 22nd Nov 2003 15:44
I havent actually used any of those editors, but I did research the fact that hammer used info_node points so the AI enemies could navigate round posts and obstructions, in the past.

I just never figured out how it decided which ones to choose.

ZEDWARE website coming soon... //END TRANSMISSION//
Carlitos
23
Years of Service
User Offline
Joined: 8th Jul 2003
Location: United States
Posted: 22nd Nov 2003 16:39
I'm doing something similar to what your trying to do in my game as well. One thing you can do is place hidden boxes(or plains) on the streets(numbered a high number, so that when you do collision with players, you can set IF GET OBJECT COLLISION(plr#,0)>0 AND GET OBJECT COLLISION(plr#,0)<x [x being the lowest object number for the nav box])

When a car collides with the plain(or box) do a POINT OBJECT to the next nav point(the plain or box) and you just keep doing that.It works great for me.

Now that you have traffic going your going to need to have street lights. Well, you can make an array for each street light. When a vehicle gets within a certain distance from the street light it will read the array(1=slow down to a stop,2=go).

Well, now the only thing left ot do is for you to give simple AI to the car so that it slows down when there is a car too close in front(i.e. at a street light) or screech to a stop if the player happens to run infront of the vehicle. To do this, simply find the angle of direction from the one object to the next. Then, if the object is right, determine the distance. When everything is established, have the car either screech to a halt or slow down.

If you need a better explanation, I could write you a simple demo. Good luck!
M00NSHiNE
22
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 23rd Nov 2003 19:07
Thanks very much click, thats a good start for me. A demo would help to clarify it a lot, if thats not too much trouble for you. Thanks!

ZEDWARE website coming soon... //END TRANSMISSION//
hmm
22
Years of Service
User Offline
Joined: 11th Oct 2003
Location:
Posted: 23rd Nov 2003 19:27
I think PCGamer did a racing game demo that came with DB Classic on the demos/utilities cd. That must have som example source showing how the 'waypoint' system works. (and some satisfying arcadey car physics).

coincidence? how about pure cosmic convergence!
Carlitos
23
Years of Service
User Offline
Joined: 8th Jul 2003
Location: United States
Posted: 24th Nov 2003 00:35
sure thing, I won't be able to work on it for a while though . However, I could let you have the code for the traffic in my game as soon as I finish touching it up
M00NSHiNE
22
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 24th Nov 2003 11:52
hmm - that demo in my opinion was terrible, the physics of both player and opponents was really bad.

Click - thanks very much, cant wait to see it.

ZEDWARE website coming soon... //END TRANSMISSION//

Login to post a reply

Server time is: 2026-07-26 17:34:21
Your offset time is: 2026-07-26 17:34:21