Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, 1 invisible), 942 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 4 1 2 3 4
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 Offline OP
User
EpsiloN  Offline 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)
Code:
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.)
Code:
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)


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Encrypt and Client-side movement [Re: EpsiloN] #433532
12/01/13 11:26
12/01/13 11:26
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Man, are you updating your ping?
I hope you know that your ping right after connecting is much higher.

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 Offline OP
User
EpsiloN  Offline 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
Code:
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 laugh

Any idea how to make it count in ms? This ticks stuff is extremely confusing...

Last edited by EpsiloN; 12/01/13 20:19.

Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Encrypt and Client-side movement [Re: EpsiloN] #433540
12/01/13 20:24
12/01/13 20:24
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
16 ticks equal 1 second, that means when you write

d += time_step; // or better time_frame
if(d >= 16) error("hello");

the error message pops up after 1 second.


"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] #433545
12/01/13 21:02
12/01/13 21:02
Joined: Jan 2006
Posts: 968
EpsiloN Offline OP
User
EpsiloN  Offline 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:
Code:
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! frown


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Encrypt and Client-side movement [Re: Superku] #433555
12/02/13 11:04
12/02/13 11:04
Joined: Jan 2006
Posts: 968
EpsiloN Offline OP
User
EpsiloN  Offline OP
User

Joined: Jan 2006
Posts: 968
I deleted all my client-server code and downloaded Superku's Multiplayer script. Adapted it to my GUI and added rotation, but I just noticed its client authority.

I'll start from scratch again :| Without prediction, to see if the latency produced error in position will be smaller than 18 or even 8 quants (it should be with 7ms lag, at 160 quants/sec.)...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
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 Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Quote:
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 Offline OP
User
EpsiloN  Offline 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. laugh

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...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Re: Encrypt and Client-side movement [Re: EpsiloN] #433577
12/02/13 22:11
12/02/13 22:11
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
How do you plan to make a normal multiplayer game without client side movement? AFAIK all games (including for example CoD) do it this way, the server simply checks the movement for hacks (for instance flying, too fast, ...), approves it and sends it to the other clients.


"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] #433581
12/03/13 05:37
12/03/13 05:37
Joined: Jan 2006
Posts: 968
EpsiloN Offline OP
User
EpsiloN  Offline 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 laugh 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...


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
Page 3 of 4 1 2 3 4

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1