New Bonus Placement Build Tag

Thunderbrd

C2C War Dog
Joined
Jan 2, 2010
Messages
29,811
Location
Las Vegas
Ok, so Toffer requested that I share the syntax for this tag and I felt I would bring it up in the open to maybe whet some appetites for seeing it implemented in the game soon in a number of different ways. I'd like to talk also about how this can be applied and start formulating some plans and team efforts to implement them.

In short, we all know what the Great Farmer currently does. He takes access to a list of resources and converts that into the capability to select a work build command mission to place one of those resources in a tile that has no other resources (even hidden ones). It takes time to complete this mission but once he finishes you now have a new source, on a tile, of that map based resource. He has to have access to the resource (you must have it somehow) because otherwise he doesn't have the animal stock to breed or the flora to plant. But it allows you to ensure that you can establish your own source so that you are no longer reliant.

Over the years, we've had a number of ideas come up about this, about expanding on this concept. But apparently, the way it was implemented we only have the portal for one unit to ever use through a python programming method, and apparently something has broken about that programming recently anyhow.

So for a long time it's been a plan to create a tag that allows us to design build command missions that units can be given access to that will allow them to place bonuses on plots, but not necessarily with the same absolute reliability or player planning that the Great Farmer currently has, though still allowing us to set it up to BE that reliable if we wish.

Why?

Ok, so , RL speaking here, in the minerals field, a Prospector goes out to a tract of land upon which he may be considering, thanks to an investor, what a mine would derive from that plot. Maybe something good, who knows what, and maybe nothing really all that lucrative at all. But his job is not to force the soon to be mine to go digging for whatever the investor wishes to find, but rather to inform the investor what will be found once the digging commences. He goes and tests the minerals in the Earth to evaluate what will be found there.

A farmer taming a new tract of land is likewise going to try different crops to see what kind of crops grow best in that environment and soil and so on. The famous Idaho potatoes were discovered to do well in that region where very little else did. What is most successful in a region is more a matter of what the region dictates would be successful there rather than what the farmer tries to force out of it.

And yet Ranchers do pretty irreverantly declare large swaths of land, usually not the best for farms, to be the breeding grounds of whatever they wish to ranch there, provided it's at least somewhat good climate for the beasts.

Foresters can cultivate the growth of quality timbers in a particular region...

Anyhow, there's a lot that can be done but every type of resource seems to work a little differently in RL. So why shouldn't it work that way in our mod?

Furthermore, perhaps there should be lesser Farmers, Ranchers, Prospectors, Foresters, Fishers, and so on, all doing their part to put the land to the BEST possible use that land can offer, but not necessarily being the absolute masters of their craft so are more at the whim of what they find, and quite capable of failing to divine the best uses of the land, where the Great versions of these might be far more flawless and given more to being able to choose what they want to force the land into producing with their masterful techniques.

Some of these types need access to what they are trying to cultivate more of. For others it will be a joy of discovery if they are lucky enough to make such a break. So we needed a build tag that allows for all of these kinds of delivery of effect.

