How not to lose your body parts in a networked game

Antegods is an action-packed arena game in which two teams of four players each control customizable stonepunk mechs to hunt for energy and fight off opponents in a highly destructible map. The ultimate goal is to activate enormous ‘titan’ statues that will bring explosive mayhem down upon the enemy team.


An important Antegods feature is the players’ character (mech) customization. Instead of having predefined mechs, players define their own playstyle. A mech consists of three gameplay-defining parts: body, weapon, and jetwings. Equipping a Wolf body with Nimble jetwings results in a different playstyle than equipping it with Rusher wings.

Our initial technical implementation was flawed, because it was inflexible and caused desynchronization issues when creating a mech over the network. We had three separate parts, but they were tightly connected and did not allow for wings to vary in size or particle effects.

These are serious issues for an online multiplayer game like Antegods, so we decided to rework this system. We had two requirements:

  1. Our artists can model separate mech parts that look visually connected when combined
  2. Our game designer can define gameplay variables for each body part that can affect the other parts without a tight coupling.


We approached the problem by defining a structure for a mech within Unity:

A mech always consists of the base mech object (BaseTotem in the example), which includes the gameplay code and the capsule collision object. Directly below that is the body object (WolfTotem in the example). This game object has the following children: Mesh, Rig, Wings and GunPivot.

The body object includes a component storing specific data that the base mech requires, such as the health, shield and movement values. It also contains size data for the collision model, because for example the Chameleon is smaller than the Rhino.

The Mesh and Rig objects contain the 3D model and animations for the body. The Wings & GunPivot objects are used to place the gun and the wings on the correct position of the body. Wings can have different attachment locations per body (LFast, LSlow, LMedium, etc.), each of which has its own scale factor. Wings also define the dash ability and general movement speed of the mech.

The GunPivot object is an empty game object used only to correctly place the gun on the body.  

As you can see the wings now change their scale depending on the body they are attached to.


We’ve now accomplished our requirements. Firstly the hierarchy of components and objects creates a flexible system for the artist that is also very predictable for a programmer. The second requirement is fulfilled when creating the mech: each part contains gameplay data that can be transferred to the other parts. As mentioned earlier, here we set the correct collision, speed, shield and health stats.

Because of the predictable system, it’s very easy to synchronize mech creation. For each mech we only have to send a small message (the parts the mech consists of), instead of all the separate information (Unity gameobject information and gameplay variables).

Niels Uiterwijk
Niels Uiterwijk
Lead Programmer for Codeglue, currently working on Antegods, have worked on Awesomenauts, Rocket Riot, ibb & obb and Swords and Soldiers.

Related articles