For modders: GameOptions SDK bug

Dale

Mohawk Games Developer
Joined
Mar 14, 2002
Messages
7,601
Just to let everyone know, if you're making SDK changes and decide to add some GameOptions (regardless of them not showing, but using the Default flag in the xml file to set them) please note the following bug:

In CvEnums.h you set the GAMEOPTION_***** flags. If you add more than two to the list you will not be able to start a game. The "Launch" and "Go Back" buttons become inactive. You can add 1 or 2 more options here, but do not add anymore.

Dale
 
Very wierd.
Any particular reason for that?
 
Dunno, but I informed Trip. Wonder if he can supply an answer. :)

I suspects its because the new game option extends the list (even though it's invisible) below the level of the game options box and over rides the default actions of the bottom bar (which contains the go back and launch buttons). Therefore, the UI is expecting a checkbox click, not a button click.

But that's my suspicion. Can't confirm cuz we don't have the exe code.

Dale
 
My guess on this matter:
Why we can add 1-2 GAMEOPTION_*'s (though the Option screen checkbox description will not displayed properly), but not more than that?
This is related to how it is implemented in CvGame class.
It is implemented as array of bool. the bool array are aligned to 4 byte boundary. Each bool variable in the array uses one byte.
So added new GAMEOPTION will work unless it does not exceed this 4 byte boundary and does not extend byte size of CvGame class. If you have more than 1-2 new options then the size of class shoud be extended by another 4 bytes, then it will not work anymore.
Exe seems that it uses CvGame stcuct by directly including the struct as include file. It should use the class via DLL interface instead.
 
I noticed quite the same.
I wanted to combine some SDK mods. So I defined some options to switch the mods on and off in the CIV4GameOptionInfos.xml and put them into the enum GameOptionTypes in CvEnums.h and the python enum in CyEnumsInterface.cpp.
But my options never appear in the menu.
Does anyone know how to solve this problem?

Matze
 
MatzeHH said:
I noticed quite the same.
Does anyone know how to solve this problem?

Matze

Wait till warlords.
 
I could be mistaken but I believe that Dale has close links with Firaxis, so he would know if they are planing on fixing this bug.
 
BTW, this bug that is affecting GameOptions affects all the elements within CvEnums.h. I had a confirmation that the exe has a static number when calling the tables from CvEnums.h.

This is why we can't add options. We can delete and modify though.

Dale

PS: What Lord Olleus said. :)
 
Is there any chance of them fixing this in a patch before Warlords?
 
Lord Olleus said:
Is there any chance of them fixing this in a patch before Warlords?

Is there even a chance of them fixing this in Warlords? :confused:
 
Lord Olleus said:
Is there any chance of them fixing this in a patch before Warlords?

Dom Pedro II said:
Is there even a chance of them fixing this in Warlords? :confused:

I doubt there will be another patch for Civ4 vanilla coming up before Warlords, as it's due out soon anyways (my opinion here), and as for fixing it in Warlords, the bug has been reported to them. It's up to Firaxis whether the exe is modified or not. That's really all anyone can say. :)

Dale
 
Thanks for this information.
That's really a pity. The game option seemed to be the easiest way to make SDK mods switchable.
And as I understand the code, the options are also accessable through python, so python mods can also be switched on and off.

Matze
 
Dale said:
BTW, this bug that is affecting GameOptions affects all the elements within CvEnums.h. I had a confirmation that the exe has a static number when calling the tables from CvEnums.h.

That's not quite the truth.
I found out, that this problem does not affect all enums in CvEnums.h automatically.
It depends on where the XML-Files are loaded. In CvXMLLoadUtilitySet.cpp are two methods:
1) LoadPreMenuGlobals()
2) LoadPostMenuGlobals()

If I try to load my file in LoadPreMenuGlobals() the error occurs.
But I can have as many enums as I want (hope so), if I load the refering XML-file in LoadPostMenuGlobals().
In my example I have some new options defined in my own XML-file Civ4ModOptionInfos.xml and reflect them in an enum called ModOptionTypes.

Two more problems occured by loading the XML-file in LoadPostMenuGlobals():
1) I can't initialize my member variables in CvInitCore::Init, Reset and SetDefaults, because the XML-file has not loaded yet. Solution: I put all neccessary methods to CvGame::Init and reset.
2) I can't set my options in the main menu, because they have not been loaded. Solution: I made a new python screen and show it directly on game start.

So, I have a full set of new game options with their own enum and XML-file.
In my case I use this to switch mod-components on and off.
The methods like getModOption and setModOption are also exposed to python, so I can also switch pure python mod-components on and off.

Matze
 
MatzeHH:

Okay, I shouldn't stated "the existing elements in CvEnums.h". ;)
 
Thanks for the heads up, just encountered something similar to this, but knew the problem 'cuz of this post.

Just wanted to know though, does anyone know of any reference on different values that are known to be hard-coded, like a quick cheat-sheet that says...

Max number of civs: 18
...etc...

Thanks.
 
Gerikes said:
Thanks for the heads up, just encountered something similar to this, but knew the problem 'cuz of this post.

Just wanted to know though, does anyone know of any reference on different values that are known to be hard-coded, like a quick cheat-sheet that says...

Max number of civs: 18
...etc...

Thanks.

I think even firaxis has to find this through trial and error. It doesn't seem to me (just one guys opinion) that they have intended to impose any limitations. People just try stuff, fail, report it to firaxis, firaxis checks to find out why, and they discover the issue/limitation.
 
Top Bottom