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

City-State Investments

Discussion in 'Civ5 - Mod Components' started by Drawmeus, Dec 31, 2012.

  1. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    City-State Investments

    Download it here: http://forums.civfanatics.com/downloads.php?do=file&id=20678

    IF YOU ENCOUNTER BUGS OR ODDITIES, PLEASE REPORT THEM WITH AS MUCH DETAIL AS POSSIBLE AND A SAVED GAME IF POSSIBLE


    This is a mod component being developed as a piece of a larger City-State mod, which is in turn a component of my Epochs mod (see sig). I'm releasing it because its effects on the game as a standalone mod are significant.

    Features
    City-State Investments removes the ability to gift lump sums of Gold from the game, replacing it with the concept of investing in a City-State. Investments cost you gold per turn based on the Era of the game you're in, giving the City-State various benefits, while you gain Influence with them each turn.

    You can choose between Economy, Growth and Military investments. Economy investments give the City-State gold each turn and production in their capital city. Growth investments give them bonus food and growth % in their capital city. Military investments give them a free unit every few turns.

    While investing, you accrue Goodwill with the City-State; after you stop investing, your Influence will not start decaying with them for a number of turns equal to the number of turns you've invested in them.

    What does this do to my game?
    Quite a few of the features of this mod are intended to hook into pieces of the larger mods it's being developed for, but as is it changes the nature of city-state friendship and of the Diplomacy Victory quite a bit.

    Friendship and alliance is much easier to maintain, as you can always put a low level investment on a City-State in order to maintain/slightly increase your Influence with them.

    However, you can't just snatch City-States away from other players anymore; acquiring new allied City-States takes planning. If the UN is about to be built and you don't have longstanding relationships with many City-States, it doesn't matter how much money you have, you won't be able to buy them up in time.

    There are two non-City State bonus features:
    1. Cities will not receive religious pressure from unmet Civilizations.
    2. There is now a GameEvent that will fire when a Building is first created.

    Compatibility
    This mod uses a custom GameCoreDLL and will not be compatible with any other mod with a custom DLL.

    This mod replaces the following UI files and will not be compatible with any other mod which relies on those files:
    • CityBannerManager.lua
    • CityStateDiploPopup.lua
    • CityStateDiploPopup.xml
    • CityStateStatusHelper.lua
    • TopPanel.lua

    This mod includes whoward69's UI - Notifications mod as part of it. You should not load both mods, but you will get the complete functionality of that mod as part of it.

    To Do
    My backlog of additional features to implement or iterate on is:
    • Implement an Investments tab in the Economic Overview UI
    • Add Investment information in the Diplo popup in the top right and in the Diplo Overview UI
    • Better handle adding a new Military Unit via Military Investment when the land around a City-State is overcrowded
    • Create new City-State quests to invest in them for a time period.
    • Change Goodwill text when you have only 1 turn remaining ("1 turns").
    • Improve AI logic for when to invest, how much to invest and what type of investment to create.
    • Integrate Game Speed to Influence Gains and Costs as appropriate.
    • Update the Civ Advisors
    • Prevent notifications from giving away the identities of unmet players.
    • Allow AI players to choose to increase their investment level with a City-State.
    • Improve AI logic for deciding when to cancel an Investment.
    • Expose many AI values to XML
    • Allow AI players to decide to stop investing in a City-State which they are allied with and not in imminent danger of losing their alliance with.
    • Create a Civilopedia - Concepts entry.

    For Modders
    Spoiler :

    This mod adds the following game events:
    • StraboNewInvestment( iMinorPlayerID, iMajorPlayerID, iType, iSize)
    • StraboGoodwillExpired(iMajorPlayerID, iMinorPlayerID)
    • StraboOnBuildingCreated(iCityX, iCityY, iBuildingType, iOwnerID, iCityID)
    • StraboInvestmentStopped(iMinorPlayerID, iMajorPlayerID)
    • StraboNoGoldForInvestments(iMajorPlayerID) - fires if all investments will be cancelled due to lack of funds.
    • StraboNewInvestmentMilitaryUnits(iMinorPlayerID, iNumNewUnits, iRemainingCounter, iCounterPerTurn)

    It adds the following new Lua methods:
    • Game.DoGoldInvestment(iMajorID, iMinorID, iType, iSize)
    • Game.GetRemainingGoodwillDuration(iMajorID, iMinorID)
    • Player:GetGoldPerTurnFromInvestments()
    • Player:RecommendUnit()
    • Player:GetInvestmentSizeWithMinor(iMinorID)
    • Player:GetInvestmentTypeWithMinor(iMinor)
    • Player:GetHasInvestmentWithMinor(iMinor)
    • Player:StopInvestmentWithMinor(iMinor)

    iType values are:
    0: Economy Investment
    1: Military Investment
    2: Growth Investment

    iSize values are:
    0: Small Investment
    1: Medium Investment
    2: Large Investments

    New XML Variables explained here:
    Eras data:
    <SmallGoldInvestment> - Cost per turn in gold for a Small investment in this era.
    <MediumGoldInvestment> - Cost per turn in gold for a Medium investment in this era.
    <LargeGoldInvestment> - Cost per turn in gold for a Large investment in this era.
    <GrowthInvestmentFoodBonus> - Bonus food in the city-state's capital for a Large investment in this Era.
    <GrowthInvestmentFoodModifier> - Bonus Growth % in the city-state's capital for a Large investment in this Era.
    <EconomyInvestmentGoldBonus> - Bonus Gold Per Turn for the City-State for a Large investment in this Era.
    <EconomyInvestmentProductionBonus> - Bonus Production in the City-State's capital for a Large investment in this Era.
    Small investments yield 1/3 the benefits (rounded up), while Medium investments yield 2/3 the benefits (rounded up).

    GameDefines:
    INVESTMENT_INFLUENCE_GAIN_PER_TURN_SMALL - Influence gained with that City-State for a Small Investment.
    INVESTMENT_INFLUENCE_GAIN_PER_TURN_MEDIUM - Influence gained with that City-State for a Medium Investment.
    INVESTMENT_INFLUENCE_GAIN_PER_TURN_LARGE - Influence gained with that City-State for a Large Investment.
    INVESTMENT_MILITARY_COUNTER_PER_UNIT - The number of 'points' of Military Investment required for the City-State to be given a new unit.
    INVESTMENT_MILITARY_COUNTER_SMALL_INCREMENT - The number of 'points' of Military Investment per turn awarded for a Small Military Investment.
    INVESTMENT_MILITARY_COUNTER_MEDIUM_INCREMENT - The number of 'points' of Military Investment per turn awarded for a Medium Military Investment.
    INVESTMENT_MILITARY_COUNTER_LARGE_INCREMENT - The number of 'points' of Military Investment per turn awarded for a Large Military Investment.

    Note that all Military Points are added together (if multiple players are investing in this City-State's military), and that the unit awarded will always be a recommended Offense unit.

    Game Core source code available on request.
     
  2. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    Reserved
     
  3. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    Reserved 2
     
  4. Mars83

    Mars83 Warlord

    Joined:
    Jun 13, 2011
    Messages:
    273
    Is this only G&K or can work for both for vanilla?
     
  5. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    G&K only.
     
  6. mitsho

    mitsho Deity

    Joined:
    Nov 3, 2003
    Messages:
    7,692
    Location:
    Europe, more or less
    Looks very interesting. City State Logic is flawed in many ways in the current base game. But my question would be how much the AI understands of this system?
     
  7. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    Enough to start investments when it has spare gold, to prioritize City-States to invest in based on current win condition (if going for a culture victory, prioritize Cultural CSes), and enough to stop investing when going bankrupt.

    Because this is a DLL mod, I was able to go straight into the AI and just tell it out how to use the system, no guesswork needed. That said it's still fairly rudimentary and I have improvements planned.
     
  8. ignite

    ignite Chieftain

    Joined:
    Sep 26, 2010
    Messages:
    62
    Location:
    Minnesota
    Very neat idea! Thank you.
     
  9. Gazebo

    Gazebo Lord of the Community Patch Supporter

    Joined:
    Sep 26, 2010
    Messages:
    18,034
    Gender:
    Male
    Location:
    Little Rock
    Marvelous work. Very straightforward and far more engaging than the lump-sum mechanic. I can see this mod and CSD becoming good friends in the future. If you have any interest in the assets from CSD, or would like to integrate the two together, let me know. It'd be lovely if most of the complimentary city states mods were wholly compatible.

    Cheers,
    G
     
  10. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    You know, I think they'd play well together, I just haven't got a ton of time right now, real life really caught up with me.

    Let me clear out my backlog of features a bit, get this thing a bit more robust (under the hood it needs some tweaks - the AI needs to learn to use it better, I need to expose some more values to XML, etc.), and then we can talk about putting out a combined mod.
     
  11. Gazebo

    Gazebo Lord of the Community Patch Supporter

    Joined:
    Sep 26, 2010
    Messages:
    18,034
    Gender:
    Male
    Location:
    Little Rock
    Sounds good. For the record, they are currently compatible, from what I can tell.
     
  12. Drawmeus

    Drawmeus Emperor

    Joined:
    Jul 25, 2007
    Messages:
    1,213
    So folks know, I'm developing updates to this mostly with my Epochs mod in mind. Down the road, when there are enough new CS Investments features and bug fixes ready, I'll integrate them into this mod.

    If anyone finds bugs or encounters a crash, let me know and I'll take a look.
     
  13. KnelRivendare

    KnelRivendare Warlord

    Joined:
    Jan 13, 2012
    Messages:
    271
  14. ComJak

    ComJak Chieftain

    Joined:
    Aug 23, 2013
    Messages:
    3
    Hey there. I know this mod hasn't been touched in a while but it doesn't seem to work with the latest G&K version. Any chance for an update or perhaps the features in this mod have been moved to another?
     
  15. Ekmek

    Ekmek on steam: ekmek_e

    Joined:
    Aug 7, 2002
    Messages:
    6,055
    Location:
    San Diego, California

Share This Page