SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 07/12/2019, 04:05 PM   #1
Nickk888
Little Clucker
 
Nickk888's Avatar
 
Join Date: Oct 2011
Location: Germany
Posts: 43
Reputation: 53
Thumbs up NVS [Beta 1.0] - A dynamic chunk based vehicle streamer!


About Me:
Hello dear SA-MP community My name's Nickk888, i'm a German/Polish PAWN Scripter since 2011, I own a YT channel about SA-MP Scripting in Polish language and I create scripts for the public for free. Excuse my English skill, I'm no native English speaker, so please keep this in mind I'll try my best ^_^

About Script:
Nickk's Vehicle Streamer is a, well... A vehicle streamer It allows you to create a lot more then 2,000 Vehicles on your server, and by a lot more i mean A FREAKING LOT MORE! Technically over 100,000, but I've limited it to 100,000 because you know the lag it would create? But you can change it in the source and recompile if you want

How does it work:
Well, it works by assigning the vehicles into chunks that are created on the map while the script is loaded, the script creates about 17,656 chunks (Depending on the settings), by chunks i mean Dynamic Areas using Incognito's Streamer, the script checks if ANY player is on a chunk(Dynamic Area), if so, it will load(Create) the vehicles assigned(Registered) in this particular chunk and neighbor chunks to create a seamless vehicle stream without vehicles popping up suddenly. If the player leaves the chunk, it will unload this chunk and the other as well (Only if there is no other player on it of course).

Why did i do it that way? Well, because of efficiency! There is only 1 timer that checks every second(Can be changed in the setting in Scriptfiles) if ANY player is on a chunk, that's it! There is no player to vehicle distance check! All of that makes it A LOT faster!

Efficiency:
As i wrote above, the efficiency depends on the amount of chunks that are created, less chunks = Better performance, you can change all of that in the settings, by default the chunk size is 300(Samp Units(?)), so by that it will create from X/Y -20,000 to X/Y 20,000 about 17,656 chunks, why 40,000 x 40,000? Because that's the default limit you can travel outside the map, so if there are vehicles outside the map, it will still create them!

Average operating time every second on 17,656 chunks is 2-60ms, tested on 1-3 players, needs to be tested on a larger server! But i think because of how Incognito's streamer works, it will probably be still very efficient!

Functions:
You will need to use those functions in your Gamemode or other Filterscript, the main script "nvs-core.amx" will receive those commands.
Code:
CreateDynamicVehicle(model, Float:x, Float:y, Float:z, Float:rot, color1, color2, respawndelay = -1, addsiren = 0)
DestroyDynamicVehicle(vehicleid)
SetDynamicVehiclePos(vehicleid, Float:x, Float:y, Float:z)
SetDynamicVehicleZAngle(vehicleid, Float:zangle)
SetDynamicVehicleHealth(vehicleid, Float:health)
ChangeDynamicVehicleColor(vehicleid, color1, color2)
AddDynamicVehicleComponent(vehicleid, componentid)
PutPlayerInDynamicVehicle(playerid, vehicleid, seatid)
SetDynamicVehicleToRespawn(vehicleid)
ChangeDynamicVehiclePaintjob(vehicleid, paintjobid)
LinkDynamicVehicleToInterior(vehicleid, interiorid)
SetDynamicVehicleVirtualWorld(vehicleid, worldid)
CountDynamicVehicles()
CountSpawnedDynamicVehicles()
GetDynamicVehicleInternalID(vehicleid)
GetDynamicVehicleModel(vehicleid)
GetDynamicVehicleVirtualWorld(vehicleid)
GetDynamicVehicleInterior(vehicleid)
GetDynamicVehiclePos(vehicleid, &Float:x, &Float:y, &Float:z, &Float:angle)
GetDynamicVehicleColor(vehicleid, &color1, &color2)
Callbacks:
You will need to use them if you want to attach and dettach something on the vehicle like an object, 3d Text Label etc.
Code:
OnDynamicVehicleSpawn(vehicleid, internal_id)
OnDynamicVehicleDespawn(vehicleid, internal_id)
Dependencies:
Incognito's Streamer for the core functions.
maddinat0r's Sscanf 2 for some "Get" functions it's needed.

