Teardown
Multiplayer
A multiplayer modification for Teardown, a game originally released without multiplayer. I led networking and the Lua Modding API.
The idea
I liked Teardown's physics and destruction and thought it would be cool if the game had multiplayer. I could not find a real implementation, so I made a small prototype. It worked. Later I found another team working on the same idea, joined them, and eventually became the team's lead developer.
Architecture
TDMP used a P2P model with one player acting as the host. Clients sent actions and state to the host; the host processed them and broadcast the result to the other players.
CLIENT B ──┼──→ HOST ──→ OTHER CLIENTS
CLIENT C ──┘
Examples: position, input, interaction requests, item IDs and spawned objects.
What I worked on
I handled the backend, server creation, connection flow, world/player/object/weapon synchronization and the project's Lua Modding API. The API exposed functionality that was not available through the normal modding interface.
Physics
Teardown's physics are non-deterministic, so physics state could not simply be recreated independently on every client. We transmitted the relevant state through the network instead.
Reverse engineering
Another team member did most of the reverse engineering, but I also worked directly with the game's internals. I reverse-engineered methods and class structures around functionality such as Entity→SetTransform, Destroy and Paint, and used that knowledge to extend the modding API.
Keeping it alive
Game updates required us to reverse-engineer changed parts again and update function references and class offsets. Crashes were another major problem. Reproducing them, debugging threads, using mutexes and checking object validity solved most of the recurring issues.
Looking back
With what I know now, I would redesign object replication and add network prediction for player shooting to compensate for latency.