Multiplayer bandwith

punpun

Green Slime
Ping howers around 40ms in the lobby but once ingame it eats all of my 512kbit internet and throws me into the main menu so right now kind of unplayable.
I'm curious, what is the usual traffic with this game and are there any plans to improve the netcode? This game looks so cool and I really wanted to play this with 3 of my friends so I bought myself into the beta to see the currents state of the game.

Other than the multiplayer issue the game looked really great(for the 20 minutes I had time to test anyway) so keep it up.
 

ark626

Moderator
Not sure why this happens? Lol as for me the bottleneck is ALWAYS the Host/upload side.
Which means if you are hosting a Multiplayergame for 3 other people then your DSL should better be damn good.
What also is to say that you have to update each tick in the game for everything. (meaning every other players graphics every enemies graphics the life vars etc.
Simple example, you are host and you have 1 k/bytes upload and 3 Clients are connected.
On your map are 3 Enemies.

Each entity has 2 Variables for the coordinates (16 bit*2)
Each entity has 4 Variables for HP/MAXHP EP/MAXEP (8bits*4)
Each entity has 1 Variable for the Grahpic number which is showing and the animation state (16bit+8bit)

=> For each entity you have to calculate 88 bit per tick. (and thats just the basic of the basic information needs to be updated)
The game runs at 60 FPS so per second 60 Updates meaning (88 bit * amount of entities*60)= k/bytes which a client needs.

Now comes the tricky part if you have 3 Clients then you have to multiply by 3 => 88bit*amount of entities*60*3=k/bytes

On our map are 3 enemies we have 3 clients and therefore summed up 7 Entities. And we divide by 8 for getting bytes not bits and divide by 1000 for getting k/bytes not bytes
=>
88 bit *7Entities*60Frames*3Clients/8/1000 = 13,860 k/bytes = 0,01386 M/bytes

So as you can see even trough this small data which has to be transfered the host is the bottleneck because the Upload on normal internet accesses is very much smaller than the download.


I once wrote for this problem a feature which only let the host update entities that are in range of twice the screen of ANY Player (only NPCs and enemies are updatet which can be seen by a player)
This saved a lot of bandwith for the host but i think teddy already implemented such a thing and more tricks.
 

Teddy

Developer
Staff member
As ark626 mentioned, the person with the highest upload speed should always host to prevent package delays and/or loss. It's also true that the throughput varies with how many entities are active, but these updates are only sent 30 times per second. However, many messages are sent on an event basis as soon as they happen (like if a client wants to swing the sword).

I'm a bit wary of trying to further optimize the networking. It's certainly possible if I set my mind to it, but the base networking has finally reached a point of decent stability and since most connections can handle the game just fine I don't want to risk breaking functionality for a slight decrease in server upload pressure.
 

MrChocodemon

Handsome Moderator
MrChocodemon said:
graphics get updated at 60FPS but the other players and actions only at 30 FPS
ark626 said:
Yeah that wouldn't work cause those are asynchronous network events, so each tick everything is updated
It's also true that the throughput varies with how many entities are active, but these updates are only sent 30 times per second. However, many messages are sent on an event basis as soon as they happen (like if a client wants to swing the sword).

So it's a bit of both
 

PQED

Green Slime
I made a bug report regarding the issues we've faced with multiplayer here: http://secretsofgrindea.com/forum/index.php?threads/gameplay-fishing-bug.135/#post-1390

If ark626's calculations are correct, I find it curious that the upload speed of my connection (0,87Mbit/s) is insufficient for more than 1 client.
Everything seems fine for the first 1 or 2 minutes, then the issues start cropping up to the point where my entire connection just drops. Almost seems like an overflow issue of sorts.
 

ark626

Moderator
Okay the HOST sends each tick the client receives each tick
The client only sends if you do sth like press x or so :D
>Can you make a video where grindea is windowed and we can see the network traffic?
 

PQED

Green Slime
I'm not able to do that right now, but from what i observed the upload hovered around 25kB/s total (3-way skype call included), until the spike occurred.
 
Top