LevelSelectionController - alexneargarder/Broforce-Docs GitHub Wiki
- Level Loading & Transitions
-
Campaign Management
- Methods
- Properties
-
Fields
- _levelFileNameToLoad
- CurrentCampaign
- currentVSRotationCampaign
- currentWorkshopLevel
- DefaultCampaign
- defaultDeathmatchCampaignIncludedInRotation
- defaultRaceCampaignIncludedInRotation
- ExpendabrosCampaign
- haveSetListCallResult
- isOnlineCampaign
- lastVersusCampaign
- levelDetailsCurrentVSRotationCampaign
- levelDetailsNextVSRotationCampaign
- listCallResult
- loadPublishedCampaign
- MapDataToLoad
- nextVSRotationCampaign
- OfflineCampaign
- OnlineCampaign
- onlineVSLevels
- usingOnlineDMLevelRotation
- versusRotationList
- Level Progression
- Campaign State Queries
-
Scene Management
- Properties
-
Fields
- _MainMenuScene
- BrodownSceneName
- CampaignScene
- CampaignSceneDefault
- DeathmatchSceneName
- ExplosionRunSceneName
- GameOverScene
- HellArcade
- HeroSelectScreen
- IntroScene
- JoinScene
- levelNumBrodownJungle
- MainMenuSceneExpendabros
- OfflineCustomVictoryScene
- RaceRunSceneName
- SuicideHordeSceneName
- VictoryScene
- WorldMapScene
- Scene State
Retrieves the MapData for the current level based on the game's load mode and settings. This is the primary method for obtaining level data and handles all different load scenarios.
Returns:
-
MapData
: The MapData for the current level, or null if no valid level data could be loaded.
Loads map data for the current campaign based on game mode and level number. Handles special cases for BroDown mode (player count based levels), versus modes with rotation, and victory screen for completed campaigns.
Returns:
-
MapData
: The MapData for the current level, or victory screen data if the campaign is complete.
Loads map data from a file on disk. Attempts to load as a campaign first, falling back to single level loading if that fails. Updates the level file name tracking.
Returns:
-
MapData
: The loaded MapData, or null if no valid file name is set.
Handles the transition to the next scene in the campaign sequence, including special handling for the helicopter intro cutscene at the start of the main campaign.
Advances to the next level in the current campaign by incrementing the level number and reloading the current scene. Resets to level 0 if past the end of the campaign.
Resets all level selection and game mode settings to their default values. This comprehensive reset is called when returning to the main menu or starting a fresh game session.
Initiates a restart of the current campaign scene by triggering a fade transition. This method is called when the player chooses to retry a failed level.
Marks the current level as complete by incrementing the level number and saving progress for online campaigns. Resets the helicopter intro flag for the next level.
Called when a deathmatch rotation level finishes downloading. Assigns the campaign to the appropriate rotation slot and initiates download of the next level if needed.
Parameters:
- Campaign campaign: The downloaded campaign to add to the rotation.
Queries Steam Workshop for deathmatch levels using either vote ranking (70% chance) or trend ranking (30% chance). Initiates the asynchronous query and sets up the callback handler.
Formats a campaign file name into a display name by converting to uppercase, removing prefixes, and looking up formatted names. Used for campaign display in UI and presence text.
Parameters:
- string campaignFileName: The raw campaign file name to format (e.g., "WM_Mission1").
Returns:
-
string
: The formatted campaign name (e.g., "2" for "MISSION1") or the cleaned uppercase name if no lookup exists.
Loads the next campaign in the versus rotation system. Handles both online deathmatch rotation with Steam Workshop levels and offline rotation with local campaigns. Manages the campaign queue and initiates downloads for upcoming levels.
Sets the platform-specific presence text based on the current campaign and level. Displays different text for challenge levels, arcade levels, and campaign levels.
Callback handler for Steam Workshop queries. Processes the returned deathmatch levels, creates WorkshopLevelDetails objects, and selects levels for the current and next rotation slots.
Parameters:
- SteamUGCQueryCompleted_t value: The Steam UGC query result containing workshop level information.
- bool ioFailure: Whether the query failed due to an IO error.
Gets or sets the name of the campaign that should be loaded. This property stores and retrieves the campaign name from the GameState singleton instance, ensuring that the campaign name persists across scene transitions.
Gets or sets the currently loaded Campaign object containing all level data for the active campaign. Setting this property also updates the campaign name in GameState for persistence.
Gets or sets the name of the level file to be loaded. This property is used when loading individual level files from disk rather than campaign files. The property acts as a wrapper around the internal _levelFileNameToLoad field.
Gets or sets whether a custom campaign (user-created or downloaded) should be loaded instead of the built-in campaigns. This flag is stored in the GameState singleton and controls the campaign loading behavior.
Gets or sets whether the game should return to the world map after completing the current level or campaign. This property controls the flow between the world map mode and individual levels.
Internal backing field for the levelFileNameToLoad property. Stores the file name of a level to be loaded from disk.
Private backing field that stores the currently loaded campaign. Accessed through the currentCampaign property which handles campaign validation and loading.
Stores the current campaign in the versus mode rotation for online deathmatch games. When using online deathmatch level rotation, this holds the campaign that is currently active. Gets set when a deathmatch rotation level completes loading via DmRotationLevelLoadComplete. Used by LoadNextVersusCampaign to determine which campaign to load as the current campaign.
Stores details about the currently loaded Steam Workshop level. Used when playing custom user-created content from the Workshop. Null when playing built-in campaigns.
The default campaign to load when no specific campaign is selected. Initialized to the offline campaign ("vietnam") by default.
Whether the default deathmatch campaign should be included in the versus rotation. Allows the built-in deathmatch maps to be part of the rotation.
Whether the default race campaign should be included in the versus rotation. Allows the built-in race maps to be part of the rotation.
The campaign name for the Expendabros crossover content. Set to "Expendabros_Campaign" to identify and load Expendabros-specific levels.
Private flag tracking whether the Steam Workshop query callback has been initialized. Prevents duplicate callback registration when querying Workshop content.
Flag indicating whether the currently loaded campaign is an online multiplayer campaign. Used to determine networking behavior and level selection logic.
Private field tracking the index of the last versus campaign played. Initialized to -100 to ensure no campaign matches on first selection. Used to prevent immediate repetition of versus campaigns.
Stores the workshop level details for the current campaign in the versus rotation. Contains metadata about the current online deathmatch level including file ID and creator info. Set when online VS levels are loaded from Steam Workshop query results. Used to track which specific workshop level is currently active in the rotation.
Stores the workshop level details for the next campaign queued in the versus rotation. Contains metadata about the next online deathmatch level to be loaded after the current one. Set when selecting random levels from the online VS levels list during Steam query processing. Cleared when the next level is promoted to current in LoadNextVersusCampaign.
Private Steam API callback result for Workshop content queries. Used internally when fetching lists of available Workshop levels for versus mode or custom campaigns.
Flag indicating whether the game should load a published campaign from the Workshop or other external source. Checked during campaign loading to determine the source.
Stores pre-loaded map data to be used when LoadFromMapdata mode is active. Allows external code to set specific map data before level loading.
Stores the next campaign queued in the versus mode rotation for online deathmatch games. When the current VS rotation campaign ends, this campaign becomes the new current campaign. Gets set by DmRotationLevelLoadComplete when a second campaign loads while one is already current. Cleared after being promoted to current campaign in LoadNextVersusCampaign.
The default campaign name used for offline single-player gameplay. Set to "vietnam" to use the standard Vietnam campaign levels.
The default campaign name used for online multiplayer gameplay. Set to "VietnamNetworked" to use the networked version of the Vietnam campaign levels.
Private list storing available online versus mode levels from the Workshop. Used to randomly select levels for versus mode rotation without repeating recently played levels.
Indicates whether the game is currently using online deathmatch level rotation mode. When true, LoadNextVersusCampaign will use the VS rotation campaign fields instead of standard progression. Set to false during initialization and controlled by the deathmatch menu system. Determines whether to use rotation-based campaign loading for versus mode.
List of campaign file names included in the versus mode rotation. Used for offline deathmatch and race modes to cycle through available maps.
Gets or sets the current level number (index) within the active campaign. This property wraps GameState.Instance.levelNumber for consistency.
Counter for exhibition mode levels. Initialized to -1, likely incremented during exhibition gameplay to track progress or determine exhibition-specific behavior.
Constant defining the level number for the Brodown Burning Jungle level. Set to 1, used for identifying this specific level in campaigns or level sequences.
Constant defining the level number for the Brodown City level. Set to 2, used for identifying this specific level in campaigns or level sequences.
Flag tracking whether the helicopter intro sequence has been shown to the player. Prevents the intro from playing multiple times when starting campaigns from the beginning.
The total number of levels available in arcade mode. Set to 63, used to determine when players have completed all arcade content and for progress tracking.
Gets the total number of levels in the current campaign based on the game mode.
Returns:
-
int
: The number of levels in the current campaign. Returns 1 for cutscene mode, 0 if no campaign is loaded, or the actual campaign length for other modes.
Determines whether the currently loaded campaign is a custom campaign (user-created or from Steam Workshop).
Returns:
-
bool
: True if either loadCustomCampaign or isOnlineCampaign flags are set, false for built-in campaigns.
Determines whether the game is currently playing procedurally generated levels rather than pre-designed campaign levels.
Returns:
-
bool
: True if not in world map mode and the load mode is set to Generated, false otherwise.
Determines whether the game is currently in world map campaign mode where players progress through a 3D world map selecting territories.
Returns:
-
bool
: True if the returnToWorldMap flag is set, false otherwise.
Determines whether Ash Williams and his car should spawn in the current level. This is used for special Evil Dead crossover content in specific levels.
Returns:
-
bool
: True if the current level's description contains "deep throat" (case-insensitive), false otherwise.
Gets the appropriate scene name for the current game mode. Different game modes use different scenes to handle their specific gameplay requirements.
Gets the name of the victory scene to use when completing a custom campaign. Returns different scene names based on whether Steam is enabled to handle different victory screen requirements.
Gets the name of the campaign to use in exhibition mode, which varies based on demo settings and current scene. This property determines which special campaign should be loaded for exhibition/demo builds.
Gets the appropriate main menu scene name based on the build type. Returns different scene names for the Expendabros promotional build versus the standard Broforce build.
Private constant storing the main menu scene name. Set to "MainMenu" and used internally for scene transitions back to the main game menu.
The scene name used for brodown game mode. Default value is "Test Evan2".
The current scene name used for campaign mode. Default value is "Test Evan2".
The default scene name for campaign mode. Used as a fallback when no specific campaign scene is set. Default value is "Test Evan2".
The scene name used for deathmatch game mode. Default value is "Test Evan2".
The scene name used for explosion run game mode. Default value is "Test Evan2".
The scene name for the game over cutscene. Set to "CutsceneGameOver" which plays when all players have died and no lives remain.
The scene name for the Hell-themed arcade mode. Set to "WM_Hell" which represents the Hell world map used in arcade gameplay.
The scene name for the hero selection screen. Set to "HeroSelect" which allows players to choose their character before starting gameplay.
The scene name for the game's intro cutscene. Set to "Intro" which plays when starting a new campaign from the beginning.
The scene name used for joining multiplayer games. Default value is "newJoin".
Constant defining the level number for the Brodown jungle level. Value is 0.
The scene name for the Expendabros-specific main menu. Set to "MainMenuExpendabros" to provide a themed menu for the Expendabros crossover content.
The scene name for the victory screen shown after completing offline custom campaigns. Set to "VictoryCustomCampaign" to provide a different ending for user-created content.
The scene name used for race game mode. Default value is "Test Evan2".
The scene name used for suicide horde game mode. Default value is "Test Evan2".
The scene name for the standard victory screen. Set to "Polaroid" which displays the victory polaroid photo sequence after completing a campaign.
The scene name for the world map screen. Default value is "WorldMap3D".
Gets whether the player is currently in an active game (not in the main menu).
Gets whether the currently active scene is the campaign gameplay scene.
Gets whether the currently active scene is the loading screen scene.
Gets whether the currently active scene is the main menu scene.
Gets whether the main menu scene is currently set to load next (during scene transitions).
Gets whether the currently active scene is the 3D world map scene.