Pivity

Weird lua behaviour

Last read Never
#1

Hey guys, I could use your experience with an issue I have.

I've been developing a rather big gamemode in the last few months (actually about 8 months now), with aim on modularity, with its own admin system, anti-cheat, networking and HUD, along with modellers and mappers working on custom content. Recently my team decided that the project was ready for an alpha phase, because during testing everything went smooth, and even with verbose logging, nothing had shown that things are not working properly.

We also have a tester team. Now here is the issue: whenever I get more than 3-4 players on the server, the dreaded unspecified behavior happens: the playerdata, holding critical information about players sometimes doesn't arrive on certain clients. If we have around 5 players on the server, usually there will be 3 people who have at least 1 player who is 'unloaded' for their client, and that person can vary. Moreover, some people seem to be affected more than others. I've literally spent about a month implementing 3 different types of database and playerdata systems, and so far I'm assuming it has something to do with networking, because the serverside lua is usually working right - and at this point I'm all out of ideas.

Naturally, you'd ask for the scripts dealing with networking, but it's complicated and I am also unable to do that sadly. However, this is how I designed server->network synchronization.

>Player arrives and tells the server it's ready (fully joined and in-game)
>>Server sends all information to all current clients in big chunks
>>Server sends all clients' information to new player in big chunks
>Player reads their own and other player's data
>>Server sends info about clients' changes in small chunks

So again, everything is working smoothly unless about 5 people join, after which it gets exponentially worse, with more and more players reporting issues. The exact problem is that it appears that sometimes, almost no networking takes place between the server and client, even though they should sync, and you can be bloody sure that I've put no conditions that would stop it from happening.

TL;DR: I need help from people who have experienced unspecified behavior when it comes to networking with more than a few players.


Basically if anyone has some experience with this, has ideas on what to look at or has some cool redundancy check designs or something along those lines that could help my situation, please share your thoughts with me. Any help will be much, much appreciated!

#2

How are you sending the data in "chunks"? What are you using to verify that the player is "ready" to receive data?

#3

I build a panel on the client the first time setupmove is called, and once the player presses the start button it sends a bit packet to the server saying it's ready.

By big chunks I mean a complete set of the data, a table with string keys and some subtables. Small chunks are just the key value pairs.


I know sending data as a big table is a bit lazy, but you don't reckon that's the culprit, do you? I mean I assume net.WriteTable just seperates the values and writes key/value pairs on their own with a type overhead - it's not like it's transforming the data to json or something

Also, thanks for replying.

#4

If you are sending too large tables, the net messages might be dropped. net.WriteTable has a 64kb buffer.

Disagree x 1
#5

I don't think I reach that. If I did, it would fail silently, or send a corrupted table?

#6

In my experience, that happens often. Do you really need net.WriteTable? You should use it only if you are sending small tables.

#7

I'm using it for tables with small values but lots of keys once (1*players/client) on start. Around 21 string keys as IDs with about 600 bytes of data on each value.

I made a compressed networking alternative a while ago, and in my experience if I send alot of 50-60 kb packets right after eachother, it doesn't cause issues. So I'm assuming that sending alot of medium sized network messages simultaneously is not a problem. At any rate, thank you for your help man.

Users viewing this thread
Nobody