Question about how AI traffic is spawned and synced

How exactly is traffic spawned and synced in fivem? Its a very vague question lol but does the actual server spawn the traffic or does the client in that area spawn the traffic and sync with other players that go into their specific area? Please ask questions if what I just said doesn’t make any sense. Does it have something to do with the current arbitrator?

IIRC the client spawns it then sends to the server to sync, if you’re having issues with a lot of traffic when the majority of players are in one area you could do something like this:

  • loop player peds
  • if 8+ player peds within 15 range
  • no vehicle spawning / reduced ped spawning

since implementing this i don’t seem to have issues with 20 trucks spawning and blowing up

2 Likes

Hey!

Did you make a script for this?
Would you mind sharing it?
I’m having issues with traffic and vehicle spawning.

Thanks!

Sweet sounds like a simple solution!