For that, I have provided us with PlaceBonusTypes:
Code:
<PlaceBonusTypes>
    <PlaceBonusType>
        <BonusType>BONUS_COPPER</BonusType>
        <iProbability>10</iProbability>
        <bRequiresAccess>0</bRequiresAccess>
        <TechType>TECH_COPPER_WORKING</TechType>
        <TerrainType>NONE</TerrainType>
        <FeatureType>NONE</FeatureType>
        <MapCategoryType>MAP_CATEGORY_EARTH</MapCategoryType>
    </PlaceBonusType>
    <PlaceBonusType>
        <BonusType>BONUS_IRON</BonusType>
        <iProbability>10</iProbability>
        <bRequiresAccess>0</bRequiresAccess>
        <TechType>TECH_IRON_WORKING</TechType>
        <TerrainType>NONE</TerrainType>
        <FeatureType>NONE</FeatureType>
        <MapCategoryType>MAP_CATEGORY_EARTH</MapCategoryType>
    </PlaceBonusType>
    <PlaceBonusType>
        <BonusType>BONUS_SILVER</BonusType>
        <iProbability>10</iProbability>
        <bRequiresAccess>0</bRequiresAccess>
        <TechType>TECH_COPPER_WORKING</TechType>
        <TerrainType>NONE</TerrainType>
        <FeatureType>NONE</FeatureType>
        <MapCategoryType>MAP_CATEGORY_EARTH</MapCategoryType>
    </PlaceBonusType>
    <PlaceBonusType>
        <BonusType>BONUS_GOLD</BonusType>
        <iProbability>10</iProbability>
        <bRequiresAccess>0</bRequiresAccess>
        <TechType>TECH_LEAD_WORKING</TechType>
        <TerrainType>NONE</TerrainType>
        <FeatureType>NONE</FeatureType>
        <MapCategoryType>MAP_CATEGORY_EARTH</MapCategoryType>
    </PlaceBonusType>
    <PlaceBonusType>
        <BonusType>BONUS_LEAD</BonusType>
        <iProbability>10</iProbability>
        <bRequiresAccess>0</bRequiresAccess>
        <TechType>TECH_LEAD_WORKING</TechType>
        <TerrainType>NONE</TerrainType>
        <FeatureType>NONE</FeatureType>
        <MapCategoryType>MAP_CATEGORY_EARTH</MapCategoryType>
    </PlaceBonusType>
</PlaceBonusTypes>

This is a very loose example one might program on a Build define you'd setup for some early game metal hound Prospector. I'm showing all possible nested tags though if you don't include the use of one, it's best not to include it at all rather than showing 'NONE' as these examples do.

Also keep in mind that there's a lot to define this mission with in the other Build tags available to you so a lot of these nested tags DON'T NEED to be utilized. They only do if you are trying to specify details for that particular type of terrain, Tech, Feature, or Map Category because as prereqs, those can apply to the build. It's best to think of these nested specifiers as being used to craft the conditions in which that amount of added probability is given for that type of bonus placement chance. Thus you can make it more likely at certain techs that you will be able to successfully discover a particular desired metal - perhaps because a technique is developed to derive that metal more effectively from ore that doesn't have it in such concentration as the older miners required it to have - as an example. You CAN give the same type of bonus in more than one <PlaceBonusType> entry and the iProbability is cumulative with other qualified entries with that type.

iProbability works quite interestingly. In the above example, this mission has a 50% chance of success - 10% towards each potential type - and a 50% chance of failure overall. So the unit using this Build Mission would take the time it takes to complete the work (as defined by the unit's workspeed vs the build's work cost - all very scaled by gamespeed) and then at the end of the task would either place one of these 5 bonuses or nothing would happen and the worker (if not sacrificed to do it by the build definitions) would start asking again what you want him to do. Try again perhaps? He can't attempt it at all if there's a hidden bonus on that plot already.

However, let's say we wanted a Great Farmer to be able to plant any one of 15 resources, each of which requiring you have access to that resource, but who knows which one you're actually going to get at the end of the effort (which I think would be way cool if the GF worked that way because then you will tend to want to use him more often to discover what you're going to get - the choice in this case is often too daunting and as a player it makes me hesitate to choose anything but if randomized between all possibilities... hmmm - more fun! There's such a thing as too many options creating hesitation and stress.)

In such a case you'd give all 15 of those resources its own entry but give them all 100 for the chance of success. If the total chance of success exceeds 100%, then the mission is assured but the random result will total all existing iProbabilities and roll randomly from 1 to that total and select the one indexed for that result. Thus in such a farming scenario, you'd have a random check from 1 to 1500 and if it's 1430 that the roll comes up as then the last one listed is the one that got selected.


