I'm making a 4K game, and it's gonna be multiplayer. I need a very simple, effecient and very slim code doing the client/server functionality.
Since I've never done any game networking, I'm wondering if it was a good way to start by looking at some existing games doing the same?
My idea is somewhat like this:
A# Joining a game
1. Client connects to server > Server accepts
2. Client requests map ID -> Server sends map ID -> Client generates map
3. Client requests current game state status (list of players and their score, gametime etc.) -> Server sends state
B# When done joining the game, the following is repeated continiously
1. Client tells server where he is located (x,y) -> Server mediates to all clients
2. Server sends info on state of all players.
3. Repeat B#1
C# In case of some events performed by either the client or server.
1. Server sends end-game-signal to all players after X time -> Client displays scores list for few seconds and Server resets itself and finds a new map ID -> Client can reconnect again, if he does -> Start A#1
2. Player fires his rocket -> Client sends rocket location to server -> Server sends location of rocket to all clients -> Enemy clients determine if they are hit, if so -> Enemy client subtracts health from himself (or destroys himself if low on health) -> Notify server of change -> Server updates game state info.
Something like that.