This document is about: FUSION 2
SWITCH TO

Sample Project

Overview

The Advanced KCC comes with a dedicated Unity project full of examples, testing playgrounds and handy code snippets to help understanding how KCC works and to speed up development process of your game.

Playground
Testing playground
Playground
Navmesh AI playground
Playground
Obstacles playground
Playground
Environments playground

The sample project can be downloaded in Download section.

Features

  • Showcase scene.
  • Ability examples - Dash, Sprint.
  • Interaction examples - Teleport, Portal, Jump Pad, Moving Platform, ...
  • AI examples - NPC, NavMesh.
  • Extension examples - Processors, Stages.
  • Debug scenes - Profiling scene, Input smoothing.
  • Playgrounds - Stairs, Slopes, Corridors, Gaps, Terrains.
  • Templates - Scripts ready for copy & paste or rewrite.
  • Support for PC / Mobile / VR / Gamepad.
  • Photon Menu integration.

Sample Controls

  • Mouse - Look
  • W,S,A,D - Move
  • Shift - Run
  • Space - Jump
  • Tab - Dash
  • +,- - Toggle speed
  • Enter - Lock/unlock cursor
  • Ctrl + Shift + M - Simulate app pause/resume
  • Q,E - Strafe + look for testing smoothness
  • F4 - Toggle input smoothing
  • F5 - Toggle target frame rate
  • F6 - Toggle quality
  • F7 - Toggle vertical synchronization
  • F9 - Toggle recorders (player position / camera / input smoothing)
  • F12 - Disconnect from current session

Project structure

  • Assets - Base project folder
    • Example - Contains all resources related to sample "game"
      • 00_Showcase - Showcase scene
      • 01_PlayerMovement - Contains various implementations of Player controllers (basic, advanced, expert, top-down, vr)
      • 02_Features - Contains player abilities like Sprint, Dash and variable Surface speed
      • 03_Interactions - Contains implementation of objects the player interacts with - Environments, Teleports, Platforms, ...
      • 04_AI - Contains simple NPC implementation and example movement using NavMesh
      • 05_Extensions - Contains example scripts showing how to extend KCC with custom processors/stages
      • 06_Debug - Contains scenes for testing performance and input smoothness
      • A1_Playgrounds - Scenes dedicated for testing KCC behavior with collider types/angles combinations, depenetration, ...
      • A2_Templates - Template scripts for extending existing KCC data structures via partial implementation
      • Shared - Contains data shared by multiple examples, general settings, script managers, utilities
    • Photon - Base folder for Photon SDKs, addons, packages, ...
      • FusionAddons
        • KCC - Advanced KCC addon
      • FusionMenu - Contains Photon Menu <=> Fusion controllers
      • PhotonMenu - Photon menu package
  1. Try Showcase scene.
  2. Try interaction scenes (03_Interactions folder).
  3. Check basic movement implementation in 01_BasicMovement.
  4. Check advanced movement implementation in 02_AdvancedMovement.
  5. Check implementation of some smaller features (02_Features folder) and interactions (03_Interactions folder).

Now you should have a basic understanding how to move with KCC, how the KCC interacts with other objects (processors) and how they modify player behavior.

  1. To get more context it's good time to explore and learn about Architecture, Execution and Interactions.
  2. Check first-person expert movement implementation in 03_ExpertMovement
  3. Check third-person expert movement implementation in 03_ExpertMovement

⚠️ Expert movement is the most sophisticated solution with full render prediction, custom Input Smoothing and other features that cover edge-cases related to CPU, GPU and network spikes.

  1. Check rest of the sample project.
  2. To get even more context, please explore and learn about Features, Extending and Debugging.
  3. Take some scripts to your project or cleanup this and make a game 🚀

VR Support

The sample project is tested on Oculus platform (Oculus Link is also supported). To run the project on your headset, please follow these steps:

  1. Use VRMovement as default scene. This is the only scene configured to work with VR.
  2. Open Project Settings => XR Plug-in Management.
    • Enable Initialize XR on Startup.
    • Enable Oculus provider (or any other you want to test).
  3. Play.

Testing system latency with NVIDIA Reflex

With appropriate hardware equipment, latency of your system can be tested using NVIDIA Reflex:

  1. Enable NVIDIAReflex game object in GameplayUI prefab.
NVIDIA Reflex indicators
NVIDIA Reflex indicators
  1. Run KCC Sample build and switch to exclusive full-screen mode (F8 key).
  2. Setup position and size of NVIDIA Reflex Latency Analyzer - Monitoring Rectangle on your monitor to:
    • Upper dot to measure latency from mouse click to first forward FixedUpdateNetwork() (regular actions)
    • Lower dot to measure latency from mouse click to first Render() (render-predicted actions)
  3. Click on left mouse button to flash indicators.

🚀 In combination with top gaming hardware the average system latency in 60Hz Fusion simulation ranges around 12ms. With render prediction it can be further reduced down to around 4ms.

System latency comparison
System latency comparison

Movement analysis

The sample provides tools to analyze movement frame-by-frame.

⚠️ Python libraries are required, check for more details about recorders in Debugging section.

  1. Start the game (Editor).
  2. Toggle recording On/Off (F9 key).
  3. New .log files are created at project root folder.
  4. Copy CreateHTMLGraphs.py script from Assets\Photon\FusionAddons\KCC\Utilities\Recorders to the root folder and run it.
  5. New .html files with graphs are created with similar filenames.
  6. Check graphs.

Third-Party Assets

This sample has been made possible thanks to the support of third party creators. The project uses following assets:

Back to top