[Plugin] Streamer Plugin with Vehicle Streamer
#61

Quote:
Originally Posted by RakeDW
Посмотреть сообщение
What is happening in this case:

Код:
new VehicleID;
VehicleID = CreateDynamicVehicle(...); // ok, now VehicleID = 5 (example)
// imagine there is no1 in stream distance (so vehicle will be destroyed by streamer?) Also if I go to the spawn place, and vehicle appear is it still be 5 ID or ?
CMD:doforVehicleID(id, pr[]) {
RepairVehicle(VehicleID); // 
return 1;
}
The streamer's ID (which is returned by CreateDynamicVehicle) will always be the same for that Vehicle, but SAMP's internal Vehicle ID for that Vehicle may change if other Vehicles get streamed in/out before this one gets streamed in. So there won't be any problems unless you use SAMP's functions/IDs.
Reply
#62

Quote:
Originally Posted by NaS
Посмотреть сообщение
The streamer's ID (which is returned by CreateDynamicVehicle) will always be the same for that Vehicle, but SAMP's internal Vehicle ID for that Vehicle may change if other Vehicles get streamed in/out before this one gets streamed in. So there won't be any problems unless you use SAMP's functions/IDs.
Oh nice, there is streamer id
Thanks
Reply
#63

Quote:
Originally Posted by AbyssMorgan
Посмотреть сообщение
Maybe use your GitHub :P
I think uploading there is easyer than upload to github, i use my phone to upload those files because i now dont have cable connection nowadays, and if i share my 8KB/s net to pc, then i rather would not write here what happening
Reply
#64

This also allows more mapping objects in my server? - Because I seem to have to much.
And where to paste that code? - Or doesn't it matter?
Reply
#65

Quote:
Originally Posted by Calgon
View Post
Agreed with this, for some reason I've always had problems in SA-MP with vehicle IDs swapping (so you lose track of the vehicle but it still exists, or doesn't, etc) which I've known many others to have problems with also, this streamer would not only make that worse but also the idea itself is just generally not the best for SA-MP.
Have to agree with this in honesty and to the word, SA-MP is pretty irritating with vehicle ID's, I tried to fix this by making them match the MYSQL ID's therefore keeping track to the letter, but it didn't really work out, I re-wrote it to put into server sided variables and load in normally, but occasionally vehicles still appear on the wrong lists i.e When people do /myvehicles, they are given a random vehicle or something, very odd.

I mean, I can't really see the need to have more than 2,000 vehicles spawned at the same time if I'm honest, but it is a nice idea, but the ID's are going to be chaos.
Reply
#66

Quote:
Originally Posted by Dokins
View Post
Have to agree with this in honesty and to the word, SA-MP is pretty irritating with vehicle ID's, I tried to fix this by making them match the MYSQL ID's therefore keeping track to the letter, but it didn't really work out, I re-wrote it to put into server sided variables and load in normally, but occasionally vehicles still appear on the wrong lists i.e When people do /myvehicles, they are given a random vehicle or something, very odd.

I mean, I can't really see the need to have more than 2,000 vehicles spawned at the same time if I'm honest, but it is a nice idea, but the ID's are going to be chaos.
When I got problems with vehicle IDs I double-checked and found that they were caused by MY code (most of the time when I helped others with similar things I found *retarded* mistakes related to ID storing/usage which were definitely not some SA-MP bugs). I don't think SA-MP has any problem with vehicle IDs storing left (well, excepting the ones from train carriages, AFAIK they are really bugged), as I use them pretty much and never found bugs from SA-MP related to this. SA-MP even fixed in a previous 0.3 version some bug related to vehicle IDs which was, as far as I can remember, really hard to occur.

I don't get why some guys around here are against vehicle streamers. If you don't need that it doesn't matter that others won't find some useful thing to do with it. I personally can live really well without a vehicle streamer, by destroying vehicles when they are no longer needed (for example, when the house owner leaves the server), but with only 2000 vehicles most of the map is still empty and it is dull without any vehicle. For example, a server would look more attractive with few vehicles parked at houses on almost every street (by the way, I saw few years ago some servers with vehicle streamers which were FULL with vehicles (the radar had vehicle blips everywhere), never do that ! it makes the game laggy and ugly).

