⮞ Go to NeoFPS.com

    Show / Hide Table of Contents

    Game Modes

    Overview

    Game modes in NeoFPS are intended to control the flow of a game. This means creating a player object, spawning and respawning characters and attaching them to the player. They are derived from the FpsGameMode base behaviour which is an abstract class and therefore cannot be placed in the scene without a specific implementation.

    In this version of NeoFPS the majority of the demos use a game mode called FpsSoloGameMinimal. This implementation simply spawns both a player and character from prefabs on start. On a character's death, the FpsSoloGameMinimal can be set to either spawn a new character, reload the scene, return to the main menu, or load the last valid save game (for more information on save games, see Save Games). The minimal implementation is designed for testing and development of prototypes and as a template for implementing a custom game mode for your own game.

    The game mode also handles persisting data such as player health and inventory between scenes, also using the save game system. This can be toggled on or off.

    Customizable Game Modes

    With some scripting you are able to customise the behaviour of the game modes at various points. For example:

    • You can change where the game mode gets the player or character prefab to spawn
    • You could modify the character's starting inventory using a loadout
    • You can hook into the player character's death to display a UI or change the respawn behaviour

    For full control over the game mode, you can inherit a custom class from the FpsSoloGameBase behaviour class. This has a number of virtual and abstract methods and properties that influence it's behaviour. For more information, you can see the scripting reference for this class here.

    There is also a version of the game mode called FpsSoloGameCustomisable that inherits from this and ties into the sample UI system to show a pre-spawn popup. This allows you to add tabs to the popup for functionality such as selecting a loadout, creating a custom loadout, selecting a character, or picking a spawn point in the scene. This is used as the basis for the DemoFacilityGameMode. Working with this system does require you to script the desired behaviour, because a componentised version that can be assembled through the editor and adapted to any game design would be a huge undertaking.


    See Also

    Working With NeoFPS

    Save Games

    Back to top Copyright © 2019 Yondernauts Game Studios Ltd
    Generated with DocFX