Tag requests

@AIAndy

attachment.php


Could you have the new code show up in the Req section of the pedia with their images. Here you see a Conquistador that requires Spanish AND Firearms AND Sulphur AND Horse. Only the Sulphur shows above since its in the old code. Could you make the new code also shoe up there too.

Thanks!
 
@AIAndy

attachment.php


Could you have the new code show up in the Req section of the pedia with their images. Here you see a Conquistador that requires Spanish AND Firearms AND Sulphur AND Horse. Only the Sulphur shows above since its in the old code. Could you make the new code also shoe up there too.

Thanks!
That is non trivial considering that the expression can define quite complex combinations.
 
If I can get the Mangroves feature working and if we want the Natural Wonders mod included we will need some new tags on features. The NW mod has most but is missing the equivalent to land next to sea and sea next to land. I think these both occur on buildings so the same name for the same thing would be good.

Mangroves need to be on swamp terrain next to tropical or temperate coast for example.
 
If I can get the Mangroves feature working and if we want the Natural Wonders mod included we will need some new tags on features. The NW mod has most but is missing the equivalent to land next to sea and sea next to land. I think these both occur on buildings so the same name for the same thing would be good.

Mangroves need to be on swamp terrain next to tropical or temperate coast for example.

Are these Natural wonders going to be closer to dacubz's Natural wonders or closer to Platyping's Natural Wonders?
 
They are the same thing. Almost. They are both described in the XML, daxubz just ignores the XML while Platyping uses it just like map scripts do. So p's will only require XML to add and edit while d's require both XML and python.
 
This came up over in my Old Wonders - New Abilities thread. Could we get an <iGlobalRelationsChange> tag for buildings and events? This would be similar to what happens with civics that adjust relations.

For example, a building that grants +3 relations with all leaders would have this:
Code:
<iGlobalRelationsChange>3</iGlobalRelationsChange>

This would mean that we wouldn't need Python for Field of the Cloth of Gold and (I think) Taipei 101. Putting the relations tag in an XML would allow the AI to evaluate the effect.

We could also use a negative version as a drawback. The Manhattan Project could have
Code:
<iGlobalRelationsChange>-2</iGlobalRelationsChange>

and the builder would get -2 relations with all AI players just for building it. We don't need to have that, but I'm using it as an example.
 
This came up over in my Old Wonders - New Abilities thread. Could we get an <iGlobalRelationsChange> tag for buildings and events? This would be similar to what happens with civics that adjust relations.

For example, a building that grants +3 relations with all leaders would have this:
Code:
<iGlobalRelationsChange>3</iGlobalRelationsChange>

This would mean that we wouldn't need Python for Field of the Cloth of Gold and (I think) Taipei 101. Putting the relations tag in an XML would allow the AI to evaluate the effect.

We could also use a negative version as a drawback. The Manhattan Project could have
Code:
<iGlobalRelationsChange>-2</iGlobalRelationsChange>

and the builder would get -2 relations with all AI players just for building it. We don't need to have that, but I'm using it as an example.

Good one for ls612 to have a go at. It's relatively self contained and simple, and once you've done one tag request, you pretty much learn most of what you need to know to most others.
 
Good one for ls612 to have a go at. It's relatively self contained and simple, and once you've done one tag request, you pretty much learn most of what you need to know to most others.

Great. If he can get that one to work, I have a few other tags to propose that are generally straight mathematical adjustments (like a multiplier effect to a Great Person mission, or bonus happiness from your State Religion regardless of which religion it is). But those aren't high priority.
 
Good one for ls612 to have a go at. It's relatively self contained and simple, and once you've done one tag request, you pretty much learn most of what you need to know to most others.

Good idea, I'll try that.

Edit: I've figured out all of the stuff to actually put the tag in the XML, but I can't find the function that figures out what the AI's relation to you is. What function is that?
 
A mechanic I quite liked from Master of Mana (a FFH modmod) are the building tags that give yields or commerce to a city that has access to a resource, but then improves that bonus as you gain more resources.

It's actually quite a few tags, here's an example, from the (MoM) Bakery building:

Spoiler :
<BonusYieldType>YIELD_FOOD</BonusYieldType>
<iInitialValue>100</iInitialValue>
<iPerBonusValue>50</iPerBonusValue>
<BonusesLinked>
<BonusLinked>
<BonusType>BONUS_WHEAT</BonusType>
<bLinked>1</bLinked>
</BonusLinked>
<BonusLinked>
<BonusType>BONUS_RICE</BonusType>
<bLinked>1</bLinked>
</BonusLinked>
<BonusLinked>
<BonusType>BONUS_CORN</BonusType>
<bLinked>1</bLinked>
</BonusLinked>
</BonusesLinked>


<BonusYieldType>YIELD_FOOD</BonusYieldType> says that the building provides food. <BonusCommerceType> can give gold, science, culture or espionage instead.
<iInitialValue>100</iInitialValue> means that, with access to at least one of the listed resources, the city gain +1 food.
<iPerBonusValue>50</iPerBonusValue> gives +0.5 food for every subsequent resource on the list that you gain.
<BonusesLinked> gives a list of all the resources that provide the bonus.
So, this bakery gives you 1 food if the city has access to any grain resource, and an extra half a food for every additional grain.

I think Master of Mana introduced this system to do away with corporations, because it's a very similar system (encourages the hoarding of resources and building more than one bonus building in your empire), except without all the tedious bother of building a damn executive, sending him to a city, then watching in helpless rage as the corporation fails to spread.

But perhaps this could work in C2C, with all its manufactured resources? For example, a bakery providing food for every grain and/or flour (produced by wheat/barley/corn farm buildings, not the improvements, though they require the improvements). A grocery/supermarket giving food and a touch of gold for every berries and fruit resource. Butchery giving food for every carcass. Sausage maker giving food for every raw meat. Sausage shop giving food for every sausage. Paleontology lab giving science for every fossils. Construction firm giving production for every wood and steel and cement. This sort of system would actually make it worthwhile building multiple pottery and glass factories, and using the great farmer to give a city a variety of different terrain resources to get access to the cross-resource buildings (all those crazy farms and hunting camps), rather than spamming wheat everywhere.
 
Good idea, I'll try that.

Edit: I've figured out all of the stuff to actually put the tag in the XML, but I can't find the function that figures out what the AI's relation to you is. What function is that?

Not entirely sure what you mean by "the AI's relation to you". If you mean "how does the AI evaluate this tag" the the answer is CvPlayerAI::AI_civicValue() is where you need to add evaluation of this value.
 
Not entirely sure what you mean by "the AI's relation to you". If you mean "how does the AI evaluate this tag" the the answer is CvPlayerAI::AI_civicValue() is where you need to add evaluation of this value.

Wait, I thought that Vokarya was asking for a tag on a building that would modify your diplomatic relations with other civs if you built that building. I am stuck on the "finding if a building with a nonzero value of that tag exists, and if yes, changing the AI's relationship numbers accordingly". I'm not certain how that relates to civics.
 
This came up over in my Old Wonders - New Abilities thread. Could we get an <iGlobalRelationsChange> tag for buildings and events? This would be similar to what happens with civics that adjust relations.

For example, a building that grants +3 relations with all leaders would have this:
Code:
<iGlobalRelationsChange>3</iGlobalRelationsChange>

This would mean that we wouldn't need Python for Field of the Cloth of Gold and (I think) Taipei 101. Putting the relations tag in an XML would allow the AI to evaluate the effect.

We could also use a negative version as a drawback. The Manhattan Project could have
Code:
<iGlobalRelationsChange>-2</iGlobalRelationsChange>

and the builder would get -2 relations with all AI players just for building it. We don't need to have that, but I'm using it as an example.

Not entirely sure what you mean by "the AI's relation to you". If you mean "how does the AI evaluate this tag" the the answer is CvPlayerAI::AI_civicValue() is where you need to add evaluation of this value.

I assume he is referring to the actual relationship value (attitude) between you and the AI nation. This would indeed be a great one and I have also asked for it before. In python you have to loop through adding/subtracting 1 and then checking the relationship again until you reach the desired result. If we knew how many 1's made a point of attitude it would be easier. ;)
 
Wait, I thought that Vokarya was asking for a tag on a building that would modify your diplomatic relations with other civs if you built that building. I am stuck on the "finding if a building with a nonzero value of that tag exists, and if yes, changing the AI's relationship numbers accordingly". I'm not certain how that relates to civics.

Oh sorry, I thought it was a civic tag. In that case the routines you need are:

cvCity::processBuilding() which adds or removes the effect of that building (as defined by it's tags) when it is built, destroyed, disabled, re-enabled etc. For the AI to evaluate it you need to modify CvCityAI::buildingValueThresholdOriginal() (or something like that - this is from memory) and a sister routine, that does the same thing, but in a way that is much more efficient when you know that multiple queries for different aspects are going to be made (as happens during what to build evaluation). For now, don't worry about the sister routine, and I'll walk over with you how to update it after you do the easy one (which is the one with the name I was approximating/guessing at above)
 
Oh sorry, I thought it was a civic tag. In that case the routines you need are:

cvCity::processBuilding() which adds or removes the effect of that building (as defined by it's tags) when it is built, destroyed, disabled, re-enabled etc. For the AI to evaluate it you need to modify CvCityAI::buildingValueThresholdOriginal() (or something like that - this is from memory) and a sister routine, that does the same thing, but in a way that is much more efficient when you know that multiple queries for different aspects are going to be made (as happens during what to build evaluation). For now, don't worry about the sister routine, and I'll walk over with you how to update it after you do the easy one (which is the one with the name I was approximating/guessing at above)

I am having much trouble getting a building to affect a value on a player, as opposed to a value in a city. Here is what I have done so far, in pseudocode. I've made the following function to return what the change in AI diplomatic relations should be.

PHP:
void CvCity::changeAIAttitude(int iChange)
{
	for (int iPlayer = 0; iPlayer < MAX_CIV_PLAYERS; ++iPlayer)
	{
		if (!isHuman() && !isBarbarian() && isAlive())
		{
			int iI;
			BuildingTypes eLoopBuilding;
			for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
			{
				if (eLoopBuilding != NO_BUILDING)
				{	
					if (GC.getBuildingInfo(eLoopBuilding).getGlobalRelationsModifier != 0)
					{
						return GC.getBuildingInfo(eLoopBuilding).getGlobalRelationsModifier();
					}
					else
					{
						return 0;
					}
				}
			}
		else
		{
			return 0
		}
	}
}

But I can't figure out how to use the value that that function returns. :( Am I doing this at all right, or am I totally on a wild goose chase?
 
Well, first of all, I'd add the value to the city first, that way you don't have to then cycle through all of the buildings in the city. This is done in the processBuilding function. I can explain more if you get stuck there.

Then go to CvPlayer and pick up the value from CvCity by looping through the cities and totaling up the value there. Then you can plug the modifier into the relations equation. (I say this but I haven't researched enough to be absolutely certain that foreign relations are taken care of in CvPlayer but I have reason to suspect they would be.)

Does this help any?
 
I am having much trouble getting a building to affect a value on a player, as opposed to a value in a city. Here is what I have done so far, in pseudocode. I've made the following function to return what the change in AI diplomatic relations should be.

PHP:
void CvCity::changeAIAttitude(int iChange)
{
	for (int iPlayer = 0; iPlayer < MAX_CIV_PLAYERS; ++iPlayer)
	{
		if (!isHuman() && !isBarbarian() && isAlive())
		{
			int iI;
			BuildingTypes eLoopBuilding;
			for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
			{
				if (eLoopBuilding != NO_BUILDING)
				{	
					if (GC.getBuildingInfo(eLoopBuilding).getGlobalRelationsModifier != 0)
					{
						return GC.getBuildingInfo(eLoopBuilding).getGlobalRelationsModifier();
					}
					else
					{
						return 0;
					}
				}
			}
		else
		{
			return 0
		}
	}
}

But I can't figure out how to use the value that that function returns. :( Am I doing this at all right, or am I totally on a wild goose chase?

There are a number of problems with this:

1) Naming - this method does NOT change the AI attituide, it just gets what the chnage due to buildings is, so yoyu definately shouldn't name it that way (sopmething like getBuildingAttitudeChange() would be more appropriate)

2) As written it calculates the same value in every city, whcuih is the value of all possible buildings since it doesn't check whetehr the city HAS each building before including its contribution. You need an 'if (getNumActiveBuilding(eLoopBuilding) > 0)' test in there inside the loop.

3) I know its only pseudocode so you'd pick this up when you tried to actually compile it, but don't loop over building classes, just loop over buildings directly (i.e. - eLoopBuilding should be you for loop variable)

4) To use it you'll proabbly need to add a loop over cities that calls it and adds up the contribution from each city, to CvPlayerAI::AI_getCivicAttitudeChange(PlayerTypes ePlayer) which currently works out the attitude change due to civics

BTW - it turns out that attitude handling is actually very unusual - almost all building effects are handled in processBuilding() (and almost all civic effects in doCivic()), but attitude calculations are doen totally differently, which is why the pattern for this one is a bit unusual.
 
Back
Top Bottom