T
T
Triborg-3332020-09-23 20:14:29
JSON
Triborg-333, 2020-09-23 20:14:29

Node js + JSON + WBGL PIXI With 20 connections, the game starts to slow down why?

Hello, Dear programmers!) I recently tested the Web game transferring packets via jSON. The game was created using node js, WebSocket, PIXI - WebGl

Please tell me, do you need Binary protocols to create a MultiPlayer game? for data transfer. To avoid such brakes!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Chernyshev, 2020-10-01
@Triborg-333

In order to understand where the problem is, you need to determine the meaning of the word "slows down".
Suppose the problem is in the speed of transmitting / receiving data from the client to the server. Then you need to find out which characteristic and on which side it affects. From your description, it is clear that the problem is most likely on the server side, since the number of connections affects the speed (but this is not certain).
Now we need to decide which parameter we are working with. Globally, the problem can be in 3 places:
1. The load on the CPU
2. The amount of memory occupied
3. The load on the network.
First of all, I would cut off the 3rd paragraph. Check how much the amount of data that is transferred over the network increases with the increase in the number of players. If the volume grows significantly and the sizes are calculated in megabytes, then this is a problem. If not, then we move on.
If you use any third-party services (DB, API, etc.) on the server side, then check how much the average response time increases depending on the number of users in the session. If the time increases significantly, then the problem is there. If not, then we move on.
We found out that the problem with the load on the processor / memory is present on the server locally. Now you need to profile Node.js and find out which section is causing such loads and only then optimize.
It is far from binary protocols, and it is not a fact that they will be needed. Well, make sure that with the number of players in the session there is no critical increase in the load on the local machines of users.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question