This document is about: FUSION 2

Simple FPS

Level 4


The Simple FPS game is a first-person shooter designed to provide an entry-level game sample with a straightforward code structure. Its primary focus is to serve as a learning resource for beginners and developers interested in creating their own first-person shooter games.

The gameplay revolves around intense deathmatch battles, where players engage in fast-paced combat within a realistic warehouse environment. With its simplistic design and clear code organization, the Simple FPS game offers an accessible starting point for understanding the fundamentals of creating multiplayer games with Fusion.

This sample uses the Client/Server topology.
simple fps


  • First-person shooter set in a warehouse environment.
  • Deathmatch mode: Players respawn after a short time after death. The player with the most kills wins.
  • Three hitscan weapons: Pistol, automatic rifle, and shotgun.
  • Weapon and health pickups available throughout the map.
  • Double Damage boost that lasts for 30 seconds during the match's final phase.
  • Beginner-friendly code structure, facilitating ease of understanding and modification.
  • Simple kinematic character controller (Simple KCC) for player movement.
  • Photon Menu integration.

The Simple FPS also uses Client Side Prediction and Lag Compensation.

  • Client Side Prediction is a popular multiplayer architecture in which clients use their own inputs to predict their movement before receiving confirmation from the server. This allows the gameplay to feel snappy and hides latency.
  • Lag Compensation allows the server to temporarily view the world from each client's perspective and decide if players were in fact in a position to take shots.


Version Release Date Download
2.0.10 May 16, 2024 Fusion Simple FPS 2.0.10 Build 552


  • Unity 2022.3
  • Fusion AppId: To run the sample, first create a Fusion AppId in the PhotonEngine Dashboard and paste it into the App Id Fusion field in Real Time Settings (reachable from the Fusion menu in Unity editor). Continue with instruction in Starting The Game section.

Starting The Game

The Simple FPS game can be started either through the startup scene with menu (Scenes/Startup) where players can navigate to various options including starting a new deathmatch game, or directly by launching the gameplay scene (Scenes/Deathmatch) to jump right into the action.


  • Use W, S, A, D for movement, SPACE for jumping, and Left Mouse Button to fire.
  • Switch between collected weapons using 1, 2, 3, and reload a weapon with R.
  • Press F to spray images onto nearby surfaces, adding an extra element of fun.
  • Lock or release your cursor inside the Unity Editor using the ENTER key.



The main Player script handles essential functionalities such as input processing for movement and weapon control. It also determines the visibility of the correct player visual representation, toggling between first-person visual for local player (just hands with weapons) and third-person visual for other players that the local player sees (full body characters). Third-person animations are also controlled within this script.

Player input is handled by the PlayerInput class, which accumulates input from devices (keyboard/mouse). The accumulated input is then consumed via the standard Fusion OnInput callback.

Player health is stored in the Health script. During gameplay, the player has a short period of immortality after spawning. Immortality is immediately stopped if the player fires from a weapon.

Footsteps in the Simple FPS are audible to all players, with the local player hearing their own footsteps slightly quieter.

SimpleKCC (simple kinematic character controller) component resolves player movement and collisions. For more information please refer to the Simple KCC.

BodyHitbox, a child of the standard Fusion Hitbox component, is utilized to implement hitboxes with different damage modifiers for various body parts. For example, the head receives double damage, while the legs receive reduced damage. It's worth noting that the player hitboxes' positions are not influenced by animations for simplicity, and they are set up in a static pose that represents the most common player pose - holding a weapon.

gizmos showcasing hit boxes

For more information about animations in Fusion please refer to the Animation page in Fusion Manual and Animations technical sample. Note these samples are built with Fusion V1.


The Weapons script handles the general functionality of weapons in the game, holding references to all player weapons and allowing actions such as firing and reloading. All weapons are already included in the player prefab hierarchy, which is a straightforward approach when only a few weapons are present in the game.

