Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How Gta 5 traffic system was made?


Recommended Posts

Create graph nodes at each intersection/along the roads' curves. This is oftentimes able to be done automatically with many game engines; although RS's is proprietary, I expect they have such a tool. Give each person a start node and a destination node (or start point and end point, and determine the route to/from the nearest node for each), run the A* or another pathfinding algorithm to find the shortest path from one place to another, save that succession of nodes as some kind of structure on each driver (linked list works best conceptually imo). Do all that serverside for the online play so you always have plenty of processing power. In single player, do that solely for the ones that are visible on screen. Add in some graphical smoothing for the driving so it's not choppy, add in some handling for when you attack or threaten them (start a running away procedure when attacked, after a certain amount of time, assess if there's still a threat, continue running away or go back to trying to get to the destination if not).

That's probably just about the basics of it. There's certainly a lot of little nuances that RS took to make it more realistic. Stuff like using a weighted graph system for allowing pedestrians to run in the street, but not prefer to, perhaps. And I expect a complex state machine to govern their mood, current objective/destination, etc.

Link to post
Share on other sites
  • 3 weeks later...

Yes there are professional tools created for simulation that are just excellent

 

For Leadwerks, the best is the spline tools, it allows a car  to follow the road, including physics possibilities.

I made with this a little race car game, that was one of my testing with the spline tool:

 

 

 

Link to post
Share on other sites

I would say not too complicated, but it's quite fascinating to look at a good traffic simulation, something between (not) robotic moving with no accident and fluently cars moving, each at its own velocity.

There are the rules and then the traffic goes its own way, yes great thing to create.

 

 

Link to post
Share on other sites
23 hours ago, Thirsty Panther said:

Not sure if it works with the current Leadwerks build but it might be worth having a look at.

Probably not working anymore, as Josh changed the physics - if I good remembered - with Update LE 4.4

And Nick Ace set the cars prefabs from Shadmar as requirement, so probably will the cars not be able to drive, except you go back to build LE 4.3 

But yes it might be worth having a look at it for how he managed the simuilation.

 

  • Like 1

 

 

Link to post
Share on other sites
22 minutes ago, Vida Marcell said:

There are so many things happened here in the past decade

That's right and so much more before I joined. But I have the feeling the leadwerks community was and is one of the nicest, because never trolling anybody and cool people and so, well sadly a lot of active nice and helpful members are gone, waiting for the ultra engine, or whatever why I don't know.

  • Like 1

 

 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...