Networking: Very low FPS when connected to remote Server

Hello community,

me and a friend made a small test for my multiplayer game. We noticed that the one who connects to the server has very low FPS, I have around 2-3 FPS, he got around 21 FPS. The one who is hosting the game runs the game at 60 FPS though. If client and server runs on the same machine it works fine.

We made some online games before and it always worked.

That’s the first time I use Zay-Es Net, so it might be that requests are sent all the time which causes this low FPS… I don’t really know…

Does someone has an idea what could be the cause here?

If you need more information, please ask.

Regards
Domenic

1 Like

Maybe you are updating components every frame?

I’ve put together a full networking example using Zay-ES and SimEthereal. At the very least, you can try it to see if it exhibits the same issues.

There is more to efficiently networking a game than just blasting out position updates 60 times per second. Unfortunately.

1 Like

Hi @pspeed, I send update 10 times a second. Components might be updated more often than 10 times though…

Even if the player completely stands still and does nothing, nothing is updated (there are no dynamic objects yet) and still I get 2 fps.

I’ll try your example later when my friend has got time.

Still… Pretty annoying…

1 Like

Then that tends to indicate that your client is doing something like EntityData.getComponent() directly instead of using an Entity or WatchedEntity.

Every EntityData.getComponent() call implies a round trip synchronous call to the server.

3 Likes

Okay, I am going to check that! Thanks for the hint :kissing_heart:

I had a look and my client never calls something like EntityData.getComponent().

However, me and another friend tried it again and this time for some reason it worked just fine (he got 1000+ frames). We didn’t need to change anything. It just worked. Maybe something was wrong with my pc or the one of my friend.

Nevertheless, thanks for your help @pspeed! If we know what was causing this massive lag we’re going to post it here.

Have a good day
Domenic

1 Like

Maybe you had a situation where the server does throw exception several times a second. This happened to me once and the server was not able to recover, it was some connectivity errors. But I sadly did not store those logs away :frowning:
I’ll post it here if it happens again. In my case as well the FPS dropped extremely. And similar to you the client which caused the exceptions was on a physically different machine. The client on the same host like the server was not affected that dramatically but also had lags…
Throwing exceptions is expensive, so throwing a lot is a very bad situation. The exception (I can not find it in the code, so it is maybe on the ethereal side, I don’t know, stated something like “something really bad is happening”.

EDIT: After the client did a disconnect and then join again, the situation was solved.

1 Like

Okay, interesting. For us reconnecting did not work, unfortunately. However, it does seem to work now!

1 Like

Yes same for me, it works now, but the fact that this can happen is a reason to reproduce it to find the root cause. And I’m now not 100% sure anymore if we only did reconnect the client which caused the issue or also did re-create the server.

1 Like

Tools like Java Mission Control or Java VisualVM are very helpful when trying to find what are the lag spots in the software.

3 Likes

Whenever freaky wierd stuff i cant explain happens, a rebuild or restart IDE/OS usually solves it. It does happen from time to time. Nature of the beast, i guess…

1 Like

I had this same problem, in my case it was because of EnitytData.getComponent() calls. Use entitysets on the client, don’t interact with EntityData directly.

Mithrin

1 Like

And for looking at a single entity (like the player) that often has to happen on the client, then use the WatchedEntity. It’s like an entity set of one.

1 Like