Modder's Guide to Utilizing C2C Game Option Edits

@ls612:
AIAndy apparently has a fairly involved concept as to how to improve this setup so that it won't create any possible drag on any loops through the class objects, which this would potentially have.

According to his last message to me on the subject, the XML may well be able to remain the same though so if you want to work on things, this is effectively ready for it and could perhaps only require the slightest of after adjustments.

It might even help to have your developments on the method in XML to aid in testing the coding conversion project he's got in mind. It's not that this mechanism doesn't work and as he said, wouldn't be a problem for traits. But it needs some improvement at his level of programming to be valid for units and promos and such.

You also might want to utilize the new GameOption tag(s) I implemented for designating Incompatible and Prerequisite Gameoptions.

That sounds great, I am done with Positive traits now and just need to write my Negative traits and add my option to the DLL. I'll be committing the new traits on Friday or Saturday along with a bunch of other stuff (I've built up quite a backlog), so at that point I will consider the option playable.
 
I have implemented a similar sort of edit now, the info replacements (fully active as example on unit infos).
Two new tags:

ReplacementID: This identifies the replacement (as the type string has to be the same as the info you want to replace), so if you want to use modularity on the replacements, it recognizes that you want to update a replacement, not add a new one (as there can be any number of replacements for the same info type).

ReplacementCondition: This is a boolean expression tag that means "use this replacement if the expression is true".
A typical replacement would use something like this:
Code:
<ReplacementCondition>
  <Has>
    <GOMType>GOM_OPTION</GOMType>
    <ID>GAMEOPTION_COMPLEX_UNITS</ID>
  </Has>
</ReplacementCondition>

If a replacement is active, the game only sees the replacement unit, the base unit is invisible.
 
I noticed what you posted in the SVN thread and forgot to mention how impressive it is that the replacement condition can be SO many differing possibilities! Truly wicked job done there AIAndy!

How long do you think we'll have to wait before traits are done so ls612 can convert those over to that mechanism? I also have some new trait tags in design at the moment and will need to know if this system requires any changes to the CvInfo.cpp methods. (I suppose I can take a look at the Unit section huh?)
 
I noticed what you posted in the SVN thread and forgot to mention how impressive it is that the replacement condition can be SO many differing possibilities! Truly wicked job done there AIAndy!

How long do you think we'll have to wait before traits are done so ls612 can convert those over to that mechanism? I also have some new trait tags in design at the moment and will need to know if this system requires any changes to the CvInfo.cpp methods. (I suppose I can take a look at the Unit section huh?)
There are very few changes to make to get an info class working with the new system. I'll do it to an example class and commit it so the commit will show very clearly what has to be done. The example will not be traits as traits don't have caching and I want to show all places that need to be changed (I guess it will be tech infos as it is in a different schema, has caching and read pass 3).
 
I have committed a revision now that only contains the changes needed to add tech infos to the info replacement system.
Less than 10 systematic changes needed. The info class itself is not touched.
 
I have committed a revision now that only contains the changes needed to add tech infos to the info replacement system.
Less than 10 systematic changes needed. The info class itself is not touched.

Could you add that to the traits too? Currently it looks like it is on techs and units, and I'd be happy to convert my trait XML to the new system over the weekend if the support is there.
 
Could you add that to the traits too? Currently it looks like it is on techs and units, and I'd be happy to convert my trait XML to the new system over the weekend if the support is there.
Done (the fast way without testing though).
 
I have committed a revision now that only contains the changes needed to add tech infos to the info replacement system.
Less than 10 systematic changes needed. The info class itself is not touched.

VERY cool :D I'll work out the rest as soon as I can!
 
So an Option Edit won't show up as an independently viable entry unless its replacing its edited version, right?

@LS612: I believe it would also replace the use of EditedTrait. While obvious, I figured it would be a good idea to mention it. ALL 3 tags become unnecessary. However, OnGameOption may still have its uses outside of this - for including a NEW game object under a game option that doesn't get used outside of the game option.
 
So an Option Edit won't show up as an independently viable entry unless its replacing its edited version, right?
Yes, it is invisible to all code that uses the normal ways to access info classes.

