The Outcome System

I mean a new callback similar to the ones available in events that you would be able to add to outcomes so to make a mission you would make an outcome mission but then add a Python function name to the outcome that would be called when the outcome is executed.

If you do this you also need to add some means for the AI to evaluate the outcome, presum,ably through furtehr XML tagging that decribed what it does in some way that the AI can put a value on.
 
If you do this you also need to add some means for the AI to evaluate the outcome, presum,ably through furtehr XML tagging that decribed what it does in some way that the AI can put a value on.
Chances are high that Python based outcomes need specific AI anyway.
Currently the auto evaluation is only used in the case of subdued animals.
 
Chances are high that Python based outcomes need specific AI anyway.
Currently the auto evaluation is only used in the case of subdued animals.

Ah ok. I see this as a stopper for v22 then. Can't really have such a major feature utterly unused by the AI in a release.
 
Ah ok. I see this as a stopper for v22 then. Can't really have such a major feature utterly unused by the AI in a release.
Yes, definitely not something for this release.
I am not entirely sure what exactly DH wants to do with it.
 
Orion Veteran's Immigration and Mine warfare mods add missions to units. The AI for the AI is already there and they do the stuff but the player can't unless a button is added to the screen and calls the same code as the AI uses.

There are a number of interesting mods out there that have this sort of function but it is difficult to merge them at the moment.
 
I've noticed something with the outcome when killing an animal, either during combat or when butchering it:
If not building a unit or building in a city, for instance if building Wealth or Research, or if last build item got finished and no new one has been set yet, all hammers from the outcome are simply lost, gone, wasted.

No idea if anything can be done about it but either something should, or something stated about how that happens. Similarly the outcome food going towards city growth rather than worker/settler unit being built should probably also be stated somewhere.

Cheers
 
Is the Outcome XML Woc modular. In particular for animals I would like to allow people the option of escorting their captures back or not.

IE
Code:
			<KillOutcomes>
				<Outcome>
					<OutcomeType>OUTCOME_SUBDUE</OutcomeType>
					<iChance>10</iChance>
					<UnitType>UNIT_SUBDUED_AARDVARK</UnitType>
					[B]<bUnitToCity>1</bUnitToCity>[/B]
				</Outcome>
				<Outcome>
					<OutcomeType>OUTCOME_HUNTING_KILL</OutcomeType>
					<iChance>90</iChance>
					<Yields>
						<iYield>3</iYield>
						<iYield>1</iYield>
						<iYield>0</iYield>
					</Yields>
				</Outcome>
			</KillOutcomes>
if they don't and
Code:
			<KillOutcomes>
				<Outcome>
					<OutcomeType>OUTCOME_SUBDUE</OutcomeType>
					<iChance>10</iChance>
					<UnitType>UNIT_SUBDUED_AARDVARK</UnitType>
					[B]<bUnitToCity>0</bUnitToCity>[/B]
				</Outcome>
				<Outcome>
					<OutcomeType>OUTCOME_HUNTING_KILL</OutcomeType>
					<iChance>90</iChance>
					<Yields>
						<iYield>3</iYield>
						<iYield>1</iYield>
						<iYield>0</iYield>
					</Yields>
				</Outcome>
			</KillOutcomes>
if they do.

Normally I would put the do in the main file then have an optional XML file containing just the changes needed for the other option. Normally in WOC it would be

Code:
		<UnitInfo>
			<Class>UNITCLASS_SUBDUED_AARDVARK</Class>
			<Type>UNIT_SUBDUED_AARDVARK</Type>
			<KillOutcomes>
				<Outcome>
					<OutcomeType>OUTCOME_SUBDUE</OutcomeType>
					<bUnitToCity>1</bUnitToCity>
				</Outcome>
			</KillOutcomes>
		</UnitInfo>
 
Is the Outcome XML Woc modular. In particular for animals I would like to allow people the option of escorting their captures back or not.
There were three different modularity semantics I had to choose from:
  1. Replace the outcome list if a new one is defined in the module
  2. Merge by position in the list (so first outcome in the module is assumed to correspond to first outcome in the original XML)
  3. Merge by outcome type

1. was the easy solution which is how it currently is. So it assumes that if you specify a KillOutcomes that you want a new outcome list.
The problem with 2. is that merging by number, while easy to implement, is somewhat awkward.
3. has the problem that it is currently allowed to have more than one outcome with the same outcome type in a list.

If we usually have only one outcome with the same type in a list, we can go for 3.
 
What you have is fine. I don't mind copying the whole of kill outcomes for a single variable change. Just so I know is all. I will assume the last loaded is the final values.

I am going to have to do something about sub setting the animals for graphically challenged machines as well.
 
You can now have temporary happiness (+1 only but you can specify the amount of turns) and property changes in outcomes like this:

Code:
<iHappinessTimer>5</iHappinessTimer>
<Properties>
  <Property>
    <PropertyType>PROPERTY_CRIME</PropertyType>
    <iPropertyValue>-10</iPropertyValue>
  </Property>
