Traffic System

Started by
2 comments, last by Tom Sloper 11 months, 4 weeks ago

Hi everyone,

I am a new game designer and I am trying to find out how traffic system works in games like GTA online. I have many questions such as when cars spawn and dispawn, how cars find their way to the destinations and how these cars calculate their speed. Is there any article/tutorial/vedio could help me?

Advertisement

@agentzero

I'm not an expert on this, but I have already made something like this before. One way you can define possibilities of routes is to make an array of points, describing the routes a car can go through (possibly an array of 2d or 3d points describing the path over the streets). After having all paths described you can pick random paths, or random cycles inside these paths (where the end of the path is the same point as the start), and someway make the car go through this path indefinitely. This paths can also have their own properties, like the maximum speed, maximum number of cars, etc, and you can use this to control traffic behaviour. About spawning/dispawning cars, you may spawn and dispawn cars at a point far away from your car/camera, and at a point your camera can't see (for example, in the opposite direction of the forward vector of your camera).

Locked because necro. @giovz481 , please do not reply to threads dormant more than a few weeks. There are many reasons why necroing is bad - just Google “why forum necro is bad” or any string of words that makes that point.

-- Tom Sloper -- sloperama.com

This topic is closed to new replies.

Advertisement