Proper Class type for Derived GameModes all in One Level?

markcham
Mon, 15 Aug 2022 18:42:38 +0000
C++

I’m creating an aim training game. I have a seperate level for the main menu, and the shooting range. These both have their own GameModes that I’ve created that work fine, called MainMenuGameModeBase and RangeGameModeBase. They switch between the two when I press start game or quit game using the user interface in game.

My aim training game only has one “game mode” currently, but I want to add more that the player can choose from in the menus. I know that there will be a lot of shared functionality between them, so I want a parent class that can implement those shared functions, and make child classes for each individual “game mode”.

However, I don’t know if it’s good practice to derive from RangeGameModeBase for these child “game modes”. From my searching, it looks like one GameMode per level is the standard practice, but creating 20 identical levels just so they can be assigned their own game mode seems like a waste of resources. Is there a way to implement child classes derived from RangeGameModeBase without creating more levels? Or should I change the class type to something besides GameMode?

Thanks,
Mark

5 posts - 3 participants