The Simple FPS sample incorporates hitscan weapons, which fire a raycast with a specified maximum distance, allowing for immediate hit evaluation. Although projectiles do not physically travel over time, the sample employs a dummy projectile visual (handled by ProjectileVisual script) that creates the illusion of travel through a fast yellow bullet with a trail. This trail accurately represents the direction and endpoint of the raycast.

assault rifle shooting

For each projectile shot, a small data structure ProjectileData is stored in an array within the Weapon script. This array is networked and functions as a circular data buffer, meaning that when the end of the array is reached, projectiles are stored from the beginning again. Using this array, projectiles are fired on all clients, ensuring efficient projectile networking.


private struct ProjectileData : INetworkStruct
    public Vector3     HitPosition;
    public Vector3     HitNormal;
    public NetworkBool ShowHitEffect;

For a more in-depth understanding of projectiles and their networking, a comprehensive exploration can be found in the Projectile Essentials and Projectile Advanced samples. Note these samples are built with Fusion V1.


There are two types of pickups in the sample: weapon pickup and health pickup. Both pickups are automatically collected when players walk over them. The HealthPickup instantly heals players by a specified amount, restoring their health. The WeaponPickup grants the player a new weapon or refills their ammunition if the player has already acquired that particular weapon.

health pickup


The Gameplay script serves as the central script of the game, handling various aspects of the gameplay experience in the Simple FPS. It is responsible for player spawning, calculating player scores, and managing the transitions between different gameplay states.

The gameplay mode in Simple FPS is a classic deathmatch, where players engage in combat to eliminate each other. Upon elimination, players respawn after a certain amount of time after death. The match concludes when the time runs out, and the player with the highest number of kills emerges as the winner.

The gameplay system operates through several states, including Skirmish, Running, and Finished. In the Skirmish state, a solo player can freely explore the arena without any time constraints. Once a second player connects to the game, the gameplay switches to the Running state, and the match timer starts. Finally, the Finished state is reached when the match concludes, and the results are displayed.

Connected players are managed by the Gameplay script using a players data dictionary (replicated to all players). Within this dictionary, each player is associated with a PlayerData data structure that holds vital information about the player. PlayerData includes details such as the player's nickname, the number of kills and deaths they have accumulated, and their current status (whether they are alive or not).


public struct PlayerData : INetworkStruct
    [Networked, Capacity(24)]
    public string    Nickname { get => default; set {} }
    public PlayerRef PlayerRef;
    public int       Kills;
    public int       Deaths;
    public int       LastKillTick;
    public int       StatisticPosition;
    public bool      IsAlive;
    public bool      IsConnected;

The PlayerData data structure allows for efficient tracking of players and their statistics throughout the gameplay experience.


The user interface in the Simple FPS is handled in a straightforward manner, without relying on any specific UI framework. The main script responsible for UI management is the GameUI script. It enables the appropriate UI game objects that should be visible during gameplay. Additionally, the GameUI script maintains references to other UI elements and updates the player UI when a player is spawned.

scoreboard ui

In addition to the general UI handling, the game features gameplay announcements that provide important feedback to the players. These announcements, such as "Lead Lost" or "Lead Taken," are managed by the UIGameplayInfo script, which is responsible for the gameplay info panel. The script enables specific announcement game objects based on changes in the players' statistics, ensuring that relevant messages are displayed to the players at the appropriate times.

The UI implementation in Simple FPS focuses on simplicity and functionality, ensuring that players receive the necessary information without the need for a complex UI framework.

The Simple FPS incorporates the standard Photon Menu, allowing players to quickly connect and start a match.

photon menu

Third Party Assets

The Simple FPS sample's core is made possible by Fusion; however, games require more than "just" tech! In addition to the multiplayer tech provided by Photon, the Simple FPS has been made possible thanks to the support of a group of excellent creators.

Third party assets like models, effects, sounds are located in `Assets/3rdParty` folder. To use these in your own project, you need to purchase a license from them.
Back to top