I THINK I've explained this well enough, but I'm sure I've probably left a lot of folks confused. If you are, please ask questions. If you can immediately see what we should do from here and want to help designing these build missions and units, let's start making proposals (we'll need art for units so if someone can contribute search times for that too that'd be awesome!)

I also intend to make a tag for promotions to give access to a build mission, so we can design such a bonus placement build mission and attach it to a promotion that can be obtained at say, the end of the Hill Work promotionline for workers, for example. So we can make these for workers to earn as well.

All that will take planning I don't have immediate time for and I know one application intended for this tag is to form the basis of the simple bonus placement mission tasks for Tamed and Subdued Animals of a bonus equivalent type such as Horse, Camel, Llama etc... That's why I've also been asking in another thread about suggested AI parameters for how the AI would utilize a build mission like these.


Ok, questions comments concerns? This is actually, IMO, a super cool concept a long time coming for C2C and surely we can all come up with lots to say and discuss on the subject.

@Toffer90: did this answer the questions you have in full about the tag?
 
Cool, good to have this documentation.
▬▬▬▬▬▬
What's your opinion about implementing a complimentary tag outside the nesting that deals with the overall success probability, and another tag nested at the deepest level that affects the overall success probability when the requirements are met.

<iSuccessChance>X</iSuccessChance>
<PlaceBonusTypes>
<PlaceBonusType>
<iSuccessChanceChange>Y</iSuccessChanceChange> → if requirements inside this <PlaceBonusType> are met then this is added to iPlaceBonusSuccessChance
So if the random roll for iSuccessChance + all the valid iSuccessChanceChange is a success, then the iProbability will be used as weights for a new probability roll that decides which one is chosen.
iProbability could be renamed to iWeight to conform to the naming convention already used for a weighing (e.g. events).
▬▬▬▬▬▬
If we were to add many different builds, some meant to replace old ones due to technological evolution, and some dedicated to better prospector units who should have a higher success, which may also contain a different amount of bonus variation, etc complexity; then getting a good oversight of how the overall success rate is defined for each build in a comparison would be a bit tiresome when one has to add them all together for each different build entry.

The current system is good though, quite functional, and we should try to avoid adding more tags to units. ^^
 
Last edited:
What's your opinion about implementing a complimentary tag outside the nesting that deals with the overall success probability, and another tag nested at the deepest level that affects the overall success probability when the requirements are met.
<iPlaceBonusSuccessChance>X</iPlaceBonusSuccessChance>
<PlaceBonusTypes>
<PlaceBonusType>
<iSuccessChanceChange>Y</iSuccessChanceChange> → if requirements inside this <PlaceBonusType> are met then this is added to iPlaceBonusSuccessChance
So if the random roll for iPlaceBonusSuccessChance + all the valid iSuccessChanceChange is a success, then all the iProbability will be used as weights for a new probability roll that decides which one is chosen.
It would be redundant. You don't have to use any of the selective nested tags if you don't want to use them for conditional probability so your first <PlaceBonusTypes> of a given type should be your most generic one possible. Even this base establishment is probably something you'd want to limit by a tech or something (which could also be done by the tech prereq of the build itself but not if the bonus type tech prereq would be different to the tech prereq of a different placeable bonus type with this same mission.)

Make sense? It's not necessary to make a simpler exterior tag and then change tags inside more complex nested statements. There's also limits to how many examples of successful ways to process tag datas into the XML I have and some structures are too innovative to be assured of not being bugged. That proposal might be one of them. I try to keep to the known examples so I don't fuddle it up.

If we were to add many different builds, some meant to replace old ones due to technological evolution, and some dedicated to better prospector units who should have a higher success, which may also contain a different amount of bonus variation, etc complexity; then getting a good oversight of how the overall success rate is defined for each build in a comparison would be a bit tiresome when one has to add them all together for each different build entry.
I'm not sure it's that avoidable though. We have a similar issue with the way we have to map out the final possible yield income value of various improvements. At a point, if it gets complex enough, it needs to just be slapped on a spreadsheet for easier evaluation either way. Don't get me wrong, I see what you mean, but this doesn't have to be more complex than we want it to be. That said, the potential for complexity has me wondering exactly how detailed a text display should be about it. Any suggestions there?
 