</Properties>
 
You can now have temporary happiness (+1 only but you can specify the amount of turns) and property changes in outcomes like this:

Code:
<iHappinessTimer>5</iHappinessTimer>
<Properties>
  <Property>
    <PropertyType>PROPERTY_CRIME</PropertyType>
    <iPropertyValue>-10</iPropertyValue>
  </Property>
</Properties>

Did you add the necessary evaluation code to the outcome selection AI you wrote previously?

Also, can outcomes be enabled by civics? If so this could lead to possibilities like 'sacrificing' a military (or worker) unit as an example to the population (one-off-crime reduction) - requires despotism or slavery (say).
 
Did you add the necessary evaluation code to the outcome selection AI you wrote previously?
For the happiness timer, yes, but not for the property change. Hard to say what value a one time property change has.

Also, can outcomes be enabled by civics? If so this could lead to possibilities like 'sacrificing' a military (or worker) unit as an example to the population (one-off-crime reduction) - requires despotism or slavery (say).
While the code is not yet in for that, it is easy to add.
 
For the happiness timer, yes, but not for the property change. Hard to say what value a one time property change has.

Well, depends on whetehr its applied to a property that is dynamically sourced (like crime), or statically set (like flamability).

In fact that raises the question - does it even WORK for statically sourced properties (think modifier recalc here)? These two types of property are becoming so different that you probably need to add some policign so that its illegal for the XML to mix them on any oparticular property (and the outcome stuff would probably then only be legally applicable to sourced properties??)

As to its value - the AI property evaluator (as used in CvCityAI) gives a number that is intended to be a gold-per-turn equivalent. Therefore the value is:

(CityEval(<equilibrium value> + <outcome value>) - CityEval(<equilibrium value>))*<expected turns to return to equilibrium value>/2

at least assuming the city is near its equilibrium point at the time.
 
Well, depends on whetehr its applied to a property that is dynamically sourced (like crime), or statically set (like flamability).

In fact that raises the question - does it even WORK for statically sourced properties (think modifier recalc here)? These two types of property are becoming so different that you probably need to add some policign so that its illegal for the XML to mix them on any oparticular property (and the outcome stuff would probably then only be legally applicable to sourced properties??)
Correct, this is only allowed for dynamic properties, not for static. Static, if desired, would require some temporary addition of the value that is recalc safe.

As to its value - the AI property evaluator (as used in CvCityAI) gives a number that is intended to be a gold-per-turn equivalent. Therefore the value is:

(CityEval(<equilibrium value> + <outcome value>) - CityEval(<equilibrium value>))*<expected turns to return to equilibrium value>/2

at least assuming the city is near its equilibrium point at the time.
That sounds good.
 
I added PrereqCivic to outcome types now.
The AI property evaluator in CvCityAI needs some splitting up before it can be called in that way so that is not yet in.
 
I added PrereqCivic to outcome types now.
The AI property evaluator in CvCityAI needs some splitting up before it can be called in that way so that is not yet in.

I'm going to be bogged down in the pathing engine rewrite for several more days yet - will you do the necessary splitting out, or need me to do that when I get done with the pathing?
 
From SVN discussion
Updates
Added different costs to outcome missions:

bKill to determine if the unit is consumed (default true)
iCost makes the mission cost gold
PropertyCost adds a cost in properties to the mission (PayerType determines which game object type associated with the unit pays the property cost)

Will you be adding a "turns to accomplish" tag? Acts similar to turns in building improvements? I think that may then be enough to convert some of the WLBO missions as well as one of Katy's mods for explicit city ruin exploration.
 
From SVN discussion


Will you be adding a "turns to accomplish" tag? Acts similar to turns in building improvements? I think that may then be enough to convert some of the WLBO missions as well as one of Katy's mods for explicit city ruin exploration.
I can do that.
What I added now can also be used to have abilities with a cooldown. Just add a new property like energy or something with a limited constant source on the unit and then add an outcome mission with a cost in that property.
 
It is always when I get around to trying to add something that I find I need something different to what is available.:mischief:

While converting Capt_Blondbeard's Barbarian Envoy mod to outcomes I realised that it

1) can only occur in a barbarian city

2) the probability of the events is modified by the population

3) one result has a number of units joining you as tribute, not just one

4) one result has a random amount of gold paid to you as tribute.
This of course reminded me that the WLBO mod gooddy hut/village also needs its missions limited to a feature as does Kathy's Explore City Ruins.

So can the mission/outcome

1) be limited to only barbarian cities or to a feature such as goody_village (to be added) or city_ruins.

2)call some python code
OR
If city based have a probability (set) based on the population EG
rand value <= 28-2*pop gives outcome 1
28-2*pop < rand value <= 28-2*pop + 20 gives outcome 2
28-2*pop + 20 < rand value <= 28-2*pop + 40 gives outcome 3
else gives outcome 4


 
Top Bottom