All projects

Case study · Solo project

3D Netcode Tank Game

Jan 2025 · Unity 6 · C# · Netcode for GameObjects

A multiplayer tank shooter built to learn networking properly: online sessions over Unity Relay, account sign-in with cloud-saved profiles, and a combat model in which the server has the final say on every hit.

  • RoleSolo developer
  • EngineUnity 6 · C#
  • NetcodeNetcode for GameObjects
  • ModelServer-authoritative

Overview

A networking-first prototype

This project exists to get the hard parts of online multiplayer right, rather than to be a finished game. It is built on Unity Netcode for GameObjects with Relay-backed sessions, so two players can connect over the internet, spawn into the same world, and shoot at each other while the server arbitrates what actually happens.

Around the netcode sits the full online-services flow: a login and registration screen backed by Unity Authentication, and a display name persisted through Cloud Save so a profile follows the player between sessions.

Sign-in and registration, backed by Unity Authentication and Cloud Save.

Combat

Server-authoritative hitscan

Firing is resolved on the server rather than the client, the authoritative model that keeps online shooters cheat-resistant. When a player shoots, the server fans out 64 raycasts stacked vertically toward the aim point, filters them to player hits, and takes the one closest to the muzzle as the real result.

That fan is a deliberate piece of hit-forgiveness. A single ray is unforgiving on a moving target, but a spread of them gives the shot a little tolerance while still letting the server, and only the server, decide whether damage was dealt.

Driving and aiming; the shot itself is decided server-side.

Aiming

A turret that traverses rather than snaps

The turret does not jump straight to the cursor. Mouse input rotates an invisible "desired" transform, and the real turret turns toward it each frame at a fixed traverse speed, using a dot product against its own right vector to decide which way to rotate.

The effect is a mechanical, rate-limited swing that reads like a real gun barrel coming around, rather than an instant lock-on. Decoupling where the player wants to aim from where the turret currently points is a small rig that adds a lot of weight to the aiming.

VFX

Networked effects with a clean lifecycle

Muzzle flashes, smoke and explosions are spawned as networked objects on the server so every client sees them, then tidy themselves up with a proper handshake: the effect fades its material out, drifts, and when the fade completes the owner asks the server to despawn it.

It is a small detail, but getting the owner-to-server despawn flow right is exactly the kind of thing that separates a networked prototype that leaks objects from one that behaves.

Under the hood

By the numbers

  • Unity Netcode for GameObjects over Relay-backed online sessions.
  • 30 Hz network tick, with player prefabs auto-spawned on connect.
  • 64-ray server-side hitscan with closest-hit resolution.
  • Unity Authentication and Cloud Save for accounts and persistent display names.
  • A ten-state menu FSM that doubles as the play and pause gate for gameplay scripts.