Download

How can I make a different game type use different configuration files?

I have released my game and now I want to make a mod or an expansion for it. Now I need to make some changes that I only want to apply to this game type. (Specifically, I have to make some packages always loaded. It takes my pause menu 5 seconds to load the first time, but a few milliseconds to load each subsequent time.)

In my custom game type, I have a command in my expansion’s SRVPlayerController that runs

	SRVGameInfo(WorldInfo.Game).SaveConfig();
class'Engine'.static.GetEngine().SaveConfig();

Those commands just save the base game files

RPGTacGame\Config\RPGTacEngine.ini
RPGTacGame\Config\RPGTacGame.ini

How do I change my mod to create, look for, and use new files?

SRVGame\Config\SRVEngine.ini
SRVGame\Config\SRVGame.ini

My problem right now isn’t really needing different ini files, and it isn’t even really needing to find out how to pre-load assets, even though I should learn how to do both of those. My problem is that my pause menu takes too long to open the first time.

It feels like this is the wrong way to solve the problem, but it works, so I’m keeping it unless I find out how to do it the right way. When the game starts, my HUD runs this function:

function PreLoadPauseMenu()
{
	if(PauseMenuLayer == none)
	{
		PauseMenuLayer = new class'SRVGFxPauseMenu';
		PauseMenuLayer.Init();
		PauseMenuLayer.Start();
		PauseMenuLayer.Close();
		PauseMenuLayer = none;
	}
}

I haven’t timed it, but I’m guess the startup takes about 5 seconds longer. That’s better than waiting 5 seconds for the pause menu to open.

Have you tried adding your pause menu to the startup packages, so that it always loads with any map that is loaded? In DefaultEngine.ini:

[Engine.StartupPackages]

Also, if your pause menu is taking too long to load, I would look at what is happening in your flash movie’s initialization. There must be a lot happening if there is a noticeable lag. My frontend gfx app is huge, but only takes less than half a second to load/initialize.

Personally I load my main menu app when the map loads, and simply hide it when it’s not showing.

I was planning on adding my menu package to that section in the Engine.ini file for the expansion gametype, so that the default gametype wouldn’t waste resources loading a menu it wouldn’t use. You would think that a mod for a game could use different settings files without modifying the defaults.

Anyway, I ran the Gameplay Profiler to see if I could figure out what was going wrong.

It didn’t explain very much. Completely flat, and then a huge spike when I try opening the menu, with almost all of the time spent on GFxMoviePlayer.Start. There is almost nothing in the movie. Literally, almost nothing. A translucent black background and an image in the upper left corner.

I don’t know what’s going wrong there.

My PreLoadPauseMenu function above probably has a similar effect to you loading and hiding your menu. After I’ve run that function, my pause menu opens in 2 ms.

Sorry can’t help i know nothing, lol.

Ask coldscooter he knows the right way to do this.

Personally I don’t like having flash visual code like this in my Unrealscript (like having US create buttons etc). It feels a bit like having frontend logic in your backend code in web development. I think it’s way cleaner to allow your frontend code to handle all frontend logic, and just use simple interfaces to allow US to communicate back and forth with your frontend app.

I know they do it in the example UT code and in some UDN examples, so what do i know. Just seems like bad practice to me.

You can call it bad practice or what ever, but why would i want to use and load the whole frontend when in game (waste). Why not just go to the movie maker eliminate the whole complete front end that is not needed. If you notice both way are starting from the same file. I’m just trying to help, if you do not appreciate what i have to type then you can just figure it out yourself. Have a good day.