Back to portfolioRobin Larsson
hobbyMar 2020 – Apr 2020·Personal Project

Happy Birthday — Multiplayer 3D Party Game

A 3D multiplayer game built from scratch in Unity as a surprise birthday gift during COVID-19 lockdown. Features a fully custom client-server networking layer, WebGL browser support, a MongoDB-backed account system with Discord-style logins, and a confetti easter egg.

Solo DeveloperGame DesignerNetwork Engineer

Built as a surprise birthday gift during the COVID-19 lockdown — a fully networked 3D multiplayer game created from scratch in Unity over a few weeks. The goal was to produce something personal, playable together over the internet, and full of small surprises to celebrate the occasion.

Multiplayer Architecture

Rather than using a pre-built matchmaking service, a custom client-server networking layer was written on top of Unity's NetworkTransport. The server opens two simultaneous ports so the game can be played from any device:

  • TCP port 26000 — for standalone desktop clients (Windows/Mac/Linux)
  • WebSocket port 26001 — for WebGL browser builds, so friends could join directly in a browser tab without installing anything

Messages are binary-serialised with BinaryFormatter and dispatched through a typed operation-code system (the NetOP enum), keeping the protocol clean and extensible. The server handles up to 10 concurrent connections and tracks every player's active connection ID.

Account System

A full account and authentication system was built on MongoDB Atlas (migrated from the deprecated mLab service mid-development — required installing updated MongoDB C# drivers as NuGet packages and placing the DLLs in Unity's Plugins folder). Features:

  • Account creation with username, email, and SHA-256 hashed password, with duplicate username detection
  • Login via email or a username#discriminator pair (Discord-style) — e.g. `Robin#0042`
  • Input validation via regex for email format, username length/characters, and the discriminator suffix
  • Session tokens: 64-character cryptographically random strings (alphanumeric) generated server-side and issued on successful login
  • Player state persisted to the database on each login: active connection ID, login timestamp, and online status

Lobby Scene

The client-side lobby is a Unity scene with a Canvas UI managing two flows side by side: account creation (username, password, email fields) and login (username#discriminator + password). The canvas group is disabled during network calls and re-enabled on response — preventing duplicate submissions while a request is in flight.

Easter Egg — Confetti

As a birthday surprise, a confetti particle system is wired into the scene. The ParticleSceneControls system supports three modes: Instantiate (single-shot burst on click), Trail (continuous stream while held), and Activate (ambient looping). The ParticleClouds material renders the confetti in a vibrant birthday palette — pink, teal, orange, mauve, yellow, and turquoise — matching the overall colour theme of the game.

Tech Stack

Unity 2019 · C# · Unity NetworkTransport · MongoDB Atlas · BinaryFormatter · SHA-256 · WebGL build target · Regex input validation

Technologies & Skills

Unity3DC#MultiplayerMongoDBNetworkingWebGLGame DevelopmentAuthenticationParticle SystemsBirthday

Interested in working together?

I'm available for new engagements. Let's talk about your project.

Book a call on the homepage