gamedev / mmo

Go + C++ MMO

The start of a multiplayer game with the server in Go and the client in C++, talking in a binary protocol I designed.

Built with
Go (server), C++ and SFML (client)
When
December 2023 to January 2024
Source
mmo_server and mmo_client

What it is

My third game server, this time in Go, where every connection gets its own goroutine. This project is the networking foundation: a server that accepts clients over TCP, a connection manager that tracks them, and a client that draws a window with SFML and speaks the same protocol.

The protocol

Every packet is a fixed 1024 bytes with a small header in front of the payload:

 bytes   0-3        4-19         20-21       22-23            24 ...
       ┌─────────┬────────────┬───────────┬────────────────┬──────────┐
       │ version │ client key │ packet id │ payload length │ payload  │
       └─────────┴────────────┴───────────┴────────────────┴──────────┘

The server console

The server has its own command line for whoever is running it:

connections                    list connected clients
kick <id>                      disconnect a client
message <id> <text>            send a client a message

Server source Client source Back to game development