STAGE 2-5
PROTOTYPE

Tic-Tac-Toe Multiplayer

RoleMultiplayer / Netcode Programmer
Timeline2025
PlatformUnity 2D · PC (Networked)
Team Size1 (Solo)
UnityC#Netcode for GameObjects 2.8.1Multiplayer ServicesServer Authority
STAGE 2-5 // BOTHTIC-TAC-TOE MULTIPLAYERUnityC#Netcode for GameObjects 2.8.1Multiplayer ServicesServer AuthoritySYSTEM_INIT: OK | MEMORY: ALLOCATED | RENDERING: ONLINE

Mission Brief

Implement a tamper-resistant client-server multiplayer architecture in Unity where clients submit unvalidated move intents via RPCs and the server acts as the single source of truth.

Key Systems Engineered

Server-Authoritative RPC Move Validation (GameManager.cs)

Clients invoke [Rpc(SendTo.Server)] ClickedOnGridPositionRpc(x, y, playerType). The server independently validates turn ownership (playerType == currentPlayablePlayerType.Value) and cell vacancy before mutating authoritative board state and broadcasting [Rpc(SendTo.ClientsAndHost)] visual triggers.

Automatic State Replication via NetworkVariable<T>

Tracks currentPlayablePlayerType, playerCrossScore, and playerCircleScore as NetworkVariables whose OnValueChanged callbacks drive local UI updates across connected clients without manual score-sync packets.

Precomputed 8-Line Win Evaluator & Deterministic Session Bootstrapping

Builds all 8 winning Line structs (3 grid coords, center cell reference, and Horizontal/Vertical/DiagonalA/DiagonalB orientation enum) once in Awake(), and auto-starts the match on the server the instant ConnectedClientsList.Count == 2.

Implementation Details

Architecture & Deep Dive

This project implements server-authoritative multiplayer using Unity’s Netcode for GameObjects (NGO). Clients send move intents as RPCs, but the server independently validates turn ownership and cell vacancy before accepting any move, preventing client-side cheating.

Game state is replicated automatically via NetworkVariable<T>, with UI updates driven by OnValueChanged callbacks rather than manual synchronization packets. The win evaluator precomputes all 8 winning line configurations once at startup.

Player

Your class determines which skills and projects are highlighted.