File tree Expand file tree Collapse file tree 3 files changed +15
-36
lines changed
UnityWebSocketClient/Assets/Scripts Expand file tree Collapse file tree 3 files changed +15
-36
lines changed Original file line number Diff line number Diff line change 11
2- TODO:
3- X add web socket client to game
4- X add web socket server to server
5- X POC communication
6- X decide how to model the game state
7- X move game-client websocket handling to scene manager
8- X implement game-client handling of game-server messages
9- X fix bugs
10- X poc syncing game state for players to see each others positions
11- X refactor golang game-server to properly manage multiple websocket
12- connections
13- X add shared resource mutex to python server global game state updates
14- X refactor golang server to use channels instead of mutexes
15- X fix go-server bug where newly connected clients aren't initialized with
16- the server game state properly (player value was nil in some cases)
17-
2+ Message Schema:
3+ {
4+ messageType: <string>,
5+ payload_key <string>: payload_value <any>
6+ }
187
198Game State Schema:
209{
21- players: [
22- {
23- id: <UUID_str>
24- position: {
25- x: <float>,
26- y: <float>
27- }
28- }, ...
29- ]
10+ players: [<Player>, ...]
3011}
3112
32-
33- Message Schema:
13+ Player Schema:
3414{
35- messageType: <string>,
36- payload_key <string>: payload_value <any>
15+ id: <UUID_str>,
16+ position: {
17+ x: <float>,
18+ y: <float>
19+ }
3720}
Original file line number Diff line number Diff line change 33POC for a Unity game client and game server with websockets!
44
55There are 2 implementations of the game server. One in Python and one in
6- Golang. Their APIs are identical.
6+ Golang. The APIs for both servers are identical.
77
88
99### Requirements
@@ -65,4 +65,6 @@ The entire game-server's code resides in:
6565The game-client's websocket management resides in:
6666` UnityWebSocketClient/Assets/Scripts/SceneManagerScript.cs `
6767
68+ The Golang game server's architecture is inspired by [ this] ( https://github.com/gorilla/websocket/tree/master/examples/chat ) chat example.
69+
6870Enjoy!
Original file line number Diff line number Diff line change @@ -27,9 +27,3 @@ public ClientMessagePlayerUpdate(Player playerModel)
2727 }
2828
2929}
30-
31- [ Serializable ]
32- public class ClientMessageGetGameState
33- {
34- public string messageType = "CLIENT_MESSAGE_TYPE_GET_GAME_STATE" ;
35- }
You can’t perform that action at this time.
0 commit comments