--------------

I can't really test the vehicle streamer now, as I don't have enough time, so here are few things:
1. We can still use regular non-dynamic vehicles without any bugs, even if using dynamic vehicles ? (as I said, I can't test)
2. Trains are really buggy in SA-MP, I forbidden them on my server too, just because of all the SA-MP bugs (mainly because vehicle ID allocations got really bugged after spawning trains [if I remember correctly]). I don't think you'll manage to implement them at all. After all, they can still be added with AddStaticVehicle(Ex) (if the answer from point 1 is "yes"), I don't think that a server should have too many trains. CreateDynamicVehicle should instantly return INVALID_STREAMER_ID (0) and send a streamer error ("Trains aren't supported.") if a train model was specified.
3. I don't think that you should add data manipulation for vehicles, but instead you should try to add every possible function related to them. I think that lots of manipulation data types that would work only for vehicles would be horrible.
4. Please try to use the definitions "rules" from this approved pull request: https://github.com/samp-incognito/sa...lugin/pull/198 .
5. There should be some function to keep tuning at respawn, per-vehicle (SetDynamicVehRespawnTuneReset ? by default true) so we won't have to store tuning and reapply it under OnVehicleSpawn.

6. SetDynamicVehParamsForPlayer needs to be reapplied when the vehicle is restreamed in for that player, which means that those parameters need to be stored somehow. The only method to do that in Pawn would be with plugins like GVar, which isn't ok. Maybe you could try to provide some GetDynamicVehParamsForPlayer function ? But there comes another problem: objective/doorslocked can't be disabled when the function is called, they need the vehicle to be streamed out. Each vehicle should MAYBE probably contain two containers to address these issues:
Code:
// ( playerid, make_pair< objective, doorslocked > ) ) 
map< int, pair< bool, bool > > actualPlayerParams; // this should be checked in OnVehicleStreamIn, to automatically reapply the params
map< int, pair< bool, bool > > playerParams; // this could be used in a GetDynamicVehParamsForPlayer, so it won't report the actual values, for example, it will report 1 for objective if it was set to 0 but the vehicle wasn't streamed out
But if you do this, there comes another problem: SetVehicleParamsEx. Those maps should be updated for the specified vehicle for every player with the corresponding doors/objective status.

7. Related to the respawning method: from what I saw in the code, I can understand that vehicles are respawned if they are touched (somehow fine, I'll get back to this), if they have a valid respawn delay (fine) and if at least 10 seconds passed after spawning (fine).
7.1. I see that vehicles are set as "touched" when a player calls OnPlayerEnterVehicle. From what I saw, doesn't this mean that the vehicle will be instantly respawned ? Also, players can cancel that action and no callback will be called. Are you sure that you didn't mean to use OnPlayerStateChange with newstate == PLAYER_STATE_DRIVER/PASSENGER ?
7.2. You should change this, from streamer.cpp:
PHP Code:
if (v->second->respawnDelay != -1
to this:
PHP Code:
if (v->second->respawnDelay 1
it makes more sense. In SA-MP I remember that I tested this and vehicles won't respawn with values lower than 1, but I'm not sure about this now.
7.3. I see that in processVehicles you have a problem related to possibly slow code: you are looping through all players if the vehicle (in the loop through all streamed vehicles) to check if it is occupied. If there will be, let's assume, 50 touched vehicles (they are set as touched in OnUnoccupiedVehicle, as I saw in your code) and 1000 connected players (well, huge servers may use this vehicle streamer after all, right ?) this means that it will perform 50000 iterations, which isn't too fine. To solve this, I think that you should create some additional map container for every vehicle item in which the players seat IDs are stored. If you'll do this, the speed will be greatly optimised I guess, but have something in mind: I saw that cheaters can manipulate a vehicle even if it already has a driver, so there will be 2 reported drivers (I guess that the same applies to passenger seats). A map can accept only unique keys. To fix this you either a) have to reject the second player entering in an already-occupied seat (a problem from wiki: "Sometimes the result can be 128 which is an invalid seat ID. Circumstances of this are not yet known, but it is best to discard information when returned seat number is 128.", I don't know if players may return the same seat ID by mistake - probably this could happen in buses ?). b) have to use a multimap, so multiple players will be able to report the same seat ID without caring about the SA-MP bugs (you should use a multimap I think). If you will do this (I hope you will) don't forget to remove players when they disconnect or get teleported or do some other things which may remove them from vehicles. BONUS: This can provide some really useful functions, without the need to loop everytime in Pawn:
PHP Code:
/*
- Empty slots from the array should be filled with INVALID_PLAYER_ID. (I don't know the behaviour of other streamer functions which pass values to arrays, but this is what it should happen in this case) Or at least the next empty available (if the size isn't equal or less) array slot.
- Should return the players count.
*/
/* GetDynamicVehicleSeatPlayers:
- If using a multimap an array parameter would be required to put the player IDs in it.
*/
native GetDynamicVehicleSeatPlayersvehicleidseatidplayers[ ], maxplayers sizeof players );
native GetDynamicVehiclePlayersvehicleidplayers[ ], maxplayers sizeof players );
// I don't know if data related to maximum seats should be implemented inside the streamer plugin:
native GetDynamicVehicleMaxSeatsvehicleid ); 
7.4. Why not changing from callbacks.cpp
pawn Code:
if (!p->second->touched)
{
    p->second->touched = true;
}
to
pawn Code:
p->second->touched = true;
? Also, you should use "v" (vehicle) as the iterator variable name, instead of "p" (player).

