Position prediction, anti lag and high ping delay
#1

Hey,

I made some kind of Race&Derby server for SAMP, and on this kind of server there are 'race pickups'. The best solution to make those was to use CreateDynamicSphere (from Incognito's Streamer) and then assign a variable with a number to every area we create. For example for a nitro pickup we have 'PickupInfo[areaid] == 1', 2 for a repair pickup and if the number is bigger than 2 it's a vehicle pickup (where the number is the vehicle model).

But, we also have some accurate maps that require some kind of 'skilled driving', and in thise maps we have velocity pickups. But, because those maps are very accurate if your velocity is set a little bit after you enter the area , you will fail and probablly end by hitting something.

Well when a player with a high ping enters a area, there is a small delay (under a second, but here even 100 miliseconds count) so he fails. I was thinking about some kind of position prediction system so that when he enters the area the velocity is set imediatelly, without any delay. (I know it can be done and saw Y_Less talking in some topic about that)

Can anybody give me a clue how to do that?
Reply
#2

Have you tried using TogglePlayerControllable to freeze those players with a high ping? Even if you did it for just a second, is that still an issue?
Reply
#3

I don't believe this is possible. Latency is very hard to work around.
Reply
#4

I dunno about y-less,but i remember slice talking about OnPlayerUpdate,so this might be a helpfull read http://forum.sa-mp.com/showpost.php?...54&postcount=1
Reply
#5

Quote:
Originally Posted by RealCop228
View Post
Have you tried using TogglePlayerControllable to freeze those players with a high ping? Even if you did it for just a second, is that still an issue?
TogglePlayerControllable does not freeze the vehicle in air and the vehicle falls down (Note: it's a race server), and even if it did, this wouldn't solve anything because OnPlayerEnterDynamicArea has a small delay if you have a high ping, so the car would be frozen in the wrong position.


Quote:
Originally Posted by Schurman
View Post
I don't believe this is possible. Latency is very hard to work around.
It is actually, I saw it on a server, I can give you the IP in a Private Message if you don't believe me. They use it for the exact same purpose as I want, velocity pickups.

And for doing this I was thinking about a fromula, that calculates the point where the vehicle will be in the next 100ms or so depending on the vehicle's speed. So if the vehicle is approaching directlly to a velocity pickup, the time that he need to travel to that point is calculated and a timer is set so that he does not have any delay when he gets in the area, but I doubt that is the right way to do it.
Reply
#6

Well .. I tried to make the formula myself but I am not very good at math ..
I would greatly appreciate if you would make it or if anybody else would.
Reply
#7

I think you are referring to the topic I created (https://sampforum.blast.hk/showthread.php?tid=379268) where I had the same question. By now I have found a pretty lag-free way of doing these pickups, unfortunately this still involves OnPlayerUpdate().

My way of doing it is I divide my objects into "maps" (maps have objects, pickups, ...). This way I can rule out any pickups from other maps and only check for a player when he's on a map with pickups. I narrowed down OnPlayerUpdate() with a few other things aswel.

If your question is, is there a way I can detect if a player picks up one of my pickups without any sort of heavy computing, no thats not possible, with very little computing, yes. Either way you'll need a powerful server if you're planning on doing pickup streaming with lots of players. It will always include a loop over every single pickup which is where the main cpu usage will occur.

I know exactly what kind of system you're thinking about, I would like it too and it has been suggested numerous times but it unfortunately, for some reason, has always been rejected.

EDIT: Position prediction can never be accurate, especially with high-speed maps like these. For every 50 pickups you'll hit there are 2 you won't.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)