@LS612: I believe it would also replace the use of EditedTrait. While obvious, I figured it would be a good idea to mention it. ALL 3 tags become unnecessary. However, OnGameOption may still have its uses outside of this - for including a NEW game object under a game option that doesn't get used outside of the game option.
I'd rather if that kind of thing was done by an Inactive tag (or something similar) that marks an info as inactive instead of something that is specific to game options. But for many info classes it is not quite that easy to do that with all the many loops they are accessed from.
 
I'd rather if that kind of thing was done by an Inactive tag (or something similar) that marks an info as inactive instead of something that is specific to game options. But for many info classes it is not quite that easy to do that with all the many loops they are accessed from.
Agreed but I'd have to rely on your expertise in these types of matters to program it ;) It'd be nice if it encompassed at least all 'types' of options somehow.
 
So for Properties we can have:
Properyinfos. Xml

<Tag>PROPERTY_EDUCATION</Tag>
<EducationGameOption>


The string can say :Enables Education Points, that mimick how much education your people have. .

Then in BuildingsInfos

<PropertySource>
<EducationGameOption>
Insert property code
</PropertySource>

For property education.


Would this be possible? It would make Dancing Hoskuld happy.
 
If wanted Education to be a GameOption...Thunderbrd did I do it right?

CIV4GameOptionInfos
Code:
<GameOptionInfo>
            <Type>GAMEOPTION_EDUCATION</Type>
            <Description>TXT_KEY_GAME_EDUCATION</Description>
            <Help>TXT_KEY_GAME_OPTION_EDUCATION</Help>
            <bDefault>1</bDefault>
            <bVisible>1</bVisible>
        </GameOptionInfo>

MrAzureGametexts
Code:
	<TEXT>
		<Tag>TXT_KEY_GAME_OPTION_EDUCATION</Tag>
		<English>Education</English>
		<French>Education</French>
		<German>Education</German>
		<Italian>Education</Italian>
		<Spanish>Education</Spanish>
	</TEXT>
	<TEXT>
		<Tag>TXT_KEY_GAME_OPTION_EDUCATION_HELP</Tag>
		<English>This option enables the Education Property that simulates how much learning you people have. Certain buildings require a number of Education Points to be enabled.</English>
		<French>his option enables the Education Property that simulates how much learning you people have. Certain buildings require a number of Education Points to be enabled..</French>
		<German>This option enables the Education Property that simulates how much learning you people have. Certain buildings require a number of Education Points to be enabled.</German>
		<Italian>his option enables the Education Property that simulates how much learning you people have. Certain buildings require a number of Education Points to be enabled.</Italian>
		<Spanishhis option enables the Education Property that simulates how much learning you people have. Certain buildings require a number of Education Points to be enabled.</Spanish>
	</TEXT>



PropertyInfos Not 100% sure
Code:
<PropertyInfo>
			<Type>PROPERTY_EDUCATION</Type>
			<Description>TXT_KEY_PROPERTY_EDUCATION</Description>
			<Strategy>TXT_KEY_PROPERTY_EDUCATION_STRATEGY</Strategy>
[COLOR="RoyalBlue"]	<OnGameOption>EDUCATION</OnGameOption>	[/COLOR]	

<ValueDisplayText>TXT_KEY_PROPERTY_EDUCATION_DISPLAY</ValueDisplayText>
			<ChangeDisplayText>TXT_KEY_PROPERTY_EDUCATION_CHANGE</ChangeDisplayText>
			<ChangeAllCitiesDisplayText>TXT_KEY_PROPERTY_EDUCATION_CHANGE_ALL_CITIES</ChangeAllCitiesDisplayText>
			<PrereqMinDisplayText>TXT_KEY_PROPERTY_EDUCATION_PREREQ_MIN</PrereqMinDisplayText>
			<PrereqMaxDisplayText>TXT_KEY_PROPERTY_EDUCATION_PREREQ_MAX</PrereqMaxDisplayText>
			<bSourceDrain>0</bSourceDrain>
			<iAIWeight>95</iAIWeight>
			<AIScaleType>AISCALE_CITY</AIScaleType>
			<iOperationalRangeMin>0</iOperationalRangeMin>
			<iOperationalRangeMax>1000000</iOperationalRangeMax>
			<FontButtonIndex>12</FontButtonIndex>
			<PropertyManipulators>
        		<PropertySource>
        			<PropertySourceType>PROPERTYSOURCE_DECAY</PropertySourceType>
          			<PropertyType>PROPERTY_EDUCATION</PropertyType>
          			<GameObjectType>GAMEOBJECT_CITY</GameObjectType>
          			<iPercent>-4</iPercent>
        		</PropertySource>
        		<PropertyPropagator>
         			<PropertyPropagatorType>PROPERTYPROPAGATOR_DIFFUSE</PropertyPropagatorType>
          			<PropertyType>PROPERTY_EDUCATION</PropertyType>
          			<GameObjectType>GAMEOBJECT_CITY</GameObjectType>
          			<TargetObjectType>GAMEOBJECT_CITY</TargetObjectType>
          			<TargetRelationType>RELATION_TRADE</TargetRelationType>
          			<iPercent>5</iPercent>
        		</PropertyPropagator>
        		<PropertyPropagator>
          			<PropertyPropagatorType>PROPERTYPROPAGATOR_DIFFUSE</PropertyPropagatorType>
          			<PropertyType>PROPERTY_EDUCATION</PropertyType>
          			<GameObjectType>GAMEOBJECT_CITY</GameObjectType>
          			<TargetObjectType>GAMEOBJECT_PLOT</TargetObjectType>
          			<TargetRelationType>RELATION_NEAR</TargetRelationType>
          			<iTargetDistance>1</iTargetDistance>
          			<iPercent>5</iPercent>
        		</PropertyPropagator>
        		<PropertyPropagator>
          			<PropertyPropagatorType>PROPERTYPROPAGATOR_DIFFUSE</PropertyPropagatorType>
          			<PropertyType>PROPERTY_EDUCATION</PropertyType>
          			<GameObjectType>GAMEOBJECT_PLOT</GameObjectType>
          			<TargetObjectType>GAMEOBJECT_CITY</TargetObjectType>
          			<TargetRelationType>RELATION_SAME_PLOT</TargetRelationType>
          			<iPercent>20</iPercent>
        		</PropertyPropagator>
        		<PropertyPropagator>
          			<PropertyPropagatorType>PROPERTYPROPAGATOR_DIFFUSE</PropertyPropagatorType>
          			<PropertyType>PROPERTY_EDUCATION</PropertyType>
          			<GameObjectType>GAMEOBJECT_PLOT</GameObjectType>
          			<TargetObjectType>GAMEOBJECT_PLOT</TargetObjectType>
          			<TargetRelationType>RELATION_NEAR</TargetRelationType>
          			<iTargetDistance>1</iTargetDistance>
          			<iPercent>4</iPercent>
          			<Active>
          			  <Is>TAG_OWNED</Is>
          			</Active>
        		</PropertyPropagator>
        		<PropertySource>
          			<PropertySourceType>PROPERTYSOURCE_DECAY</PropertySourceType>
          			<PropertyType>PROPERTY_EDUCATION</PropertyType>
          			<GameObjectType>GAMEOBJECT_PLOT</GameObjectType>
          			<iPercent>-4</iPercent>
        		</PropertySource>
	  		</PropertyManipulators>

BuildingInfos
Code:
<And>
					<Has>
						<GOMType>GOM_OPTION</GOMType>
						<ID>GAMEOPTION_EDUCATION</ID>
					</Has>
				</And>


CvEnums.h
Code:
/************************************************************************************************/
/* Afforess						          END                                                   */
/************************************************************************************************/
#ifdef C2C_BUILD
	GAMEOPTION_DIVINE_PROPHETS,
	GAMEOPTION_NO_CITY_LIMITS,
	GAMEOPTION_NO_FIXED_BORDERS,
	GAMEOPTION_INFINITE_XP,
	GAMEOPTION_UNLIMITED_NATIONAL_UNITS,
	GAMEOPTION_STRENGTH_IN_NUMBERS,
	GAMEOPTION_NO_NEGATIVE_TRAITS,
	GAMEOPTION_PURE_TRAITS,
	GAMEOPTION_LEADERHEAD_LEVELUPS,
	GAMEOPTION_START_NO_POSITIVE_TRAITS,
	GAMEOPTION_NO_NUKES,
	GAMEOPTION_SCALE_CITY_LIMITS,
	GAMEOPTION_COMPLEX_TRAITS,
	GAMEOPTION_LS612_TRAITS,
	GAMEOPTION_RELIGIOUS_DISABLING
     [COLOR="RoyalBlue"]   GAMEOPTION_EDUCATION[/COLOR]
#endif
};
 
1) The enums shouldn't be necessary anymore but I'm not 10000% sure on that yet so it'd be a good test of its necessity which AIAndy assured would not be needed now.

2) You'd need <OnGameOption>GAMEOPTION_EDUCATION</OnGameOption> at least. I'm not fully sure that OnGameOption would work for that either... in its use on a property it's usually used for the replacement mechanism. You aren't using this as a replacement so I don't think you'd need it.

3) <Active>
<Is>TAG_OWNED</Is>
</Active>
and
<And>
<Has>
<GOMType>GOM_OPTION</GOMType>
<ID>GAMEOPTION_EDUCATION</ID>
</Has>
</And>
would probably accomplish the optionalizing of the property itself.

This would be a cool way to go about it. Not exactly modularized but using a method I feel is even better. HOWEVER - be warned that the Option replacement mechanism, while it would be VERY useful for utilization in crafting this option to be balanced with or without the property, is showing a bug and some tests are still needed to figure out the problem. Same bug could have an effect here with even this as it would be so far.

The replacement mechanism is intended to allow a gameobject like a building to be entirely redefined it an option is active as opposed to if it is not. It's new definition replaces the normal one so that you CAN zero out a value. Modularization does not allow a +5 research to be placed at +0 if the module is active but a replacement entry does as it must contain the complete new definition of the object.

The problem we're having seems to be based on the cache needing to be deleted before it is activated (and deleted after a load between the last time the option was selected... something like that) anyhow it's going to take some further tests to isolate and possibly repair the issue. It processes in regions I don't understand too well though so it could be a tough one to fix.

Anyhow, test what edits I just suggested and see how it goes for you.

EDIT: After a quick check I don't believe that OnGameOption is a valid tag for a property at the moment. It could be made but I don't think it's necessary because it's already possible to define under the Active expression.
 
2) You'd need <OnGameOption>GAMEOPTION_EDUCATION</OnGameOption> at least. I'm not fully sure that OnGameOption would work for that either... in its use on a property it's usually used for the replacement mechanism. You aren't using this as a replacement so I don't think you'd need it.

Using the On/Off game option tag turns the whole object (building, unit, tech etc.) on or off depending on the value of the game option. It does not turn the individual WoC update on/off. The game option tag was not added with WoC in mind.

There is a work around so that you can have a WoC update applied only if the game option is on/off. I can explain how if you need to know.
 
Using the On/Off game option tag turns the whole object (building, unit, tech etc.) on or off depending on the value of the game option. It does not turn the individual WoC update on/off. The game option tag was not added with WoC in mind.

There is a work around so that you can have a WoC update applied only if the game option is on/off. I can explain how if you need to know.

We're not talking about modularization at this point. True. I don't believe the OnGameOption nor NotOnGameOption tags were developed for the Property infos. But if it were that's right that it would have nothing to do with modularization.
 
All I am saying is that you can simply do what MrAzure wants with modularisation.

having the Game option tag in the Property Info is correct to turn on/off the property but then all the XML that has that property on it will be wrong. This can be solved by having a module which applies the education property to the buildings etc. but it is not quite that straight forward is all I am saying.

Otherwise if you want to be able to turn on/off education through that option you will have to do something in the dll. You would have to do it in such a way as it is valid for all properties existing and future. This would be good as it would allow us to turn on/off crime for example.

However the property is not just the extra information on the building etc but is also whole buildings and units.

This is another reason to use modules when setting stuff up. It keeps it clear to all where to look for problems and when they want to do work on it.
 
Placing it all into a module is a good idea for organization's sake. To properly be able to extract a property's effects the best method would be the replacement mechanism which is a little bugged at the moment but should be repairable.

The reason being that with modular edits you really can't take an established integer tag down to a null value so it's mostly good for changes and additions but not so good for eliminating an effect.
 
Back
Top Bottom