2 registered members (7th_zorro, 1 invisible),
942
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Encrypt and Client-side movement
[Re: EpsiloN]
#433530
12/01/13 11:23
12/01/13 11:23
|
Joined: Jan 2006
Posts: 968
EpsiloN
OP
User
|
OP
User
Joined: Jan 2006
Posts: 968
|
After tweaking the script and setting time_smooth to 0.99 I get almost constant difference in position. It looks like its not the engine thats causing the difference, but my script. This is the update counter for each player (separately)
if(my.movement_input != 0 || vec_dist( my.x , my.last_sent_position_x ) > 32)
{
if(my.update_time_passed >= 20)
{
predict_position( 200 );
send_skill( my.predicted_current_x, SEND_VEC | SEND_ALL );
vec_set( my.last_sent_position_x , my.predicted_current_x );
my.update_time_passed = 0;
}
my.update_time_passed += time_step;
}
And this is the update I send immediately after the player changes input (because first update will come after 200ms.)
if(my.old_movement_input != my.movement_input)
{
my.old_movement_input = my.movement_input;
predict_position( my.latency );
send_skill( my.predicted_current_x, SEND_VEC | SEND_ALL );
}
my.latency is stored and send on each client to the server upon connecting. Any toughts what is causing the constant difference? The first update I send with event is off by 8.x quants. The others are 18.8x quants. (I think its ahead of my actual player,btw. Cant see that fast)
|
|
|
Re: Encrypt and Client-side movement
[Re: Ch40zzC0d3r]
#433538
12/01/13 19:06
12/01/13 19:06
|
Joined: Jan 2006
Posts: 968
EpsiloN
OP
User
|
OP
User
Joined: Jan 2006
Posts: 968
|
Yes , I am updating the ping constantly. After testing a few times , the first time after I posted I got, again, variable result, but now its stable again. No reason, no change. Just tested 2 times , fixed error between current and predicted position. I'll try to see if the predicted is further then the current position and I'll try sending a prediction with different combinations of 200ms and latency time / 2 added or substracted and I'll post again. EDIT: Unstable again, gives variable results. I have no idea what is wrong. Latency is fixed at 7ms. I gave some tought on this one
if(my.update_time_passed >= 20)
{
my.update_time_passed += time_step;
}
time_step times 75 frames (on 60fps) gives 20. I'm not updating very often Any idea how to make it count in ms? This ticks stuff is extremely confusing...
Last edited by EpsiloN; 12/01/13 20:19.
|
|
|
Re: Encrypt and Client-side movement
[Re: Superku]
#433545
12/01/13 21:02
12/01/13 21:02
|
Joined: Jan 2006
Posts: 968
EpsiloN
OP
User
|
OP
User
Joined: Jan 2006
Posts: 968
|
Yes, but I wanned to turn that into ms. , eg: d += time_var; // add duration of frame in ms if(d >= 200) error("hello"); // 200ms. Nevermind that, I ended up with this:
if(my.update_time_passed >= ((16 / time_step) / 5) )
{
my.update_time_passed += 1;
}
5 = how many times/sec. The other problem still stands. I just ran the client for 30 mins. At first, the error was almost constant (depending on direction, I mean movement_input being different, it gave different errors, but they almost remained constant). I just checked the client and the error now was adding up with 0.5 quants per update, corrected at 20 quants to 16 or 17, then adding up again. I almost have a correct prediction method, but I'm truly lost now! I dont have any ideas what could be wrong to give 18 quants difference even when updating 5 times/sec instead of 0.8 times/sec. In theory the error should have been reduced down to 3 quants, due to often updating, but it remains around 18. The even stranger part is that I was updating once every 1.2 sec. with my previous wrong counter, and I was predicting for 200ms. in the future, but the position was still almost correct, like it was ment for 1200ms silence, not 200 ms. I have a ghost in my laptop that is joking with me!
|
|
|
Re: Encrypt and Client-side movement
[Re: EpsiloN]
#433568
12/02/13 17:43
12/02/13 17:43
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
Adapted it to my GUI and added rotation, but I just noticed its client authority. What does that mean and why is it bad?
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
Re: Encrypt and Client-side movement
[Re: Superku]
#433576
12/02/13 21:53
12/02/13 21:53
|
Joined: Jan 2006
Posts: 968
EpsiloN
OP
User
|
OP
User
Joined: Jan 2006
Posts: 968
|
It means the client controls his position , not the server. Its bad because it makes cheating easy. Someone can make 'speed' or 'teleport' hacks. The only way this could work is to make the server force the client to move at a certain position if the client moved too far during the last update, exceeding the predefined maximum client speed, for example. But this way you must have a reasonable fixed speed for all entities. Otherwise if you're making a game with a slow warrior and a fast rogue, the cheat comes into play, making the warrior as fast as the rogue, but twice tougher...
|
|
|
Re: Encrypt and Client-side movement
[Re: Superku]
#433581
12/03/13 05:37
12/03/13 05:37
|
Joined: Jan 2006
Posts: 968
EpsiloN
OP
User
|
OP
User
Joined: Jan 2006
Posts: 968
|
You make the client send only input. The server moves the player and sends back the result. With high latency, this becomes a problem, because the client seems unresponsive. You have to noticeably wait a fraction of a second to start moving after a key is pressed. To deal with that, you make local movement, but as soon as an update arrives, you correct the local position with the updated server position. Thats where my problem comes from, my client and server are out of sync by 18 quants constant, and I cant pinpoint where this comes from. I'll try today without any prediction, starting from scratch, to see how much the difference will be between the client and server positions for 7ms latency. It should be just a few quants, no more... Thats how a lot of games do it, btw, but they've learned their lessons I remember Counter-Strike being the most noticeable. Everybody got speed hacks back in the original. But, if you've noticed for example WoW, if you lag, you suddenly appear somewhere else. It doesnt matter that you just ran half a mile...
|
|
|
|