Mosaic
M O S A I C
In this collaborative multiplayer game you move fragments around to form images. Try and form the prompts without any form of communication to other players!
Vote once you feel happy with the result. If enough players vote you will proceed to the next prompt.
Controls
Action | Keyboard | Controller |
---|---|---|
Move | WASD / Arrow Keys | Left Joystick |
Interact | E / Space Bar | A / B / X |
Vote | F / Control | RB / R1 |
Pause | Escape | Start / Options / + |
Technical Info
This game has no gameplay server. The only server involved is a small (python) signalling server to initialise the peer-to-peer connections. The peers then form a mesh network via WebRTC.
The game state exists only in the clients. When someone starts the game, the game will check if there are already other peers. If there are, it requests the game state from the peers. If there is no one else yet then it creates a completely new game. Since the game state only exists in the clients, the state simply vanishes once the last person closes the game.
Each client has authority over itself. When a client wants to pick up a fragment it needs to ask the other peers if this is a valid action. This only succeeds when more than 50% of the peers validate the request. This way the clients dynamically determine authority over individual fragments.
This is a proof of concept for me, so please don't expect the mesh to be particularly stable. In case of problems try restarting the game.
Source Code
You can find the source code on github. It's available under the MIT License.
Client: github.com/winston-yallow/mosaic-client
Server: github.com/winston-yallow/mosaic-server
Credits
GAMEPLAY & VISUALS
Winston Yallow
AUDIO
Kenney (CC0 License)
FONT
Poppins (OFL)
Status | Prototype |
Platforms | HTML5, Windows, macOS, Linux |
Rating | Rated 3.0 out of 5 stars (1 total ratings) |
Author | Winston |
Made with | Godot |
Tags | 2D, Multiplayer |
Average session | A few minutes |
Languages | English |
Inputs | Keyboard, Gamepad (any) |
Multiplayer | Server-based networked multiplayer, Ad-hoc networked multiplayer |
Links | Source code, Source code |
Install instructions
Extract the zip file in a new directory. It contains the executable and a few other files. Run the executable to start the game.
Comments
Log in with itch.io to leave a comment.
I can't play this and I don't think I can connect other pairs.
[outdated information] I'm sorry, the signalling server to find other peers is currently offline due to restructuring my kubernetes cluster. I plan to restore it eventually, but I should probably add a note to the game page until then.
Update: server issues are fixed for now, so it should be playable again.
Interesting networking setup, did it worked well? As I understand main traffic was between clients, and little server was only to coordinate connections between. Will users have global IP to connect each other?
It worked surprisingly well, considering I put this together in only 48h (only thing missing is reconnecting in case a peer connection breaks).
You understood correctly, peers connect directly to each other. The small signalling server is only used to "discover" the other peers and exchange connections information. WebRTC uses STUN/TURN in order to connect.
STUN basically does "hole punching" to traverse through NATs to a target device. Basically a local device can connect to a STUN server to create a hole and be available from the outside (think of it kinda like an automatic port-forwarding of a router).
If that fails, WebRTC will fall back to TURN. This is basically a relay server that clients can use in case that STUN failed for their particular network setup. This does introduce slightly more latency as a direct connection, but it still is super fast as packets can be basically relayed 1:1 without any overhead.
Regarding global IPs: With the context from above, yes, it uses the public IP in the case of STUN being successfull. Otherwise the traffic goes to the TURN server first before being forwarded.
Thanks for detailed answer! Also I find a page in Godot docs about it https://docs.godotengine.org/en/stable/tutorials/networking/webrtc.html. It's really great that Godot supports such things out of the box!
If you want to find out a bit more about the mesh network, I wrote a small twitter thread about it: https://twitter.com/WinstonYallow/status/1435180419717210112
lovely game! really fun to play. i might be a little bit addicted :p the controls are super smooth (i'd LOVE a top-down game with this character) and holding the piece is so cute!
it's almost meditative. i took every green and pink piece on the board and made this :) color palette is super cool too!
Thank you so much!