Author Topic: Advanced Vehicle System - No vehicle limit & reduced lag  (Read 9356 times)

Advanced Vehicle System

What it does
Sometimes with considerably large builds, we need to place many vehicles scattered around the map to make the build usable in a server or game mode. In very large builds, the absolute maximum limit for vehicles may not be enough to fill the build with an adequate amount of vehicles, and usually using the maximum number of vehicles in a server causes a very slow connection to the clients connected to the server.

This mod allows users to place as many vehicles as they like on a server, while still maintaining a quick connection to all the clients connected to the server.

How it works
When vehicles are not within a radius close to a player, they are deleted, meaning that the vehicle object is no longer causing strain on the players. When a player re-enters the given radius of the vehicle, it will be re-spawned.

The main cause of connection strain however is not by stationary vehicles, but rather by vehicles in use. Stationary vehicles act mainly as static shapes until they are in motion and therefore mainly cause rendering strain on the client side.

To fix the connection strain caused by many vehicles being in use at the same time, a limit for number of re-spawning vehicles has been implemented. The default number for this is 5. Whenever there are 5 or more people using vehicles, then vehicles which have been deleted will no longer re-spawn until the number of people who are using vehicles drops below 5 again. This makes it virtually impossible for more that 20 people to use vehicles at the same time.

Preferences
You can change a few preferences by changing the following variables through the console:
  • $SRV::VehicleCheckRadius  << The radius of the check for players around any vehicle (default 150)
  • $SRV::RadiusCheckPeriod << The period for any vehicle to check for new players in their radius (default 1000 ms)
  • $SRV::MaxUsageSpawn << The number of players that can use vehicles before they stop respawning (default 5)

These preferences are not saved upon quitting.

If you do not know how to change these, then it's probably for the best sorry lol.

Download



If you like this check out more of my add-ons
« Last Edit: February 04, 2015, 11:09:47 AM by General »

This is cool. Very nice.

My only suggestion is that you use triggers instead of a function being called every second.
« Last Edit: October 27, 2014, 12:59:29 PM by jes00 »

My only suggestion is that you use triggers instead of a function being called every second.
The first build of this mod did use triggers, however triggers proved to make things extremely complicated as players inside vehicles weren't being detected when they enter a trigger etc. There was also a lot of crashing with the use of triggers that I never found out the cause of.

Triggers use ticks also, which are basically the same as a container search

I was hoping this would get released.

I Liked your sue of Science


this is a really nice mod


Interesting... I'll try this out later this week and see how well it works! Thank you for posting this!

Oh yes I totally needed this on my server thanks a lot! Oh can you make a mod that makes a vehicle disappear after it's owner leaves the server?

can you make a mod that makes a vehicle disappear after it's owner leaves the server?
Wait I could've swarn I saw a vehicle De-spawner server addon or whatever on your vehicle city driving server when you and I were hanging out back in this year's summer. Where when someone left it said above the vehicle "De-spawning in X seconds"

so what if i have 2 bases with 15 vehicles each


so what if i have 2 bases with 15 vehicles each
Then it won't work as well, the mod works best when vehicles are spread out.

the mod works best when vehicles are spread out.

Kind of like in a open-world free-roam map, like GTA, one could say?

hmm?