View Full Version : For modders: GameOptions SDK bug
Dale Jun 01, 2006, 05:35 PM 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
Lord Olleus Jun 01, 2006, 05:38 PM Very wierd.
Any particular reason for that?
Dale Jun 01, 2006, 05:40 PM 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
SimCutie Jun 01, 2006, 06:10 PM 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.
MatzeHH Jun 09, 2006, 11:25 AM 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
Dale Jun 09, 2006, 12:40 PM I noticed quite the same.
Does anyone know how to solve this problem?
Matze
Wait till warlords.
MatzeHH Jun 09, 2006, 12:49 PM Wait till warlords.
Huh?
Do you know something we don't?
Matze
jbfballrb Jun 09, 2006, 12:54 PM He could just mean that this thing might be fixed/changed in Warlords
Lord Olleus Jun 09, 2006, 03:47 PM 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.
Dale Jun 09, 2006, 04:32 PM 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. :)
Lord Olleus Jun 09, 2006, 05:52 PM Is there any chance of them fixing this in a patch before Warlords?
Dom Pedro II Jun 09, 2006, 07:27 PM 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:
Dale Jun 09, 2006, 07:43 PM 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:
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
MatzeHH Jun 10, 2006, 02:22 AM 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
MatzeHH Jun 21, 2006, 11:39 PM 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
Dale Jun 22, 2006, 03:15 AM MatzeHH:
Okay, I shouldn't stated "the existing elements in CvEnums.h". ;)
Gerikes Jun 24, 2006, 11:08 PM 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.
Kael Jun 25, 2006, 09:20 PM 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.
MatzeHH Jul 29, 2006, 06:17 AM Can anybody tell, if this bug is really fixed with Warlords?
Matze
MatzeHH Aug 10, 2006, 07:32 AM *bump*
Nobody?
Matze
Dale Aug 10, 2006, 07:58 AM Yes, it is fixed. I personally have had 5 new game options in Warlords. :)
Dale
MatzeHH Aug 10, 2006, 08:07 AM Thx.
Matze
Impaler[WrG] Aug 10, 2006, 12:17 PM [Mr.Burns Voice]EXCELENT![/Mr.Burns Voice]
New CustomGame options should become the standard and prefered means of controling new modified game rules on custom DLL's. It offers great flexibility and cant be toggled once a game has begun.
|
|