SocketIOClient-Unreal icon indicating copy to clipboard operation
SocketIOClient-Unreal copied to clipboard

Latency

Open jdc711 opened this issue 4 years ago • 5 comments

Right now, I am implementing communucation between two differentunreal projects using a server on (AWS) via socket.io. To replicate movement and location of the players and items(shared in the scene), I pass this data via socketio + server. I am currently running both clients on my computer, and the server is running remotely. Currently, the problem is that there is a latency between communication between the two clients (for client movement, it sometimes takes almost half a second for the other client to see this movement of the other client on their side. Do you have any suggestions / advice on improving latency of my project with socketio? Thanks.

jdc711 avatar Aug 12 '21 16:08 jdc711

Is socket.io normally fast for latency?

jdc711 avatar Aug 12 '21 16:08 jdc711

which plugin version is this? I've personally seen some differences between v2 and v4 socket.io server versions (v1.5.5 plugin vs v1.6, older version seems faster I suspect due to some caching going on). Generally if plugin is used correctly the latency should be similar to a normal TCP pipe (fast).

getnamo avatar Aug 12 '21 18:08 getnamo

Currently I am using the plug in avaiable in the unreal plug in marketplace, and these are the settings for my package.json currently: "name": "socket-chat-example", "version": "0.2.0", "description": "basic chat example server with web client", "dependencies": { "express": "^4.17.1", "socket.io": "^2.4.1" }

Should I change any of these? Please let me know. Thanks

jdc711 avatar Aug 14 '21 19:08 jdc711

Hi GetNamo, Just wanted to check in again. Would there possibly be another configuration of these settings that will work as fast as a TCP pipe? Also, Another thing is that I am sending players' location through event tick. Is this okay practice? Thanks for your help

jdc711 avatar Aug 18 '21 03:08 jdc711

By default that is the case (plugins latency is TCP + processing time). To test this ping on a TCP pipe by start clock -> echo data -> stop clock when data received on both TCP and socket.io connections. You'll see they'll be within roughly 1ms

If you have high latency still, try co locating your server closer to your users.

Sending data on tick and receiving data on game thread will typically cost up to one frame latency extra. At 60fps that's 16ms. This is the correct route for anything dealing with uobjects so something expected.

getnamo avatar Aug 18 '21 03:08 getnamo