Dedicated Server build ignores and deletes -gameini config file

I have packaged a game and then separately built a dedicated server (Development Server build configuration). I have tried running this in our server environment.

We have then created a Game.ini file that we put in the same directory as the GameServer.exe file and we started the server with the following GameServer.exe -log -gameini=Game.ini

The server starts up and the settings are not applied and the Game.ini file still exists but all of its contents have been removed sans 2 bytes for a windows newline “\r\n”.

I tried to figure out what is causing this to occur and really studied the source code. The engine picks up the file and even includes it in the correct section to be processed. It even ignores the other settings in the higher up files. Then it gets to this line in the FConfigCacheIni::LoadGlobalIniFile function:

	// don't write anything to disk in cooked builds - we will always use re-generated INI files anyway.
	if (!FPlatformProperties::RequiresCookedData() || bAllowGeneratedIniWhenCooked)
	{
		// Check the config system for any changes made to defaults and propagate through to the saved.
		NewConfigFile.ProcessSourceAndCheckAgainstBackup();

		if (bResult)
		{
			// if it was dirtied during the above function, save it out now
			NewConfigFile.Write(FinalIniFilename);
		}
	}

This is where the FPlatformProperties::RequiresCookedData() returns false getting us into this if statement where it checks the data against the backup in the CleanSourceConfigs and then overwrites the cached data and then deletes our ini file. The source needs some way of knowing that we were intending to append the Game.ini file and that we do not want to lose our settings. We are using the github release branch of the code which is currently the same as 4.6.1. I think the proper fix may be to convert the || to an && so that it will only overwrite when bAllowGeneratedIniWhenCooked is true and RequiresCookedData is false. Anyhow, we currently have no way of configuring our server through ini files.

Thanks,

When I modify the Engine.ini file in the saved folder it will work, but there is no Game.ini file and if I create one it will delete everything from that file in the Saved folder. Is this normal behavior? How can we modify something in the Game.ini file or is this truly a bug that needs to be fixed?
Thanks,

Hi ,

I apologize for the delayed response to your post. Are you still having trouble with this issue?

When a game is packaged, the config files for the game are stored within the pak file. However, the same relative folders are used inside the pak file (eg. SomeGame/Config). Double-check to make sure you are customizing the config file in your project’s Config folder (not in the Saved folder) and repackage the project to see if that helps.

Hi , the problem is actually that we cannot override any of the game.ini settings from the command line or after the game has already been packaged. We can easily change settings before packaging, that is not a problem. The problem is after distribution we cannot change the values by changing the ini files. I have changed other ini files and they work fine, but the game.ini file is the problem and always gets overwritten. We are still having this problem and this is still an open issue. I think it may have to do with GameModes being selected in the Level BP prior to packaging. Can you check into it?

Hi ,

I just got back some new information related to the issue that you have described here. To accomplish what you want to do, it looks like you will want to use -defgameini= instead of -gameini=. The latter is apparently just specifying the name of the generated ini file created when the server is run.

However, I was also informed that the -defgameini argument has been broken for a fairly long time. One of our developers just checked in a fix for this as a result of this post, so thank you for letting us know that this was a problem for you. If you are using the source code from GitHub, you can find the commit containing this fix here. If you are using the binary version of the Engine, the fix will be included in a future release version of the Engine.

I am also planning on getting in touch with our documentation team to see if we might be able to better clarify the differences between using the -defgameini= and -gameini= arguments

Awesome, thanks so much ! (: