- Home /
Turn-based small scale multiplayer: server-only-logic possible?
Hello everybody. Iam currently developing the offline version of a small turn-based game and want to "scan ahead" for the following:
The number of players will be 2, maybe 4-8 later on, turn mode is we-go (choose action, executed for everybody at the same time)
Is the following process possible, advisable performancewise, and do you know any middleware which would make the task easier?
Client chooses his actions (Move from x to y, Shoot at z), which are not executed yet.
Client sends his desired actions (as a struct for instance) to the server.
The Server receives actions from all active players and calculates the outcome.
The actual outcome data is transmitted back to the client (same data for everybody) and displayed as action (As if every client would watch a movie)
This is feasible (I've made such a system before), the question is really how fast your server and link will be. Do you care if a couple of instructions are lost if it will grant you better performance (the TCP vs. UDP argument)?
Yes I do care :)
From what ive researched so far I am planning to use TCP, because speed doenst matter (within limits), although I would have to make sure, that both (or all) players saw the action of the last round before commiting their next turn ($$anonymous$$eep turns roughly in sync)
Answer by Thejon · May 06, 2016 at 03:01 PM
I recently completed a small 5-part tutorial to make a turn-based Tic Tac Toe game with Unity's networking service. It uses a sort of round trip from Commands to Client RPC calls which would allow you to get what you want. Here's a link: https://theliquidfire.wordpress.com/2016/05/05/turn-based-multiplayer-part-1/
Answer by ankush_Kushwaha · Feb 09, 2014 at 03:04 PM
Try this. It can help you. It uses unity's own networking system.
Hey, thanks for the link, ive quickly checked it out. While this is really useful network information, it doenst really fit the question how to make the clients basically send orders to the server and getting information for rendering back.
You ca use Photon server to make your multiplayer to send and retrieve response. I have used it and it worked for me
Your answer
![](https://koobas.hobune.stream/wayback/20220613133007im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity networking tutorial? 6 Answers
Authoritative server strategy 0 Answers
Authoritative vs Non-authoritative server (turn-based) 0 Answers
Can a person be both a client and a server? (and more) 0 Answers
Creating servers properly? 0 Answers