--------------

*semi-rage mode enabled* SA-MP has lots of bugs and problems that make everything a lot harder, which occurred even in my suggestions from above, but still lots of guys from around this forum (I bet that most of them don't even have a server, or their servers aren't too advanced) say that SA-MP don't need any update, because there are lots of features already and all bugs can be fixed by scripting (by the way, fixes.inc has thousands of lines to fix what shouldn't even be bugged to begin with, even really small bugs which should be easy to fix internally !). I get mad about bugs sometimes. Stop being so limited guys (like the ones who don't want any vehicle streamer, I see no reason why not to) and try to get the best you can. *semi-rage mode disabled*

I really appreciate that you managed to go that far with this vehicle streamer, thinking about all SA-MP's bugs and sync problems. Also, as far as I know, trailers syncing is pretty bugged TOO (argh !! Probably SA-MP's bug number 84324), you managed to make trailers working ?

By the way, SA-MP should also provide correct access to all quaternions of unoccupied vehicles (AFAIK, this is a bug too ! Incognito saw it too when implementing attached areas with offsets to vehicles: quaternions aren't reported correctly if the vehicle isn't occupied) and also the ability to set the quaternions of vehicles (not only the Z angle). I'm not sure if native SA-MP vehicle's quaternions are bugged after they restream-in to some players, I didn't test it before, but I guess that, at least with this streamer, vehicles could get stuck in objects if they were lastly streamed out from some kind of steep slope.
Reply
#67

Thanks for your analize, i appreciate it. I will correct the code based on your answer soon.
Reply
#68

Quote:
Originally Posted by Calgon
View Post
Agreed with this, for some reason I've always had problems in SA-MP with vehicle IDs swapping (so you lose track of the vehicle but it still exists, or doesn't, etc) which I've known many others to have problems with also, this streamer would not only make that worse but also the idea itself is just generally not the best for SA-MP.
There are servers with large number of SAMP players still, and i also have problem with vehicle limit. I own RPG server with 800+ players every day, from jobs organisations are only 600 static vehicles, and lets say every player has 1 car 1 motorcycle and maybe random airplane/bike and 800x2 = 1600 so limit is already gone even tho i have spawn vehicle per login(Player vehicles are spawned when player logs in). I'm sorry but people enjoy RPG and of course its easy to earn money for vehicle or just donate. So we still need streamer for vehicles.

I'm gonna test this in 7-10 days and i will let you know how does this work.
Reply
#69

Nice!
Reply
#70

Quote:
Originally Posted by DeitY
View Post
There are servers with large number of SAMP players still, and i also have problem with vehicle limit. I own RPG server with 800+ players every day, from jobs organisations are only 600 static vehicles, and lets say every player has 1 car 1 motorcycle and maybe random airplane/bike and 800x2 = 1600 so limit is already gone even tho i have spawn vehicle per login(Player vehicles are spawned when player logs in). I'm sorry but people enjoy RPG and of course its easy to earn money for vehicle or just donate. So we still need streamer for vehicles.

