Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

NeonGameModes

An asset by metapika
The page banner background of a mountain and forest
NeonGameModes hero image

Quick Information

0 ratings
NeonGameModes icon image
metapika
NeonGameModes

Godot Addon that helps define, switch and manage state-specific permissions!!!! PLEASE READ THE DOCS ON GITHUB BEFORE USING THE PLUGIN !!!https://github.com/metapika/neon-game-modes

Supported Engine Version
4.4
Version String
1.0
License Version
GPLv3
Support Level
community
Modified Date
9 hours ago
Git URL
Issue URL

NeonGameModes

Godot Addon that helps define, switch and manage state-specific permissions!

Overview

NeonGameModes is a Godot Plugin/Addon that allows you to create, remove, manage and switch between Game Modes/States in your Godot Projects, big and small!

NeonSceneRunner and NeonPageController Plugin

[!NOTE] In order to make the most out of this Plugin I reccomend checking out an Addon I made called NeonSceneRunner that allows for great Scene Management and pairs well with this GameMode system! It is not needed, but very much reccomended!

Another cool Plugin is the NeonPageController which allows for effortless changing between UI Screens and also works great with this Plugin. Again, not needed, but highly reccomended!

What is a "GameMode"?

In most games there will be certain properties that are set depending on which part of the game the Player is at. Those parts being for example Main Menus, Pause Menus, Cutscenes, etc. A "GameMode" is exactly that!

It is logical that some of these properties (for example moving/jumping/rotating around) will be turned on or off depending on those parts. This Addon was made in order to make the tedious job of changing those properties effortless!

How does it work?

Upon running a Scene that has a "GameModeManager" Node in it, the GameModeManager script enables the "Initial GameMode" that's currently selected. After that any script that has a reference to the GameModeManager Node can use the function _change_game_mode in order to switch between user-defined GameModes.

Features

  • Quickly define GameMode-specific properties.
  • Easily create and manage GameModes via Godot's Resource System!
  • Swiftly switch between GameModes from any script, button or Node!
  • Globally store properties for use in all of your scripts!

Installation

  1. In your Godot Project press the 'AssetLib' button at the top: README assetlib.png
  2. Search "NeonGameModeManager", Download the Plugin and press 'Install'.
  3. Good job, you are ready to use NeonGameModeManager!

Core Functionality

Firstly, let's discuss the core aspects of the Plugin.

  • GameMode - a custom Resource that stores dev-defined properties that will be later accessed and evaluated at runtime.
  • GameModeManager - a custom Node that's used to manage all GameModes added to it's GameModes Array.

Setup

  1. Open the GameMode.gd script located at "res://addons/neon_game_modes/Scripts/Classes/GameMode.gd".

  2. Define any properties for later use and/or uncomment example ones.

    • The commented-out examples are: _page_type, _can_move, _mouse_locked. If you do uncomment any of these, note that they will work from the start, except for _page_type which needs the NeonPageController Addon to be installed.)
    • Use the @export tag in order to access and change those values in the Inspector later.

      [!CAUTION] Leave the _game_mode_name property as it's used in when getting GameModes by their names.

  3. With NeonSceneRunner Addon (Reccomended)

    • In the Runner.tscn Scene add the GameModeManager Node by pressing Ctrl+A and searching for it. (It will now be available globally by any script by typing App._game_mode_manager)
  4. Without NeonSceneRunner Addon:

    • In any scene (preferably a new one) add the GameModeManager Node by pressing Ctrl+A and searching for it.
  5. In the Inspector you will see 4 values that you can edit:

    • Game Modes - An array that stores all references to GameModes you make. Here you will need to add ALL of the GameModes you want to switch between with the GameModeManager;
    • Initial Game Mode - The default GameMode that will be enabled when starting the game;
    • Gameplay Game Mode - The GameMode that is implied to be enabled during regular gameplay. This value is only used by the NeonSceneRunner Addon in order to differentiate Menu and Level Game States in your game;
    • Debug Mode - In order to easily Debug the inner workings of the Plugin I've added a Debug Mode that prints out messages to Godot's Output Dock. I've enabled it by default, but you can easily disable it by making the property false;
  6. Go to the FileSystem dock on your screen.

  7. Create a New Folder and call it whatever you want (Ex. GameModes)

  8. Right click on the New Folder, select Create New and finally press Resource. README res_create.png

  9. Search for "GameMode" and press Enter, name it whatever you want.

  10. Select the newly-created GameMode.

    • Here, modify all the properties you created during Step 2 according to each GameMode you make.
  11. Do Steps 8-10 for ALL of the GameModes that you want to define and use.

  12. After creating all of your GameModes, add them to the GameModes Array on the GameModeManager.

  13. That's it, you are ready to use your NeonGameModeManager!