Screenshots:
There are no Screenshots, what should i show you? Vehicles on the map? It's a Vehicle Streamer, watch the video!

Video:
Turn on subtitles on the video! I've added english subtitles.
CLICK HERE!
If the link doesn't work, use this Video ID on Y0uTube: JTzxolbxlAU

Known problems:
  • I have no idea how i should implement the respawn delay on vehicles... It works.. but, only when the vehicle is spawned. It will not respawn if the vehicle is despawned.
  • If you create a vehicle outside the 40,000 x 40,000 boundaries, it will not create the vehicle.
    You can change the MAP_SIZE definition in the source file and recompile the script but...
    It's not recommended to do so! You have plenty of space withing the boundaries...
    Why outside?...
  • Unfortunately there is no check if a script that has created Dynamic Vehicles, has been unloaded so the vehicles are automatically removed,
    you will need to keep track of the ID's within the script and use the Destroy function to remove them "Manually" on OnFilterScriptExit and or OnGameModeExit.
  • There is a possibility to "overflow" a chunk with vehicles, the script can only register 2000 vehicles per chunk, so if there are vehicles that want to register to a full chunk, it will either not Create the vehicle and or not register the vehicle.
  • There is also no check if there are too much vehicles created on the server, the script will try to spawn them, but if the CreateVehicle function will fail, well, it will not spawn the vehicle.
    Just don't create that much vehicles in one place and you'll be fine...

Changelog:
Beta 1.0
Code:
First Release.
Download:
Mirror 1: http://bit.do/nvs-link
Mirror 2: https://github.com/Nickk888SAMP/Vehicle-Streamer

Last words:
This system needs a lot of testing! It's still beta! Please test if it works on your server, if you find any bugs, glitches and other problems, please let me know!
__________________
Nickk888 is offline   Reply With Quote
Old 07/12/2019, 05:16 PM   #2
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,892
Reputation: 1321
Default Re: NVS [Beta 1.0] - A dynamic chunk based vehicle streamer!

#define MAP_SIZE 40000 //The map size, don't change! so that creates 17,656 chunks.
However! Realistically a lot of those chunks are going to be completely useless it's more of a 6000x6000 area which reduces the chunks down to a total of 400 for the San Andreas map.

This is where vehicle streamers fail every time. Sure this would work fine with limited players but lets assume this scenario. A 100 player server every player is in their own chunk. Each chuck has 20 vehicles in it. Already you have hit the 2000 vehicle limit now lets put in another factor.

"if so, it will load(Create) the vehicles assigned(Registered) in this particular chunk and neighbor chunks to create a seamless vehicle stream"

So it will also load any unloaded neighbor chunks automatically right there the streamer breaks in this scenario. That is only with a 100 players it could be very easy to break this now picture a 1000! The reality is you will never have enough players to actually need this and if you did it would break.

Just think if you tried to do this using global objects even worse! But still the same problem.

Great idea but the support is completely insufficient to support a system like this in SA-MP. My suggestion spend your time making something that is actually useful this is just wishful thinking. I don't know people keep trying to do this there is no viability.

1-Star from me as great of an idea it is, it is equally as stupid to pursue for the reasons listed above.
Pottus is offline   Reply With Quote
Old 07/12/2019, 05:37 PM   #3
Nickk888
Little Clucker
 
Nickk888's Avatar
 
Join Date: Oct 2011
Location: Germany
Posts: 43
Reputation: 53
Default Re: NVS [Beta 1.0] - A dynamic chunk based vehicle streamer!

Quote:
Originally Posted by Pottus View Post
#define MAP_SIZE 40000 //The map size, don't change! so that creates 17,656 chunks.
However! Realistically a lot of those chunks are going to be completely useless it's move of a 6000x6000 area which reduces the chunks down to a total of 400 for the San Andreas map.
That's true! It has been previously 6000x6000, but now the problem is, if you want to create a vehicle outside the map, it will fail! That's a problem for stunt servers or some derby servers that have objects on the ocean, of course you could change the boundaries to 6000x6000 and it would be fine for players, but still not a good solution.