I'm gonna test this in 7-10 days and i will let you know how does this work.
Something tells me you will have a shit load of issues with that many players I would like to see the crazy ass results. Could you picture trying to use CreateObject() to stream objects to all the players? Well that is what this does, CreateVehicle() is not designed to be a per-player system.

Maybe I am wrong maybe it will work but with 800 players I just really think this thing will fall flat on face and you will be worse off
Reply
#71

Or better - make organisations vehicles dynamic. Create and destroy them based on activity at that organisation.
Also, you can limit players to spawn max 1 or 2 of their personal vehicles at a time.
Reply
#72

Nowadays I noticed a problem, that won't be easy to fix and will make big problems when re-streaming vehicles.

Let's take an example:
- A vehicle spinning or falling in air, then it rotating around X, Y, Z axis.
- After vehicles stream out, I get those rotation coordinates
- But If vehicle stream in, It's IMPOSSIBLE to set to those saved rotation coordinates because no function exists to specify vehicle XY rotatin.

Might it's possible by using the internal method from SAMP Server to create vehicles, because AFAIK it has parameters for XY rotation. It would be good if someone was test it without streamer, that the vehicle does restream in good rotation.
Reply
#73

Quote:
Originally Posted by Pottus
View Post
Something tells me you will have a shit load of issues with that many players I would like to see the crazy ass results. Could you picture trying to use CreateObject() to stream objects to all the players? Well that is what this does, CreateVehicle() is not designed to be a per-player system.

Maybe I am wrong maybe it will work but with 800 players I just really think this thing will fall flat on face and you will be worse off
To be honest, lag occurs @900 players like delay 1sec, due to streaming of objects, timers, anti hh include etc... Also, i can easily reverse effects of this new streamer in case of something bad occur. But if i disabled anticheat, i'd easily be 1000 players lag free, but yeah, kids everyday with cleo shits.

@Spmn thats what im gonna do probably if this streamer falls.
Reply
#74

Quote:
Originally Posted by kurta999
Посмотреть сообщение
Nowadays I noticed a problem, that won't be easy to fix and will make big problems when re-streaming vehicles.

Let's take an example:
- A vehicle spinning or falling in air, then it rotating around X, Y, Z axis.
- After vehicles stream out, I get those rotation coordinates
- But If vehicle stream in, It's IMPOSSIBLE to set to those saved rotation coordinates because no function exists to specify vehicle XY rotatin.

Might it's possible by using the internal method from SAMP Server to create vehicles, because AFAIK it has parameters for XY rotation. It would be good if someone was test it without streamer, that the vehicle does restream in good rotation.
I don't get why you would need to save the rotation while it is in air. It doesn't matter in that case. It only matters if it is on ground and may get blocked in-object when restreamed, due to the slope angle.

I just tested that XY rotation restreaming thing in the native SA-MP (without this vehicle streamer) and it looks to me that they are restreamed only with the correct Z rotation. I left the vehicle in a slope and I saved the current character position, I moved further away and then teleported to the saved position, it only had the correct Z rotation and it moved a bit because, well, wrong rotation.

Ignore the XY rotation, SA-MP does the same thing.
Reply
#75

But where are the sources?
Reply
#76

https://github.com/kurta999/samp-streamer-plugin
Reply
#77

Unfortunately i can't manage to set this up to work correctly with my COS. Most of the vehicles doesnt even stream when i for example teleport, and if i streamin and steramout id's are really messed up or even vehicles arent showing.

See how i ported here some vehicles which aren't even possible to be with this ID:

I really had my hopes up but yeah, still nothin ;/ if u have some documentation how to set up properly as i only replaced natives and callbacks with Dynamic ones.

Picture kinda small ,heres the big one http://prntscr.com/g28elr

I understand how this streamer works, but vehicles just wont stream in.
Reply
#78

Good job +REP
Reply
#79

Has this been disbanded? There's a new version of the streamer, would it be possible for you to update it to the latest (v2.9.2)?
Reply
#80

The link is invalid, please re-upload
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)