Answer the question
In order to leave comments, you need to log in
What architectural approaches to choose for developing a client-server game?
Good day. I'm trying to understand a little about the implementation of the client-server architecture and there was a misunderstanding of some basic things, I would like to ask the opinion of more experienced developers. It is difficult for me to get out of at least some familiar rut, I have no idea where to start.
Game model
Close to games like Elite/Space Rangers/X. There is a conditional two-dimensional space, in which objects (stars, planets, ships, etc.) exist and interact. Realtime, but "slow", like strategies from Paradox.
The general structure of the world is quite simple, there is no division into zones, i.e. for the most part, the world is the totality of all objects and the relationships between them.
What am I trying to get
Answer the question
In order to leave comments, you need to log in
1) Divide the world into "chunks", i.e. just squares of a certain size. In the case of 2d, this will be very convenient.
2) The server processes only those chunks in which the players are located, in the absence of a player in it, then it is saved to the screw\bd. On the client, chunks are also unloaded from memory if they go into a new chunk.
3) You will need a system to predict which chunk should be loaded. Let's say knowing the direction of the player, we assume that he will fall into such and such a chunk, which means we load it in advance.
4) When approaching a chunk, send the player its full state, and after that only what changes in it.
5) Part of the calculations for linear (predictable) objects can only be synchronized periodically. For example, a flying asteroid is logically calculated both on the client and on the server, but only in the event of events (collision, for example) there is synchronization between the client-server.
On a note, the more linear (i.e. predictable) objects, the less you can synchronize them. In addition, this will immediately give a bonus in the form of a fairly simple implementation of interpolation and extrapolation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question