Is it right to use Web sockets with PHP to online games on unity?
There is an idea to write a web socket server like chat in php only instead of messages to transmit the coordinates of players and their status (dead, alive, wounded, etc). Is it right? Are there any other solutions to this problem?
joshuah_Bartoletti answered on April 4th 20 at 00:42
What is the game? What's the point? What genre? No specifics.
If it is a simple game, where sync with the server several times per second - Yes, you can. Only such a server will not pull a lot of players (depending on the architecture, technologies, DBMS)
If it is a shooter, as you describe it is better not to use PHP.
In these problems it is best to consult a C++/C#, can be node.js
In some cases Python.
But the old languages for these cases is a C++ and C#. You write in Unity. So you know C#. So write in C#. If the load due to complex calculations not - then C# will do. For example, if you don't have super-duper anti-cheat with AI. Within session data store directly in RAM. With regards to the database then take the Postgresql or Mysql.
Heber_Crooks27 answered on April 4th 20 at 00:44
Yes, actions do. The server can send about 20 snapshots of the game state to the client, that is, approximately every 50 milliseconds. The image jerked to the representation of game state will mix back in time, say 50 milliseconds, and the client thus has the ability to interpolate movement of players and animations between the current and previous state. Accordingly, the server needs to calculate the user's input in the past given that the offset of 50 milliseconds, given the time on the journey of the packet from the client to the server and maybe something else to do the shooting or waving a sword as accurate as possible.
For step-by-step game is redundant. There is enough just to send the new status from the server in response to a user input.
Another question is whether to use websocket php, when as far as I know unity now provides the ability to organize multiplayer.