1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

The Outcome System

Discussion in 'Civ4 - Caveman 2 Cosmos' started by AIAndy, Jan 9, 2012.

  1. AIAndy

    AIAndy Chieftain

    Joined:
    Jun 8, 2011
    Messages:
    3,351
    Some time in the next days I will have completed the code for the Outcome system so I wanted to give some information of how it will work (details about the XML will be added when the code is finished).

    What it is used for:
    • It replaces the current Python code for the result of killing animals like getting a subdued animal or some hammers or a bonus
    • It will be used for new actions for subdued animals in a second step
    • It can be used for other results from killing a unit like getting some espionage against an enemy if you kill one of his units

    You define a list of possible outcomes for each unit type in the XML that each have a relative chance, requirements and a result.
    Depending on promotions the chances can also change.
    When a unit is killed, one possible outcome is chosen from the list depending on the relative chances of all currently possible outcomes.

    Some examples:
    To get the same effect as now you would define three possible outcomes for each animal. One to get the subdued animal, one to get the respective bonus on the plot and one to get the food/hammers.
    The hunter promotions increase the chances of the subdue outcome type (you only define that once in the outcome info XML including the message when that outcome happens).

    You could also have some animal outcomes that give you great people points or beakers (meaning you got some new insights from killing the animal).

    There could be an inquisition promotion that enables that unit to sometimes get an outcome that gives espionage points from certain units or an engineer promotion that enables you to get some tech from killed high tech units.
     
  2. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,244
    Location:
    California, USA
    Is this in addition to the :gold:, :science: and/or :espionage: a unit can get in the have the right promotions upon combat victory?
     
  3. AIAndy

    AIAndy Chieftain

    Joined:
    Jun 8, 2011
    Messages:
    3,351
    It is independent of all previous systems.
     
  4. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    21,195
    Gender:
    Male
    Location:
    Canberra, Australia
    There are 6 promotions that affect the chance of subduing animals. This will still work? Currently I define it once will I now need to define it once for each animal? Or is it on the promotion?
     
  5. AIAndy

    AIAndy Chieftain

    Joined:
    Jun 8, 2011
    Messages:
    3,351
    You define it once in the outcome type. Then you refer to that outcome type in the outcome list of each animal.
    Check CIV4OutcomeInfos.xml that is already on the XML.
     
  6. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    21,195
    Gender:
    Male
    Location:
    Canberra, Australia
    Currently the algorithm is:-

    If animal unit is not subdued
    give hammers and food​
    else
    if the unit may provide a resource and there is no resource on the plot and there are not x resources next to this plot (where x=0 for land and 1 for sea) and team has tech and not bad plot (ie not snow or salt flats terrain)
    if change >= 80
    place resource​
    else
    place subdued animal on plot with subduing unit (not always working because the incorrect info is passed to python)​

    See the problem.;)

    Edit I suppose since this is in the dll it could use the valid terrains for the bonus rather than having the bad terrain list. Probably be better that way.
     
  7. AIAndy

    AIAndy Chieftain

    Joined:
    Jun 8, 2011
    Messages:
    3,351
    No, I don't see the problem as the code already checks that. Like if you say you want a bonus placement as a possible outcome then it will check if that is a valid spot and that you have the tech to reveal it and not the tech that obsoletes it. Otherwise that outcome is not possible and it is not considered at that time.
     
  8. AIAndy

    AIAndy Chieftain

    Joined:
    Jun 8, 2011
    Messages:
    3,351
    I have added the first version of the system to the SVN.
    UNIT_BEAR has exemplary outcome entries.
    There are no messages yet but the functionality should work.

    Note: The chances are relative so if you sometimes want nothing to happen add an outcome entry with only type and chance (probably add an outcome type with an empty message as well for when messages will work). If one outcome has a chance of 20 and the other a chance of 10, then the first outcome will happen 2/3 (= 20 / (10+20) ) of the time and the second 1/3 (= 10 / (10+20) ) of the time.

    Currently an outcome can consist of giving the killing unit a promotion, placing a bonus, getting a unit (subdued unit), getting yields (food and hammer to next city, commerce is split according to the sliders) or commerce (culture to next city, beakers to currently researched tech, espionage towards team of the killed unit) or getting great people points (either generic or towards a specific great person).
     
  9. robomani

    robomani Chieftain

    Joined:
    Aug 3, 2010
    Messages:
    83
    Will the outcome system be used to capture slave and convert enemies (can enemies be converted in C2C?)
     
  10. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    21,195
    Gender:
    Male
    Location:
    Canberra, Australia
    It can be used to replace the current slavery mechanic.
     
  11. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    21,195
    Gender:
    Male
    Location:
    Canberra, Australia
    I have update the outcome file and the bear information to get it as near as I can to the subdue animals code.

    The current way it works is to test if the subdue was successful and if not apply the kill. However the example in the bear appears to say that you get food and hammers only 25% of the time and a subdued animal 10% (+ promotion modifiers) of the time. What happens the other 65% of the time? Or is it 10 out of 35 you subdue and 25 out of 35 you kill?

    If I want the outcome to happen if the other outcomes don't happen how do I specify that. Assuming percentages?
     
  12. BlueGenie

    BlueGenie Chieftain

    Joined:
    Apr 23, 2009
    Messages:
    1,521
    The latter. 10 out of 35 and 25 of 35.

    Assuming percentages you'd have to set a sum equal to 100.
    30 for Subdue and 70 for kill yields, for instance.

    Cheers
     
  13. AIAndy

    AIAndy Chieftain

    Joined:
    Jun 8, 2011
    Messages:
    3,351
    This is the way it works. Of course that is not an exact replication of the previous chances for subdueing/bonus placement, but you can model it close enough I think and that way you get a lot less problems when you use it for some different purposes.

    In detail:
    A unit dies as the result of a combat.
    If the dieing unit type has any outcomes defined, they are all checked if they are possible at the moment (e.g. their tech prereqs are met and you don't have the obsoleting tech for the promotion that that outcome would provide to the winning unit).
    A relative chance value is calculated for all currently possible outcomes. Those chance values are then summed up and the actual chance for each outcome is own chance value divided by the sum.
    If there is only one possible outcome, then the chance is 100% (but you can have outcomes that do nothing).
    A random roll determines one of the outcomes and only that outcome is executed then.
     
  14. BlueGenie

    BlueGenie Chieftain

    Joined:
    Apr 23, 2009
    Messages:
    1,521
    What about promotions/civics that change an outcome possibility? Mainly thinking about Hunter promotions and slavery civic.
    Do they work with the new system if the outcome is determined by the killed unit instead of the killing unit?

    Cheers
     
  15. AIAndy

    AIAndy Chieftain

    Joined:
    Jun 8, 2011
    Messages:
    3,351
    Both killed and killing unit influence the outcome and outcome chances.
    Each outcome has an outcome type and the outcome type has a list of promotions defined that increase the chance of this outcome (CIV4OutcomeInfos.xml).
    But you are right, civic prereqs or chance changes have to be added at the same point (I guess mainly for slavery at the moment). I'll start by adding a single civic prereq similar to the tech prereq that is already in there unless more is requested.
     
  16. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    21,195
    Gender:
    Male
    Location:
    Canberra, Australia

    So a unit with no promotions has a 10 out of 35 chance of subduing an animal or 28.57% chance. Rather than 10%.

    While a unit with all promotions gets 55 out of 90 has 61% chance of subduing.

    Currently, slavery only comes into play if the attacking unit wins when attacking a city. If an attacking unit wins and the team has slavery (or x) civic then 40% of the time a slave will be generated.

    BtW I keep meaning to adjust all these by difficulty level.
     
  17. AIAndy

    AIAndy Chieftain

    Joined:
    Jun 8, 2011
    Messages:
    3,351
    Yes, indeed, I have not done any balancing of the numbers.

    I think that part I will leave like it is now but maybe we want some units to be enslavable sometimes when defeated.

    Chance changes similar to the promotions for each outcome type?
     
  18. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    21,195
    Gender:
    Male
    Location:
    Canberra, Australia
    Absolute percentages are better since that is what people are used to. If they don't add up to 100% the left over is what normally happens. If it adds up to over 100 then treat it as relative percentages.
     
  19. AIAndy

    AIAndy Chieftain

    Joined:
    Jun 8, 2011
    Messages:
    3,351
    Changed it now to work like that.
     
  20. Dancing Hoskuld

    Dancing Hoskuld Chieftain

    Joined:
    Jul 5, 2004
    Messages:
    21,195
    Gender:
    Male
    Location:
    Canberra, Australia
    How will we we do the "butcher" outcome. I have the data and button but I am not sure how to activate it. The idea was for three types
    - butcher in wild (ie not inside your cultural borders) where the result is the same as kill in combat
    - butcher inside cultural boarders result = twice kill in combat plus money
    - butcher in city result = twice kill in combat plus twice money.
     

Share This Page