Traffic Issue [Mass Spawn]


#1

Dear players / viewers,

One of the biggest issues we have faced ((in our server, LA:RP)) for a prolonged period of time now has been the AI Traffic. The traffic is tedious, mass spawning, it is just plain out chaos. AIs in vehicles, spawn above players and from time to time, out of a sudden, in front of them. We thought maybe it was due to latency however, that does not seem to be the case nor does it seem like any “lag” evolves around this issue. Any help would be appreciated. We have tried several scripts, custom coded a traffic script, neither worked.

SetVehicleDensityMultiplierThisFrame
SetRandomVehicleDensityMultiplierThisFrame

The above is what was used in the script made in hopes of fixing it, however, like how it always goes, the other way around. Didn’t work.

Regards,
Dashie


#2

Are you sure you implemented those correctly?

Because they definitely should reduce the traffic if you set it to 0.5 for example.
I’ve used those in my vBasic script and they work perfectly fine. Although setting them to 0.0 would not remove ALL vehicles but there are almost one left :wink:


#3

I can’t tell you for sure if it was implemented correctly, however, i will get in touch with my Developer and get him to overview the code once more. He stated that, when he set the traffic to 0.0, there was no vehicles at all. So uhm, yeah haha.


#4

0.0 will actually set ‘traffic’ to 0, which disables normal traffic. But special scenarios like AI getting in cars and driving off, or parking their cars and getting out to walk will still exist. That’s why you still might see some random cars around.

Also those methods need to be called every frame (so in a while true do loop with a Citizen.Wait(0)).


#5

Alright, do you think any other factors would play in if let’s say it was coded correctly but there are still issues with the traffic spawn / flow ?


#6

Not sure, sometimes depends on how many clients are in a specific area.


#7

What we have noticed is that; The more clients there are clustered at that particular area, the worse the traffic gets for that particular area. So i guess, that inference is correct. However, appreciate the help. I will get back to you not too long from now to update you on it.


#8

They are implemented correctly (called each frame in a client script). I think the problem was explained the wrong way. The “traffic” density is setting correctly. The issue isn’t with the density. Regardless of how many vehicles are on the streets at any given time, when a large number of players gather in a single area, say spawn or PD for example, vehicles will start to spawn above the groups and cause massive explosions / chaos. It happens no matter what the traffic density is set at (unless it’s disabled, of course). To make it more difficult to track, it doesn’t always happen. And no scripts that I have wrote would cause erroneous car spawning.

It’s a strange issue that I have had no luck resolving. Anyway, thanks for any assistance.


#9

so i have a basic idea of how u could fix this mayybe, from what itt looks like, the densitty is applieed to eeach player in the area instetad of thee server so when there is more players in a certain area tthere is more ttraffic there fucking shitt up.

what i would do is create a citizen function which constantly checks for each player if there is more than 1 player around him lets say a area of a 100 coords and if there is more than 1 player in that area then u set the density multiplier lower and if there isnt then u set it to normal, hope u understand what i mean


#10

Yeah I understand what you mean, sounds like it should work. I’d say make it and see if it works :slight_smile:


#11

yeah im not gonna make it, i aint got time for that XD


#12

He meant me, Cosharek, not you haha. Thanks I’ll see what happens.


#14

Any fix? I have this problem to :frowning: