A
A
Anubis2018-10-01 12:24:21
Node.js
Anubis, 2018-10-01 12:24:21

How to implement a realtime game server?

I have some experience in non-realtime browser based multiplayer games in the past (php & flash), behind a couple of small single player games for mobile phones implemented in Unity, recently mastered node.js.
And now I really want to create a real-time multiplayer toy. Something roomy for a small number of players in one place, with a top view like in Diablo, tap-to-move movement, close-range attacks, archery / crossbow / etc and casting magic attacks that can fly along a given trajectory, reacting to collisions on the way, or activated immediately at a given point, applying damage in a given radius. Also, the calculation of physics will be needed to prevent the characters from moving to one point, i.e. they must have some dimensions, thanks to which they must be kept at some distance from each other.
That is, the implementation of basic physics in real time is necessary. Most likely, 2d physics on a flat map will be enough. And a lot of questions:

  • Synchronization, movements, physics and animation between clients and server
  • Pathfinding when calculating the trajectory of movement to the target point, bypassing obstacles
  • Websockets or udp? Should players be required to connect via wi-fi, or should they be allowed to play over a cellular connection?

I would like to implement the server part on the node due to the fact that I am already familiar with the platform (input-output, working with the database, good performance). Are there any suitable off-the-shelf implementations to build on? If not, I would also be grateful for links to a description of the algorithms for implementing the necessary functionality. I would like not to use paid implementations like Photon, so as not to get tied up in paying for services.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anubis, 2018-10-02
@Anubis

As a result, I look towards various implementations of Photon: PUN, Bolt, Quantum. It seems that the best way to sync between players is to use one of these services, which takes care of all the issues of synchronization and accounting for network delays. And on your server, implement the initialization of the player's state when loading the game and issues of his pumping and inventory.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question