1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Replacement Supply System for Civ V

Discussion in 'Civilization Design Resources' started by sman1975, Jun 11, 2017.

Tags:
  1. Ferris Bueller

    Ferris Bueller Chieftain

    Joined:
    Oct 12, 2015
    Messages:
    53
    The sequential system for testing against movement, then ability to attack, then HP loss for a single effect per turn is OK with me, as long as the base probabilities are suitably high for the situation the unit is in. I will use the mod as much as possible in the coming days and make whatever suggestions strike me as worth considering.
     
  2. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    During wartime, the probability centers around supply line efficiency - if the unit is best supplied by a city 10 hexes away that has a maximum supply line length of 20, then it is using 50% of the supply line length, therefore Supple Line Efficiency = 50%. If the unit is in an enemy hex, this number is cut in half - meaning the unit has a 25% chance of movement impact; it also has a 25% chance of not being able to attack; and finally a 25% chance of taking Attrition "damage." Three shots at impact @25% chance each.

    If the unit has adjacent enemy units or is next to an enemy city, the probability increases 5% per unit and 5% for the city. If a unit was surrounded by enemies and was next to an enemy city, it would add 35% to this basic chance of Attrition - or 60% in the previous example - 60% for each of the 3 possible effects. This sounds pretty sound to me.

    On neutral territory during wartime, those numbers are half as much - 12.5% for the basic unit using half the length of the supply line from the best supplying city. This feels pretty good to me, too.

    Of course, all of this gets heavily impacted if the civ has too many units. Basically, the mod adds 5% for each excessive unit - up to a limit which depends on the plot relationship (on a friendly hex, max is 20%, neutral = 30%, and enemy = 35%) - these numbers are added to the basic probability of impact. It basically demonstrates that when a civ has more units than it can efficiently supply, those effects are felt by every unit in the system, which again, feels right to me.

    A few of my earlier test games saw inordinate amount of Attrition events, so I was wondering if it should be toned down. However, when I started running the 500+ turn games, I wasn't really seeing many events at all. This should be expected as most of the game turns involve units on friendly territory and not too many excessive units. In those circumstances, we shouldn't experience much attrition at all. But I am seeing occasional events spread out through all the civs, suggesting the mod is working about like it should. I think....

    So, I guess it's a long way of saying, let's test this version and see how it does. I'm particularly interested in help deciding what the best numbers are for the game's normal supply formula - and how well the mod plays with other mods.
     
    Last edited: Jun 19, 2017
    Troller0001 likes this.
  3. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    A further note... The way the code is designed right now, there is no actual limit to supply line length. This represents the fact that even if a unit is twice as far as it should be from a supply source, there is a small but theoretical chance it could still be supplied...

    For example, if the best supply city for a unit has a supply line length of 20 and the unit is 30 hexes away, the supply line efficiency will be 150%. If at war, this is divided in half, resulting in a 75% chance of Attrition (150 / 2).

    If this same unit is on a neutral hex during wartime, the Attrition chance would be 37.5% (150/4).

    The overall max chance allowed is 70% (can be changed) - any higher chances are capped at this level.

    Also - the game doesn't take into account land vs. sea hexes. Supply Line efficiency only cares about the number of hexes, not the type. It's probably OK for now, though.
     
    Last edited: Jun 19, 2017
    Troller0001 likes this.
  4. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    One finding from testing so far - the code does not accurately process units on another civ's territory if they both have an Open Borders relationship. There is also an issue when the unit is on City State territory. As there is no proper definition for this relationship in the code, it assumes the hex to be enemy territory, and processes Attrition based on that relationship. Obviously this isn't correct. I've made a temp change in the mod (not posted yet) that changes this to Neutral territory. If this needs to be changed for Friendly territory (I can see it being either Neutral or Friendly, actually) let me know.
     
    Last edited: Jun 19, 2017
    Troller0001 likes this.
  5. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    Another odd finding - some civilian units are being Attrited. As they have a combat strength of zero, I'm not sure why the if (pUnit:GetBaseCombatStrength() == 0) then break end statement isn't working. Will look into it, but in the meantime it might mean a worker or missionary can't move a turn, but I don't think that breaks anything.
     
  6. Troller0001

    Troller0001 Watching from a safe distance

    Joined:
    Mar 9, 2016
    Messages:
    747
    Gender:
    Male
    Location:
    The Netherlands
    Try using pUnit:IsCombatUnit() instead, maybe that helps
     
  7. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    Thanks Troller - I'll try that change and see if it improves the behavior.
     
  8. Ferris Bueller

    Ferris Bueller Chieftain

    Joined:
    Oct 12, 2015
    Messages:
    53
    Apologies for replying late, my place has been undergoing power outages.

    So far, the games I've been playing make me agree that the formulas are on target. I haven't yet gotten an Open Borders relationship, but will when available to see what happens. Civilian units undergoing Attrition is something I haven't observed as yet.
     
  9. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    @Ferris Bueller - I'm seeing the same things. I started a new test game from scratch, and I'm about 600 turns in. Have played "conservatively" - not expanding much, mostly keeping units on friendly hexes. Have only seen a couple of instances of Attrition all game.

    I've been building up for the "big push" - have lots of ships, air, and land units - ready to strike out FTW. Will let you know how Attrition impacts it.

    So far, though, I have to admit, I'm liking how this is playing out.
     
  10. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    Troller0001 likes this.
  11. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    I know it's been a while, but if anyone gets updates on this thread, I'm in the process of updating it. Please let me know if you have any suggestions, complaints, etc. so I can get them in the next version. Thanks!
     
  12. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    Some changes to the mod. Adding some notifications to let players know what's happening to them, based on supply, new units, etc.

    When you create a unit, there is a chance the creating city will lose population (since population/manpower is needed to fill up the unit with troops):

    upload_2020-10-30_14-52-2.jpeg


    When supply issues impact a unit:

    upload_2020-10-30_14-54-22.jpeg upload_2020-10-30_15-1-13.jpeg


    New Promotion Icons have been added to the mod:

    Expeditionary Forces:

    upload_2020-10-30_15-5-17.jpeg upload_2020-10-30_15-10-35.jpeg upload_2020-10-30_15-5-31.jpeg


    Red Ball Express:

    upload_2020-10-30_15-5-49.jpeg upload_2020-10-30_15-11-11.jpeg upload_2020-10-30_15-6-1.jpeg

    Mod is working much better - fixed a few errors that severely limited its impact.

    Am working on the "popup" that will allow a player to change the "CPPS_APPLICABILITY" inside the game. This setting determines whether the CPPS functions apply to only the human player, or to both the human and AI players. Hoping to have that done sometime today.
     
  13. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    The new "CPPS Applicability" popup is completed. Looks like this:

    upload_2020-10-30_17-30-23.jpeg upload_2020-10-30_17-27-0.jpeg upload_2020-10-30_17-27-19.jpeg upload_2020-10-30_17-27-33.jpeg

    Once you make the selection, the mod will immediately apply your selection.

    I've worked through all the fix items on my master list for this mod. Unless anyone offers anything else, I'll publish early tomorrow. Thanks.
     
  14. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    New Version (V2) is Published! Please refer to Change Notes below for details. As there were a lot of changes to the mod, please let me know if you're seeing something broken. I'm expecting at least one Hotfix for this version. Am also open to new ideas if you have any. Please leave any thoughts, concerns, bugs, etc., below. Thanks!


    Direct Download: https://forums.civfanatics.com/resources/combat-power-projection-system.26252/

    Steam Download: https://steamcommunity.com/sharedfiles/filedetails/?id=974998487

    *****************************************************************************************************************************************************************************************************

    Change Notes for V2:


    - Fixed several missing text keys which broke Civilopedia.

    - Fixed several logic problems in the main CPPS processing loop, which limited the number of units impacted by CPPS. I expect you'll seee a LOT more impacts in this version.

    - Added a popup window, accessed through the "Additional Information" menu, that allows a player to change which civs are impacted by CPPS. They can now choose between "Human Only" or "All Civs (including AI)". Before, to make this change required editing mod files via a text editor. It can now be done/redone several times in the same game.

    - Added a new Notification icon, to notify human players when their units are impacted by CPPS

    - Added customized icons for the Expeditionary Forces and Red Ball Express promotions.

    - Added a new feature where creating units (either through training, gold/faith/culture purchase) has a chance to lower the population of the creating city by 1. The "larger" the unit is (in manpower), the larger the chance for population loss. Human players have a 50% higher chance of losing population, compared to AI civs (IF they are impacted by CPPS in the first place).
     

Share This Page