Usage

After making a reference to the GameModeManager Node, in any of your scripts you can use the following 2 functions:

    _game_mode_manager._change_game_mode_by_name(_mode_name : String, _no_page_change : bool = false)

and

    _game_mode_manager._change_game_mode(_mode_index : int, _no_page_change : bool = false)

[!NOTE] In both of these functions the second parameter you can provide is the _no_page_change bool. This relates to integration with the NeonPageController Addon, you can ignore it if you don't use it. This bool allows you to choose whether the GameModeManager should disable the previous mode's UI Page or not.

Both of these functions work the same, the only difference is that in one you provide a _mode_name string and in the second - a _mode_index integer.

After changing modes you can grab a reference to the current GameMode and access it's properties by using this function:

    var _cur_gm = _game_mode_manager._get_current_game_mode() : GameMode

This function returns the current GameMode. From here you can access any properties by typing _cur_gm.[PROPERTY_NAME] (Ex. _cur_gm._game_mode_name, _cur_gm._mouse_locked, etc.)

[!NOTE] If you are using the NeonSceneRunner Addon you can automatically reference the _game_mode_manager singleton by typing:

    App._game_mode_manager.[FUNCTION]

Example Usage

Upon importing the Plugin you will see new Folders show up in the root of your res:// directory:

README hierarchy.png

I decided to create Example GameMode Resource files and put them in the GameModes folder for you to see a basic Setup of the Plugin.

In each of these the only available property is the _game_mode_name, as each use-case of this Addon will be different and I decided that providing a ready-to-use Example would be too confusing.

Instead, like I mentioned in the Setup section I added example properties I used for my games and commented them out so they don't cause any trouble.

Here are some more example GameMode setups i think this Addon is useful for:

First Person Shooter

GameModes:

  • MenuMode - main menus;
  • GameplayMode - running around slashing things;
  • AbilityMode - when the player is using an ability;
  • PauseMode - pause menu;
  • CutsceneMode - during cutscenes;
  • DialogueMode - during in-game dialogue with characters;
  • InteractiveCutsceneMode - during cutscenes where the player walks behind an NPC or something;

Mode Properties:

  • _can_move - bool - toggles the player's movement;
  • _can_run - bool - toggles the player's ability to run around;
  • _can_rotate - bool - toggles the player's camera rotation;
  • _mouse_locked - bool - toggles if the player should be able to see and move the cursor around;
  • _can_shoot - bool - toggles if the player can shoot, for example during interactive cutscenes;
  • _can_interact - bool - dictates when the player can interact with the world;
  • _time_scale - float - how fast the game is during this GameMode;

Third Person Slasher

GameModes:

  • MenuMode - main menus;
  • GameplayMode - running around slashing things;
  • AbilityMode - when the player is using an ability;
  • PauseMode - pause menu;
  • CutsceneMode - during cutscenes;
  • ShopMode - during a shopping spree;

Mode Properties:

  • _can_move - bool - toggles the player's movement;
  • _can_run - bool - toggles the player's ability to run around;
  • _can_rotate - bool - toggles the player character's rotation;
  • _cam_can_rotate - bool - toggles the player's camera rotation;
  • _mouse_locked - bool - toggles if the player should be able to see and move the cursor around;
  • _can_use_abilities - bool - toggles if the player can use abilities during this ability, useful to limit spamming during abilities;

These are just light suggestions. Remember that every game is different and you need to fit and mold the GameModeManager and the GameModes to your liking in order to get the most of it. That's it, hope you enjoy!

Godot Addon that helps define, switch and manage state-specific permissions!

!!! PLEASE READ THE DOCS ON GITHUB BEFORE USING THE PLUGIN !!!

https://github.com/metapika/neon-game-modes

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
NeonGameModes icon image
metapika
NeonGameModes

Godot Addon that helps define, switch and manage state-specific permissions!!!! PLEASE READ THE DOCS ON GITHUB BEFORE USING THE PLUGIN !!!https://github.com/metapika/neon-game-modes

Supported Engine Version
4.4
Version String
1.0
License Version
GPLv3
Support Level
community
Modified Date
9 hours ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers