Architecture
Unity Project
The simulation code of each example sits next to its assets in a Simulation folder instead of QuantumUser/Simulation.
This works for any folder that contains a Quantum.Simulation.asmref file, see Assembly Definitions.
Code shared by all examples, such as the MovementSystem and the UIGameMenu prefab, lives in Common.
Each example has its own SystemsConfig asset in its Configs folder that enables only the systems the example needs, see Systems.

High Level Breakdown
The game starts in the main menu, where UIMainMenu loads the selected example scene.
Each example scene contains the UIGameMenu prefab, which connects to a room and starts the Quantum session with the settings of that example, see Session and Menu.
All examples share the same Input handling and the same movement system.
On top of this shared base, each example shows different gameplay:
- Third Person Character: characters moved by the KCC addon and animated from the predicted KCC state
- Platformer: coins and a flag as triggers, falling platforms and rounds with a winner
- Shooter: first-person view, line cast shooting, health, scoring and chickens configured by a custom asset
Session and Menu
UIGameMenu holds the RuntimeConfig and the RuntimePlayer of the example, so each scene starts with its own map, SystemsConfig and player prefab, see Configuration Files.
To keep players of different examples apart, StartGame sets the GameMode room property to the GameModeIdentifier of the scene and exposes it to the lobby:
C#
CustomProperties = new PhotonHashtable {["GameMode"] = GameModeIdentifier},
CustomLobbyProperties = new[] {"GameMode"},
After joining, StartGame checks the property again and disconnects when the room belongs to another example, see Starting a Session.
A room takes up to 16 players, set by #pragma max_players 16 in Common/Simulation/Common.qtn.
Input
PlayerInput accumulates the input in OnUpdateView and hands it to Quantum in CallbackPollInput with DeterministicInputFlags.Repeatable, see Input and Input Flags.
LookRotation is the absolute pitch and yaw, not a delta.
When the simulation respawns a player with a new rotation, it raises the local ResetLookRotation event so PlayerInput continues from the new rotation.
On mobile platforms, OnScreenLook and OnScreenDoubleTap in Common/Scripts/MobileControls add camera look by dragging and a jump by double tap next to the standard on-screen buttons.
Third Person Character
The Third Person Character example is a conversion of Unity's Starter Assets - Third Person into a multiplayer environment.
Instead of the default CharacterController component, it uses the KCC addon to drive player movement.
The common MovementSystem drives the characters of all three examples.
With SetLookRotation disabled the character turns towards its move direction, the Shooter enables it for the first-person view.
When a character falls below the level, the system raises the PlayerFell signal and leaves the reaction to the example.

Platformer
Coins and the flag are triggers handled in GameplaySystem.OnTrigger3D, see Physics Callbacks.
A collected coin raises the CoinCollected signal, which CoinSystem uses to disable the coin until its refresh timer expires, and the CoinCollected event, which plays the sound in the view.
A falling platform is a dynamic physics body and the player collider is slightly larger than its KCC shape, so FallingPlatformSystem detects the player in OnCollisionEnter3D.
When the fall timer expires, the platform switches to the Ignore Raycast layer instead of disabling its collider, so it still falls as a physics body.
When a player reaches the Flag with enough coins, the GameplaySystem disables the KCCSystem to stop all players until the next round starts.
PlayerView stores the local player entity in the SceneContext view context, where UIPlatformer reads it to show the coins of the local player.

Shooter
ShootingSystem fires only when Fire was pressed, limited by FireRate, and casts a line from the camera position along the look direction, see Physics Queries.
The collider of the shooter is disabled during the cast to prevent self-hits.
Kills are reported with the EntityKilled signal, the GameplaySystem adds 1 point for a chicken and 5 for a player.
The score stays when the player respawns.
The chicken settings live in the ChickenConfig asset, which the RuntimeConfig references through a field added in Common/Simulation/RuntimeConfig.User.cs, see Assets in Simulation.
For the local player, PlayerView renders the head as shadows only and moves the weapon to the FirstPersonOverlay layer to prevent wall clipping.

Where to Go Next
After the Third Person Character, the KCC Sample Project goes deeper into character movement. For more advanced character animation, explore the Simple FPS project. If you are making a fighting or sports game where animations need precise synchronization, look into the Quantum Animator addon.
After the Platformer, the Platform Shooter 2D sample provides a fast and action-packed platformer experience. Physics interactions are where Quantum truly shines, see how players interact with each other and with a ball in Sports Arena Brawler. For physics-heavy co-op gameplay, Friendslop keeps ragdolls in sync on all clients so players can grab, kick and throw each other.
After the Shooter, Simple FPS is a natural evolution of this example, it provides a complete game loop, ammo handling, various weapons, pickups, player statistics and leaderboards and integration with the Quantum Menu. Platform Shooter 2D provides a comprehensive platformer shooter experience in 2D. The top-down Twin Stick Shooter shows how to build a game similar to Brawl Stars and includes a full implementation of player AI using the Bot SDK addon.
Quantum Simple FPS also provides an example implementation of lag compensation and snapshot interpolation, but keep in mind that Fusion might be a better choice for shooters, especially when creating a competitive game or targeting PC and consoles.
Visit our Samples page to discover more example projects.
Last updated on
Back to top