Quote:
Originally Posted by Pottus View Post
This is where vehicle streamers fail every time. Sure this would work fine with limited players but lets assume this scenario. A 100 player server every player is in their own chunk. Each chuck has 20 vehicles in it. Already you have hit the 2000 vehicle limit now lets put in another factor.

"if so, it will load(Create) the vehicles assigned(Registered) in this particular chunk and neighbor chunks to create a seamless vehicle stream"

So it will also load any unloaded neighbor chunks automatically right there the streamer breaks in this scenario. That is only with a 100 players it could be very easy to break this now picture a 1000! The reality is you will never have enough players to actually need this and if you did it would break.
Yes, that's why i tried to create a "priority" system like Incognito's object streamer that will create only the nearest vehicles if there are many, but that'd completely mess up the code and efficiency :/ Like you said, it would work fine with limited players, true, it also depends on where the vehicles are positioned and how big the chunks are. The system is secured for this scenario, if you hit the spawn limit, it will just not spawn new vehicles, but that doesn't mean they are not in memory so if there is space for creating, it will spawn the vehicles that couldn't be spawned before after chunk has been reloaded.
I also wrote that problem in the "Known problems:" list Quote:
Quote:
There is also no check if there are too much vehicles created on the server, the script will try to spawn them, but if the CreateVehicle function will fail, well, it will not spawn the vehicle.
Just don't create that much vehicles in one place and you'll be fine...
Quote:
Originally Posted by Pottus View Post
Great idea but the support is completely insufficient to support a system like this in SA-MP.
Yes, that's pretty unfortunate... It would be a great anti lag system if we could change the vehicle create Limit...
But i think it's still not useless, i'm sure some servers COULD use it for a <100 slot RP server. It took a LOT of my time to create this...
__________________
Nickk888 is offline   Reply With Quote
Old 07/12/2019, 05:40 PM   #4
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,892
Reputation: 1321
Default Re: NVS [Beta 1.0] - A dynamic chunk based vehicle streamer!

Oh well man it's cool anyways, maybe one day if 10,000 vehicles are supported then this would become very useful

Here are some ideas for you.

- SA-MP Sandbox (Create your gamemode in game)
- SA-MP GUI system (ordering textdraws on screen, binding etc)
- Compound models (Basically prefabs but assigned their own model number 20001+ because ColAndreas uses 20000 to identify water)

If you won't do compound models I will at some point lol
Pottus is offline   Reply With Quote
Old 07/12/2019, 05:56 PM   #5
Nickk888
Little Clucker
 
Nickk888's Avatar
 
Join Date: Oct 2011
Location: Germany
Posts: 43
Reputation: 53
Default Re: NVS [Beta 1.0] - A dynamic chunk based vehicle streamer!

Quote:
Originally Posted by Pottus View Post
Here are some ideas for you
Quote:
Originally Posted by Pottus View Post
SA-MP Sandbox (Create your gamemode in game)
Yes, i've had that idea some time ago But my idea was to create an Include with functions like "CreateSpawnPoint" or "CreateGunShop" etc. But creating everything IN GAME, "Programming" within the Game!, that would be amazing! Will consider that for my next project!

Quote:
Originally Posted by Pottus View Post
Compound models (Basically prefabs but assigned their own model number 20001+ because ColAndreas uses 20000 to identify water)
Prefabs, so do you mean objects that are been connected into a structure and been assigned to a ID? That's a lot of work But possible! Also creating an In Game Prefab creator/Editor would also be great then

Thanks for the idea mate! ^^
__________________
Nickk888 is offline   Reply With Quote
Old 07/12/2019, 06:04 PM   #6
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,892
Reputation: 1321
Default Re: NVS [Beta 1.0] - A dynamic chunk based vehicle streamer!

