Sphere Duel is a 2D Online Multiplayer (Peer-To-Peer*) Top-Down Shooter, made as a Portfolio Project
*In the Gaming Industry, "Peer-To-Peer" typically refers to a Host-Client (Listen Server) model — one player acts as both Server and Client. This differs from true P2P, where all peers are equal with no central authority.
- Online multiplayer for 2 players (Host-Client)
- Server-authoritative scoring and hit detection
- Health, death, and respawn system with visual feedback
- Round-based matches with win/lose screen
- Play Again and Main Menu options after match ends
- Disconnect handling with automatic return to menu
- Dynamic arena bounds based on camera size
- Unity 6000.3.10f1
- Netcode for GameObjects 2.9.2
- Unity Transport 2.6.0
- Input System 1.18.0
- Multiplayer Play Mode 2.0.1
- Multiplayer Tools 2.2.8
- Event-Driven Architecture — decoupled communication between systems via static
GameEventsclass (e.g.OnPlayerDied,OnScoreChanged,OnMatchWon) - Server-Authoritative Design — health, scoring, projectile spawning and hit detection are all validated on the server to prevent cheating
- NetworkVariables — real-time state synchronization for health and scores across all clients
- RPCs — client-server communication for gameplay actions
ServerRpc— client-to-server requests (e.g. shooting)ClientRpc— server-to-client broadcasts (e.g. death, respawn, match results)
- Singleton Pattern — centralized access points for
GameManager,ScoreManager, andDisconnectHandler - Centralized Constants — all magic numbers stored in
Const.cs, withGameManagerexposing Inspector-configurable overrides - Separation of Concerns — utility classes like
SpawnHelperkeep logic clean and reusable
| Action | Control |
|---|---|
| Move | WASD |
| Aim | Mouse |
| Shoot | Left Click |
First to 3 kills wins the match.
- Clone the repository
- Open in Unity 6000.3.10f1
- It is recommended to open
MenuSceneas the starting scene (an Editor script auto-redirects toMenuScenewhen entering Play Mode from other scenes)
Testing Multiplayer:
- Multiplayer Play Mode (MPPM) — enable via Window > Multiplayer Play Mode, add a Virtual Player, then enter Play Mode. One instance hosts, the other joins on
127.0.0.1(localhost) - Two Builds — build the project, run two instances. Host on one, join on the other using the host's local IP
- Default port:
7777
Assets/
├── Editor/ ForceMenuSceneEditor
├── Prefabs/ Player, Projectile
│ └── UI/
├── Scenes/ GameScene, MenuScene
└── Scripts/
├── Core/ Const, GameEvents, GameManager, ScoreManager, SpawnHelper
├── Network/ ClientNetworkTransform, DisconnectHandler, NetworkManagerUI
├── Player/ PlayerController, PlayerHealth, PlayerShooting
├── Projectile/ Projectile
└── UI/ HealthBarUI, WinScreenUI
- Unity Relay + WebGL — integrate Unity Relay to enable browser-playable builds hosted on itch.io or GitHub Pages, removing the need for port forwarding
- Graphics -> Kenney Game Assets (All-in-1)
