Hello,
I'm trying to create my first multiplayer game. It's just a very simple variant of Uno, but I want to add multiplayer functionality to the game. However, I'm having a hard time figuring out how communication between clients should be handled, and who should be handling the game logic. I'm just looking for some advice, as I've got no experience with network programming.
Who should keep track of cards that are on the table, the client or server?
Should the server handle game logic and the clients request an action to be made, or should the clients handle it?
Any advice is appreciated.
DO NOT DEAL WITH THIS MEMBER
Apr 7, 2019 09:45 AM
(This post was last modified: Apr 7, 2019 09:45 AM by SIM-3991524.)
Nice man, my recommendation for a game where multiple player are going to connect is to implement a server that will host the game. Then your game clients can connect. Will hide player IPs and make it harder to cheat
Lmk if you want more detail
(Apr 7, 2019 09:45 AM)SIM-3991524 Wrote: Nice man, my recommendation for a game where multiple player are going to connect is to implement a server that will host the game. Then your game clients can connect. Will hide player IPs and make it harder to cheat
Lmk if you want more detail I'd love more details.
The thing is, I haven't figured out who should be in charge of what. What should the client do, and what should the server do to keep the game running?
Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
DO NOT DEAL WITH THIS MEMBER
(Apr 7, 2019 10:01 AM)Tenno Wrote: I'd love more details.
The thing is, I haven't figured out who should be in charge of what. What should the client do, and what should the server do to keep the game running?
Create a server that is always listening. once >2 clients agree to start the game. Game starts, no new clients can join. Server keeps track of who has what cards, which players turn it is. Server tells all client which cards they are dealt, keeping other players cards private ofc. Tell all clients who's turn it is. Only let that player submit a card they put down. Server then says who is next... process continues. Server also has to notify all clients of which card is on the top of the pile.
Basic idea is make the server do all the logic. Make the clients just a UI and webrequest
(Apr 7, 2019 10:36 AM)HFDone Wrote: https://netty.io
also you can check https://github.com/topics/game-server?l=java Thank you. I'll be looking at the differen repo's and see how they've done it.
(Apr 7, 2019 10:37 AM)SIM-3991524 Wrote: Create a server that is always listening. once >2 clients agree to start the game. Game starts, no new clients can join. Server keeps track of who has what cards, which players turn it is. Server tells all client which cards they are dealt, keeping other players cards private ofc. Tell all clients who's turn it is. Only let that player submit a card they put down. Server then says who is next... process continues. Server also has to notify all clients of which card is on the top of the pile.
Basic idea is make the server do all the logic. Make the clients just a UI and webrequest How would the server notify players, and how would players receive the notifcations?
Also, the server would need to use multiple threads to handle all connections and requests, right?
DO NOT DEAL WITH THIS MEMBER
(Apr 7, 2019 11:22 AM)Tenno Wrote: How would the server notify players, and how would players receive the notifcations?
Also, the server would need to use multiple threads to handle all connections and requests, right?
Google "Creating a Simple Java TCP/IP Server and Client Socket"
And yes, I personally would have the server create a new thread for every client
(Apr 7, 2019 11:36 AM)SIM-3991524 Wrote: Google "Creating a Simple Java TCP/IP Server and Client Socket"
And yes, I personally would have the server create a new thread for every client
Really appreciate the help. I'll start making a prototype.
|