I got lots more!

- Good bots with advanced path finding
- Apocalypse scenario where LS gets destroyed over the course of 12 hours (survival)
- Animation sequence builder
Pottus is offline   Reply With Quote
Old 07/12/2019, 06:18 PM   #7
Nickk888
Little Clucker
 
Nickk888's Avatar
 
Join Date: Oct 2011
Location: Germany
Posts: 43
Reputation: 53
Default Re: NVS [Beta 1.0] - A dynamic chunk based vehicle streamer!

Quote:
Originally Posted by Pottus View Post
I got lots more!

- Good bots with advanced path finding
- Apocalypse scenario where LS gets destroyed over the course of 12 hours (survival)
- Animation sequence builder
For bot's with pathfinding you could use FCNPC in use with GamerZ's GPS Plugin I had previously created a Taxi script where you use /Taxi and a Bot drives to your location, after you enter the Car, you can choose a position on the map and so the Bot will start to drive Still not perfect, but blame Kalcor for such broken Bots XD MTA has better NPC's... I tried to create an Actor AI system using... Actors, but you can't teleport(Move) them if they are streamed in... Such a waste of potential...

For the Apocalypse part, that would be a great idea for a Gamemode

For the animations, i once made an Include called "NCameraSequencer" where you could put camera coordinates from A to B, and it would move the camera and sequence between other camera coordinates with a Fade Out Fade In! It's on my G00gle Dr!ve somewhere :P

I have a lot of unfinished projects, it's very unfortunate to write a code only to hit a wall of samp Limits... You can't create a lot of that, and that, and that, these functions are broken and or desync...
__________________
Nickk888 is offline   Reply With Quote
Old 09/12/2019, 03:39 PM   #8
m4karow
Huge Clucker
 
Join Date: Oct 2015
Posts: 287
Reputation: 37
Default Re: NVS [Beta 1.0] - A dynamic chunk based vehicle streamer!

Your release is honorable. I have vehicles around San Andreas and there are 1400 vehicles right now and there are no player or faction vehicles, so maybe I'll use this because I almost hit the limit.

One question: why don't you release this as a plugin?
m4karow is offline   Reply With Quote
Old 12/12/2019, 09:15 PM   #9
Nickk888
Little Clucker
 
Nickk888's Avatar
 
Join Date: Oct 2011
Location: Germany
Posts: 43
Reputation: 53
Default Re: NVS [Beta 1.0] - A dynamic chunk based vehicle streamer!

Quote:
Originally Posted by m4karow View Post
Your release is honorable. I have vehicles around San Andreas and there are 1400 vehicles right now and there are no player or faction vehicles, so maybe I'll use this because I almost hit the limit.

One question: why don't you release this as a plugin?
Because i don't know how to code in C++, that's why.
__________________
Nickk888 is offline   Reply With Quote
Old 15/12/2019, 06:34 PM   #10
MpK
Gangsta
 
MpK's Avatar
 
Join Date: Feb 2013
Posts: 670
Reputation: 169
Default Re: NVS [Beta 1.0] - A dynamic chunk based vehicle streamer!

Is it normal to see all the tunable vehicles with tuning on?
MpK is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Advanced Inventory/Object Managament Script (DayZ Themed) [SQL;Dynamic;Beta] CuervO Filterscripts 62 17/03/2020 10:16 AM
[PHP+DJSON] DMap 0.4 - Dynamic Website Player/Car/Obj/Shop Map(******Maps based) DracoBlue Maps 272 08/08/2014 11:57 AM
Embedded loops and chunk IsPlayerInRangeOfPoint checking, better way? Hoborific Scripting Help 6 20/05/2013 03:43 AM
[FilterScript] Simple vehicle plate system [based on vehicle ID] Ivan_Pantovic Filterscripts 18 08/04/2012 12:43 PM
[Tutorial] How to make dynamic dialog-based tutorial system T0pAz Tutorials 2 09/02/2012 02:43 PM


All times are GMT. The time now is 12:50 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.