Tiled
What it is
A multiplayer tile-map prototype. You create an account, log in and land on a 100 by 100 grid. Left click a tile and your character walks there one tile at a time; right click turns it to face that way. Other players appear on the same map and you watch them move live. Tiles taken by a player show in green, and the map's edge band in red.
How it's built
A C++23 client on SFML 3.1 with Dear ImGui for the login window, and a C++ server using ENet, with accounts stored in MySQL. Both use kazilib, my own C++ library, for packets, scenes and logging.
- Packet families: every packet is a family byte (main, game, unit) followed by an operation byte and its fields: log in, create account, enter game, unit action, spawn and remove.
- The server checks movement: the client sends its action, position and direction; the server moves the unit, rejects a step that does not match where it thinks the player is, marks the tile as taken and broadcasts the new state to the other players.
- Smooth steps: the client moves each unit between tiles over time instead of jumping, so a walk looks continuous while the server stays tile based.
- Accounts: passwords are stored as SHA-256 of a random salt plus the password, and every value going into SQL is escaped. A disconnect frees the player's tile and removes the unit from the other players' maps.
- Browser and Linux: the client compiles to WebAssembly and carries its ENet traffic over a WebSocket to a gateway inside the server, which runs on Linux. One server serves browser and native players in the same game.
Timeline
It grew out of the tileship code from 2021: I worked on it by hand in 2022 and 2023, and in 2026, with AI help, I moved it to SFML 3.1, put the client in the browser and the server on Linux.
Technologies
- C++23
- SFML 3.1
- ENet
- WebAssembly
- WebSocket
- MySQL