TransitionManager ​
Inherits: RefCounted
TransitionManager - Clean state machine for game state transitions Handles three primary states: MainMenu, CharacterCreation, MainGame Manages world persistence, system cleanup, and loading orchestration
Variables ​
GameState | current_state | GameState.MAIN_MENU |
GameState | previous_state | GameState.MAIN_MENU |
bool | is_transitioning | false |
RuntimeMode | current_runtime_mode | RuntimeMode.NORMAL_GAME |
bool | vfx_initialized | false |
bool | quest_system_initialized | false |
bool | faction_manager_initialized | false |
bool | game_systems_initialized | false |
WorldData | current_world_data | null |
bool | is_transitioning_map | false |
Array[SetupStep] | setup_steps | [] |
int | current_setup_step | 0 |
float | setup_progress | 0.0 |
Node | test_scene_detected | null |
String | original_main_scene | "" |
GameHost.SystemHub | system_hub |
Methods ​
void | initialize_to_main_menu( splash_screen: SplashScreen = null ) |
void | transition_to_character_creation() |
void | start_new_game( custom_character_def: CustomCharacterDefinition = null ) |
void | load_saved_game( save_file_name: String ) |
void | return_to_main_menu() |
void | transition_to_world( world_data: WorldData, spawn_override: Dictionary = {} ) |
void | perform_full_cleanup() |
void | initialize_core_game_systems() |
void | transition_to_map_by_id( map_id: int, spawn_override: Dictionary = {} ) |
void | transition_via_rabbit_hole( target_world_id: int, rabbit_hole_id: int ) |
void | transition_to_exact_position( map_id: int, position: Vector3, rotation: Vector3 = Vector3.ZERO ) |
bool | is_map_transition_in_progress() |
Enumerations ​
enum GameState ​
The part of the game that is on: main menu, character creation or the game itself.
- MAIN_MENU =
0 - CHARACTER_CREATION =
1 - MAIN_GAME =
2
enum RuntimeMode ​
How the game runs: as a normal game, or as a world test started from the editor.
- NORMAL_GAME =
0 - EDITOR_WORLD_TEST =
1
enum SetupStep ​
The steps of loading a game, in order (core systems, world, party, NPCs, systems, audio, then the steps of a saved game).
- INITIALIZE_CORE_SYSTEMS =
0 - INITIALIZE_WORLD =
1 - SETUP_NEW_GAME_PARTY =
2 - LOAD_NON_PLAYER_CHARACTERS =
3 - SETUP_NPCS =
4 - SETUP_GAME_SYSTEMS =
5 - START_AUDIO =
6 - LOAD_SAVED_GAME =
7 - CREATE_PLAYERS_FROM_SAVE =
8 - RESTORE_SAVED_STATE =
9
Variable descriptions ​
GameState current_state = GameState.MAIN_MENU ​
The part of the game that is on now.
GameState previous_state = GameState.MAIN_MENU ​
The part of the game that was on before.
bool is_transitioning = false ​
True while the game moves from one part to another.
RuntimeMode current_runtime_mode = RuntimeMode.NORMAL_GAME ​
How the game runs now.
bool vfx_initialized = false ​
True once the visual effects are ready.
bool quest_system_initialized = false ​
True once the quest system is ready.
bool faction_manager_initialized = false ​
True once the faction manager is ready.
bool game_systems_initialized = false ​
True once the game systems are ready.
WorldData current_world_data = null ​
The world that is loaded now.
bool is_transitioning_map = false ​
True while the player moves from one map to another.
Array[SetupStep] setup_steps = [] ​
The steps left to load the game, in order.
int current_setup_step = 0 ​
The step of the loading that runs now.
float setup_progress = 0.0 ​
How far the loading is (0 to 1), shown by the loading screen.
Node test_scene_detected = null ​
The scene being tested, when the game was started from a scene in the editor.
String original_main_scene = "" ​
The main scene of the project, kept while a test scene runs.
GameHost.SystemHub system_hub ​
The hub of the game systems.
Method descriptions ​
void initialize_to_main_menu( splash_screen: SplashScreen = null ) ​
Initialize game on first launch (to main menu)
void transition_to_character_creation() ​
Transition to character creation from main menu
void start_new_game( custom_character_def: CustomCharacterDefinition = null ) ​
Start new game (from main menu or character creation)
void load_saved_game( save_file_name: String ) ​
Load saved game from main menu
void return_to_main_menu() ​
Return to main menu from any state
void transition_to_world( world_data: WorldData, spawn_override: Dictionary = {} ) ​
Transition between worlds (only valid in MainGame state)
void perform_full_cleanup() ​
Complete cleanup when exiting MainGame or loading a save This is the master cleanup function that orchestrates all system resets
void initialize_core_game_systems() ​
Initialize core game systems that must be ready before entity creation
void transition_to_map_by_id( map_id: int, spawn_override: Dictionary = {} ) ​
Transition to map by ID with optional spawn override
void transition_via_rabbit_hole( target_world_id: int, rabbit_hole_id: int ) ​
Convenience method for rabbit hole transitions
void transition_to_exact_position( map_id: int, position: Vector3, rotation: Vector3 = Vector3.ZERO ) ​
Convenience method for exact positioning (cutscenes, etc.)
bool is_map_transition_in_progress() ​
Check if map transition is currently in progress