It would be redundant. You don't have to use any of the selective nested tags if you don't want to use them for conditional probability so your first <PlaceBonusTypes> of a given type should be your most generic one possible. Even this base establishment is probably something you'd want to limit by a tech or something (which could also be done by the tech prereq of the build itself but not if the bonus type tech prereq would be different to the tech prereq of a different placeable bonus type with this same mission.)
Hypotheticals:

What if you want a specific build to be able to place 1 of 40 different resources, but the build should only have a 10% chance of success?
What if you want it to be able to place 1 of 10 different resources where some have a higher probability than others, but the build itself should only have a total of 10% success chance?
 
What if you want a specific build to be able to place 1 of 40 different resources, but the build should only have a 10% chance of success?
The tag does not currently account for the potential for an independently determined fixed variable of success or failure. If you really needed it to for your design intention I could easily add a second tag to the Build Infos to give a total percent chance cap. What that would do would change it so that it first roll is for overall success or failure THEN IF successful overall it would check WHICH was successful using the total and only rolling a 'dice' of the size of the total probabilities in play. Make sense? The second tag would only function if there were probabilities for it to work with. So is this needed or are we just spitballing potentialities at this time?

Maybe that's the more desireable approach? Certainly promos could easily be made to possibly add to the fixed success variable as well.
 
The tag does not currently account for the potential for an independently determined fixed variable of success or failure. If you really needed it to for your design intention I could easily add a second tag to the Build Infos to give a total percent chance cap. What that would do would change it so that it first roll is for overall success or failure THEN IF successful overall it would check WHICH was successful using the total and only rolling a 'dice' of the size of the total probabilities in play. Make sense? The second tag would only function if there were probabilities for it to work with. So is this needed or are we just spitballing potentialities at this time?

Maybe that's the more desireable approach? Certainly promos could easily be made to possibly add to the fixed success variable as well.
I'm spitballing, though it makes sense to me on several levels to separate the chance of build success from its outcome weighting.

The build success tag could also be functional for any type of build, representing construction delays due to unforeseen events, a mine/farm may have a 95% success chance, sometimes stuff just take longer to accomplish than expected.
Every worker promo that is currently in the game could add +1% chance of success.
 
Last edited:
I'm spitballing, though it makes sense to me on several levels to separate the chance of build success from its outcome weighting.

The build success tag could also be functional for any type of build, representing construction delays due to unforeseen events, a mine/farm may have a 95% success chance, sometimes stuff just take longer to accomplish than expected.
Every worker promo that is currently in the game could add +1% chance of success.
Hmm... interesting. Could be a nuissance to some players so I probably wouldn't advise such a generic application because if you wanted to say, make an option that accomplishes this by switching the validity of the tag off and on, there are other areas where you would want the tag to function for more specific design concepts. But all in all it's an interesting idea that it could apply to more than just this particular effort.
 
Someone broke Great Farmer in SVN - I guess its good time to use this new fancy tag.
It appears I broke Great Farmer in by tag renames (It is driven by Python) - it works correctly on SVN.
I fixed it by reverting those tag renames in AnimalPlacing module.

I added
Code:
<PlaceBonusTypes>
                <PlaceBonusType>
                    <BonusType>BONUS_BANANA</BonusType>
                    <iProbability>100</iProbability>
                    <bRequiresAccess>1</bRequiresAccess>
                </PlaceBonusType>
            </PlaceBonusTypes>
to Great Farmer and that didn't show up at all in game....
 
Last edited:
to Great Farmer and that didn't show up at all in game....
There's no display text for it 'yet'. It may have been able to place bananas though. That or it's flawed and not totally debugged there yet.
 
Top Bottom