Download

Best Practices: Modifying gameplay variables from a menu?

What is the preferred method for implementing variables which can be adjusted in a menu and are communicated across game modes / maps / etc.?

e.g. a Difficulty Level would be set from the options menu before game start, and that variable would in turn likely influence all sorts of things in the game across ALL maps and modes; things like what AI patterns are in play, total HP of enemies, enemy spawn points, the spawn locations of health pickups, etc.

Surely at this point there’s got to be a standard practice for this sort of thing?

I’m not sure of the standard practice, but I save variables like that to the Game Mode blueprint itself so I can access them anywhere. If you’re changing Game Modes, use the Save Game class and save persistent variables to it that are relevant across different Game Modes (such as difficulty). Save them when you’re about to load a different Game Mode, then load them when the new Game Mode is in effect.

For my project, I save the player settings in a blueprint, then pass that info to the game mode. Then, the game mode(s) can take that info and pass it to the map blueprint and spawn it, or spawn different blueprints and levels based on those player choices.