Download

How to properly use config INIs for server/game settings?

Hi, so I made several UPROPERTY(config) variables in my game mode that set a timer for different game states (similar to the Shooter game provided). I have several questions on how to take advantage of configurables:

  1. They don’t show up in the DefaultGame.ini automatically, so I go ahead and write them in. Is there a better way to set them up after you’ve added them to the game mode class (or any class with config=game)?

  2. When the editor is already running, changing DefaultGame.ini doesn’t have any effect, presumably because the values are loaded from Saved/Config Game.ini now? But the WindowsNoEditor/Game.ini is empty, so I have to copy from the Clean configs, and then change what I copied?

  3. So what I was hoping to do with the INIs is: when playtesting my multiplayer game, edit the Configs/WindowsNoEditor/Game.ini with different timer lengths and restart the server to see how it plays. Unfortunately, it seems most of the time Game.ini is simply overwritten to be blank. In fact, even the DefaultGame or CleanSource ini files aren’t loading. Is Game.ini supposed to be cleared?

  4. This might be another issue, but my DefaultGame.ini values are no longer loading in the editor. I had PostLoad setting specific values for my configurables when GIsEditor, but it seems those values are now permanent. I can’t seem to purge them, and even after thoroughly cleaning the repository of all generated files, the values I had been setting for GIsEditor now load every time, both for the packaged game and the editor (even though I removed the PostLoad code). Any idea what’s going on here?

So, I’m feeling really lost with INIs… Can someone provide input?|

I posted this on the answerhub but no luck :confused:

Upon further investigation, it appears I some how permanently saved the config values to the GameModeBP.uasset. I don’t understand how that happened, but I “fixed” it by calling ReloadConfig() after the properties were initialized. However, other configurables from the parent class were permanently saved to the file, and so now I have to override them not in the constructor but after property initialization. This is annoying, and I’ll need to find a way to resave the blueprint so it doesn’t have these values permanently saved. I don’t understand how this happened to begin with.

My guess is that PostLoad() only occurs on object templates (or maybe default objects), and so I shouldn’t have modified those variables in PostLoad because that was permanently changing the template. When I saved it at some point in the editor, the values were permanently saved to the asset, and they take precedence over the config values. To really fix this, I need to find a way to resave the asset without those variables embedded, which I don’t know how to do.

Did you ever find a good solution for this problem? Do you think this is the same as the problem I was having? https://forums.unrealengine.com/showthread.php?59689-Game-ini-cannot-be-overridden-How-does-one-override-the-Game-ini-file

Thanks,
Kory