Need explaination how multiplayer works

Post your help queries and engine programming questions here

Need explaination how multiplayer works

Postby aterkotoc » Fri Jun 27, 2014 12:20 pm

Hello i ripped some part of engine huh :lol: and made simple example with linear interpolation: http://jsfiddle.net/Pvs5r/
Really i'am trying to build a multiplayer pure-html5 game.
Works not bad, but i have questions.

1) Why do we need to render in past time -100ms from now. Cause that smooth entities movement?

2) Do i need to render all world in past time, or just entities which is NOT created locally (example my character).
How i'am think i need to render all NOT locally created entities in past time, and do direct input on locally created entities+send inputs to server.
Then when server receive inputs, he apply inputs on snapshot at time Now - (PING / 2) - InterpolationDelay;

3) Do i need to make code render entities just in past or just interpolate them to Now time?
I think if we try to interpolate them to now, they may bounce cause example entity change direction.

4) Nothing can travel faster than light, cause that we have ping, so we can delivery commands from client to server immedatelly without delay.
So question is: in games based on source engine, all clients at MOMENT NOW see similar world with small difference or they just render in past time and server deals with it? I Mean move players back using world snapshots in past time to register bullet hit e.t.c

Thanks, can wait for a reply.
aterkotoc
 
Posts: 2
Joined: Fri Jun 27, 2014 12:04 pm

Re: Need explaination how multiplayer works

Postby robaldred » Fri Jun 27, 2014 2:49 pm

Hello, Im going to answer by just explaining, render latency and why it's necessary.
This delay is called render latency or interpolation delay, it's fairly complicated and often only present in complex game engines. where you want a high degree of accuracy with synced entities.

This exists for a single reason, and the length of the delay should be adjusted with your update rate or send interval.

The interpolation delay acts as a buffer, so we can queue up entity movement before we render, we need at least two points in order to interpolate, without two points, movement will stutter, essentially a buffer underrun.
Having enough data means we can smoothly transition the player movement between the two points exactly as it should be at the exact render time.

By default the engine uses a sendInterval of 50ms, equivalent to 20 times per second or 20hz
The default render latency is 100ms, so we're always rendering 100ms in the past, this should ensure that we always have at least 2 instances of data from the server about an entity.

In your forth point you're referring to lag compensation. IGE does not have lag compensation, therefore there will always be a delay between input and display.
Lag complication is extremely complicated and requires the server to store a history of world entities so that it can essentially rewind time to check collisions. I addition to lag compensations you'd need client side prediction so that when you move on your client, you move instantly, rather than purely from the server stream data.

The client side input would need to be interpolated along with the stream data, so that the position is correctly adjusted when the true position data is retrieved from the server.
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: Need explaination how multiplayer works

Postby aterkotoc » Fri Jun 27, 2014 4:46 pm

So if i'am right do not need to interpolate other players positions on client to their estimate positions in NOW Moment, just render them in past time and that will be ok?
Then when player send commands to server, execute them on snapshot with timestamp calculated by formula:
Command Execution Time = Current Server Time - Packet Latency - Client View Interpolation


Here is screenshot from teeworlds game:
Image
And from my example:
Image

If i'am correctly understand we do same?

P.S to see this
Run game, join to server, and F1 -> debug 1
aterkotoc
 
Posts: 2
Joined: Fri Jun 27, 2014 12:04 pm

Re: Need explaination how multiplayer works

Postby robaldred » Fri Jun 27, 2014 6:03 pm

You dont need to do anything IGE does all the work.
Create the player entities on the server and everything will be sync to all connected clients.

If you want client side input prediction, you also need to implement server side lag compensation aswell because the client will see his/her movement infront of the render time, so the server will need to reverse time so the server can calculate roughly what the client was aiming at.

It's very complicated and resource intensive.
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England


Return to Help & Questions

Who is online

Users browsing this forum: No registered users and 1 guest
cron