Answer the question
In order to leave comments, you need to log in
What would you recommend for writing a server for a multiplayer 3d game on Unity?
Good day!)
I plan to make a simple multiplayer 3d shooter on Unity, actually from here the question arises:
How to write a server (I will write in C #) I have very little experience in developing client-server applications, only multi-threaded chat (TCP), and I have practically no idea how to implement the interaction of players with the server.
What will need to be synchronized:
1) The position of the player in space, his rotation and tilt of the weapon.
2) Change weapons.
3) Shooting (synchronization of bullet spawn point).
4) Chat (in principle, it is not necessary, if I can do the first 3 points, then I think there will be no problems with the chat).
My idea of how to implement this:
1) Each player, of course, has his own stream.
2) The server must check for correctness before sending out user actions (anti-cheat, so to speak).
When a player connects to the server, the first thing he will have to send is his ID (for example, the name of the gameobject in Unity) in the game room, and the first message he will receive is the positions of other players. Next, you need to somehow transfer the new position of the player along with the turn (this does not seem to cause problems, you can send 1 message "position / turn / tilt"), but what if the player turns and shoots on the go, this is also sent 1 message after parsing commands and send them for verification, if they are correct send to other players otherwise give a warning to the player and kick after 3 ex?
How are you?
I would like to read something on the implementation of servers for shooters or similar games, source codes or documentation (in any language, not necessarily in C #), I have already read the theory, but there are still doubts about the implementation of the server.
PS I know that there is UNet, etc. but I'm writing my own server for the sake of interest and experience)
PPS Thanks to everyone for everything ;)
Answer the question
In order to leave comments, you need to log in
Latency:
1. client-side prediction server reconciliation (Main article)
2. client-side prediction (live demo!)
3. Latency Compensating Methods (Valve wiki)
4. www.newspeakblog.com/lag-compensation-techniques-g. ..
1. Anti-cheat (Valve wiki)
2. Hacking in Games (PDF)
You need to take into account the corridors of possible movement along with the speed limit in order to get the time and compare it with the allowable one.
Valid, determined through a trained NN on several random player movements from one point position to random sides (and at different angles, if it is 3D) with different parameters (ground, gravity, jump, walking/running, etc.) between adjacent positions for one game frame ("tic").
And as soon as the player scores N-penalty points (3-5 is enough), the cheat is fixed.
1. socketo.me (Ratchet - WebSockets for PHP)
2. https://heroiclabs.com/ And
as always, BONUS: read here .
Thanks guys for all your advice. I already have an idea in writing a server, I also read that using tcp in action games has a very bad effect on ping, so I'm sitting studying udp which is better suited for this.
Recently I was interested in the question. I came to the conclusion that the simplest approach that gives a relatively good result is to use the Photon Unity Network service. The service takes care of communication, synchronization, matchmaking and choosing the fastest and closest regional master server to the player. Up to 20 online is provided for free - enough for development and testing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question