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

Gedemon's Civilization, development thread

Discussion in 'Gedemon's Civilization, a total overhaul project' started by Gedemon, May 7, 2017.

  1. SpleenPopper

    SpleenPopper Chieftain

    Joined:
    Jun 26, 2019
    Messages:
    2
    Gender:
    Male
    Im sorry if this might seem like a dumb question but, how do you found a city? Im not seeing any on screen button to do so.
     
  2. sunrisereader

    sunrisereader Warlord

    Joined:
    Jan 2, 2015
    Messages:
    177
    You might need to be further away from existing cities before you are allowed to use a settler.
    In my game the debt is rising each turn, not a large issue except i do not have enough gold to change policies.
     
  3. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    Progress report: while coding the research mechanism, I've started to change some tables in relation to trade/transfer in prevision of technology diffusion via tablets/scrolls/books, and one thing leading to another (like reading again some posts @Boris Gudenuf ...), I've switched to a more global change to the trade/transfer code.

    I'm currently adding some food resources into the chain:
    • Deer, Sheep, Cattle, Fish, Crabs, Whales -> Meat -> Salted Meat, Smoked Meat -> "food"
    • Bananas, Citrus, Graps -> Fruits -> "food"
    • Wheat, Rice -> Grains -> "food"
    I'm also adding new values in the <Resources> table:
    • DecayRate : representing spoiled food, also used to calculate the minimal efficiency of a supply route for trading/transferring that resource
    • UnitsPerTonnage : representing the size of an unit of resource (mostly used in relation to equipment per personnel in units)
    And I'm creating new tables to be able to mod more easily some existing parameters, and adding new ones
    • <SupplyRoutes>
      • SupplyRouteType : River, Sea, Road, Rail, Trader, Air (Airport to Airport)
      • BaseMaintainedRoute : how many outgoing routes of that type a city can maintain
      • BaseIncomingRoute : how many incoming routes of that type can be made to a city
      • BaseRouteLengthEfficiency : 0 to 100, 100% means that there is no length limit for that route
      • BaseMaxRouteTonnage : maximum "tonnage" per resource that can be send over a route, also related to route efficiency and UnitsPerTonnage. By default it's 1:1, for example "1 iron" resource is "1 tonnage of Iron" for transport)
    • <SupplyRouteChanges>
      • BuildingType, TechnologyType or EraType
      • SupplyRouteType : River, Sea, Road, Rail, Trader, Air
      • MaintainedRoute : how many more outgoing routes of that type a city can maintain when it has BuildingType, or the player has TechnologyType or is in EraType
      • IncomingRoute : how many more incoming routes...
      • RouteLengthEfficiencyChange
      • MaxRouteTonnageChange

    Possible settings for example:
    Code:
    <SupplyRoutes>
         <Row SupplyRouteType="Sea"  BaseRouteLengthEfficiency="70"   BaseMaxRouteTonnage="350" />
         <Row SupplyRouteType="River" BaseRouteLengthEfficiency="55"   BaseMaxRouteTonnage="150" BaseMaintainedRoute="1" BaseIncomingRoute="2"/>
         <Row SupplyRouteType="Trader" BaseRouteLengthEfficiency="100"   BaseMaxRouteTonnage="50" /> <!-- should be different for sea onlytraders -->
         <Row SupplyRouteType="Road" BaseRouteLengthEfficiency="30"   BaseMaxRouteTonnage="15" BaseMaintainedRoute="1" BaseIncomingRoute="1"/>
         <Row SupplyRouteType="Rail" BaseRouteLengthEfficiency="95"   BaseMaxRouteTonnage="1000" BaseMaintainedRoute="1" BaseIncomingRoute="1"/>
         <Row SupplyRouteType="Air" BaseRouteLengthEfficiency="95"   BaseMaxRouteTonnage="20" BaseMaintainedRoute="1" BaseIncomingRoute="1"/>
    </SupplyRoutes>
    I'm also pondering to experiment some code to be able to process some per turn updates during the human player turn using co-routines to prevent the display to hang for a few seconds on very time-consuming updates, like the plots updates.
     
    Loffas, Ondolindë, Acularius and 3 others like this.
  4. DemonEmperor

    DemonEmperor Chieftain

    Joined:
    Jan 17, 2017
    Messages:
    56
    Couple questions:

    - I've seen pictures where you're able to select civics in earlier versions. Is that still the case?
    - How do you build wonders? I'm not able to, but the AI still is.
    - There's a "city expansion" (building?improvement?) in the concepts page, but I don't see that in the current build. (and I'm still able to build districts)
    - I'm not able to choose any missions for spies. The move to different city, or choose counterspy district, just has one weird thing that has $$ in there.

    I'm not currently running any DLC,s but I'm assuming that the recent UI update that came with GS borked some stuff (unable to build wonders or select spy missions). How do I get to a version that works with this mod?
     
  5. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    Civics or Policies ?
    The "Civics" and "Techs" trees are merged into a "Development Tree", Policies and Government are unlocked from that tree.

    I've not touched anything in relation to Wonders yet, I may implement National Wonders and stack back some (but not all) in Cities (or Districts). Most effects will have to be redone, but this is not short-term development. Wonders could work as intermediate victory objectives/points and/or be dependant on cultural ethnicity or location.

    As long as we can't code district to force their placement to be adjacent to the city center, "city expansion" can not be added.

    Spies should work, but are in a similar position than Wonders in relation to the mod. Need new effects and new missions, both related to diplomacy that can't be reworked ATM. Long term goal.
     
  6. DemonEmperor

    DemonEmperor Chieftain

    Joined:
    Jan 17, 2017
    Messages:
    56
    @Gedemon

    Several things:
    - Definitely saw some of the civics being merged into the "development tree". My issue with it is that I couldn't change governments even after researching political philosophy.
    - Wonders aren't showing up in the build panel (even when researched), but the AI can still build them
    - I can't select any spy missions. Or relocate them. I just see a error thing in the UI

    what I think is going on:

    One of the recent game updates did some UI changes to implement a production queue.
    Do I have to revert to an earlier game version to use this and have it work properly? (disabled all DLC, still same issues)
    Corollary - If you're still developing this, what version of the game are you using to do so?


    Idea on a very hacky way to do city expansion (that I haven't investigated b/c idk civ vi modding structure/quirks):
    - see about multiple terrain features on a tile. (e.g. is it theoretically possible to have forest and marsh on a tile)
    - If possible, then create new dummy feature: "expansion_target"
    - It's possible currently to have a district require a feature (see: M'Banza for precedent)
    - Add a hook onto city founding or building construction to update nearby tiles to have the "expansion_target" feature
    - Also on city destruction/district deletion to remove it.
     
  7. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    Update
    Code:
    - add intermediate food resources (Grain, Meat, Fruits, Smoked Meat, Salted Meat)
    - add variable decay rate to raw and intermediate food resources
    - some raw food resources can't be transported
    - remove ownership on water, move Harbor buildings to City Center. A coastal (land) improvement may be added at a later point to provide (indirect) access to sea trade routes for cities near the coast
    - add timer (with cancel) to "Restart" button to prevent having to follow Firaxis changes in the UI panel order
    - add information on current Techs contributions in the science Top Panel Tooltip
    - change the science display to show knowledge pool and yield on the Top Panel
    - merge the yield/decay value in each of the research display of the Top Panel
    - bug fix: do not use math.ceil() on a variable that is incremented by 1 then lowered by a small percentage in the early game, use 2 decimals instead
    - allow adjacent transfer of equipment to heavy damaged units, until it can be set as an option (units with more than 60% damage were not able to get surplus equipment from nearby units)
    Tested with the September 2019 patch for ~100 turns.

    I've not edited the supply route mechanism yet (in relation to food and efficiency), I may add the other knowledge resources first.

    I think I'll go for tech points created only from the "citizen knowledge" resource, and use the others to maintain/raise the "citizen knowledge" pool.
     
  8. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    Small update
    Code:
    bug fix : forgot to change some buildings production to the new food resources
     
    Knasp likes this.
  9. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    The Research elements are still taking a lot of space on the UI, so I'm going to implement a condensed/expanded mode, W.I.P. below
    Spoiler Condensed :
    Clipboard-1.jpg

    Spoiler Expanded :
    Clipboard-2.jpg
     
    SeelingCat likes this.
  10. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    Now, if I'm going to implement science production from humans source only (and not from humans, tablets, scrolls, books, ...), could I replace:
    by
    and use one line per city instead of multiple lines (template made when I planned to have one line per source) like
    ?
     
  11. DemonEmperor

    DemonEmperor Chieftain

    Joined:
    Jan 17, 2017
    Messages:
    56
    @Gedemon

    So ... not sure if you're using a different version than what's on Github, but governments don't work. So I took a look at the code and fixed it.

    Turns out you were doing some really really wonky stuff when setting up your TechUnlockGovernements table. Not sure how much of that was because of inexperience, but here's a list of what went wrong and why.
    Original code:
    Code:
    1: local TechUnlockGovernement    = {}    -- helper to convert Governement prereqCivic to prereqTech (to do: directly add prereqTech column in Governments table
    2: for row in GameInfo.Governments() do
    3:     if row.PrereqCivic then
    4:         local techType     = "TECH_"..string.sub(row.PrereqCivic, 1, 6)
    5:         local techID    = GameInfo.Technologies[techID] and GameInfo.Technologies[techID].Index
    6:         if techID then
    7:             TechUnlockGovernement[techID]     = row.index
    8:         end
    9:     end
    10: end
    See Line 4.
    • row.PreReqCivic will be something in the form of CIVIC_POLITICAL_PHILOSOPHY
    • string.sub(row.PrereqCivic, 1, 6) on that returns "CIVIC_", so you were always searching for "TECH_CIVIC_" (nonexistent)
    See Line 5.
    • local techID = <something> and <something2>. That's the form you use to declare a boolean variable
    • Assuming <something> and <something2> are both true, techID would become True, not any index value.
    This next bit is speculation that I'm reasonably sure is correct (I'm not 100% familiar with how the lua engine interprets scripts)
    See Line 5.
    • Note that techID is first defined (in-scope) with local techID, which overrides any global techIDs possibly there
    • Since it's just been initialized, its value is set to nil, which means GameInfo.Technologies[techID] *always* goes to nil
    See Line 7: TechUnlockGovernement[techID] = row.index. Multiple things here.
    • .index is not a field, .Index is, so row.index always evaluates to nil. (Wasted approx 20 mins of my time on that because I have really bad eyes)
    • This is a standard bit of code for mapping tech IDs to Gov IDs. The problem here is Political Philosophy
    • Political Philosophy unlocks 3 different governments, so the script runs 3 different times, each time overwriting the contents of TechUnlockgovernement[techID]
    • Only ways to get around this are to enforce guaranteed unique IDs. I'd prefer to do something using multikey but that involves external libraries
    • I ended up getting around it by linking each tech ID to a table, and sticking the Gov IDs in there.
    So: Corrected code is below (tested as working)
    Code:
    local TechUnlockGovernement    = {}    -- helper to convert Governement prereqCivic to prereqTech (to do: directly add prereqTech column in Governments table
    for row in GameInfo.Governments() do
        if row.PrereqCivic then
            local techType     = "TECH_"..string.sub(row.PrereqCivic, 7, -1)
            local techID
            if GameInfo.Technologies[techType] then
                techID = GameInfo.Technologies[techType].Index
                if TechUnlockGovernement[techID] then
                    table.insert(TechUnlockGovernement[techID], row.Index)
                else
                    TechUnlockGovernement[techID] = { row.Index }
                end
            end
        end
    end
    To correspond with those changes, OnResearchCompleted needed to be modified, as below
    Code:
    function OnResearchCompleted( playerID:number, techID:number, bIsCanceled:boolean)
        -- Is that tech unlocking a Government ?
        if TechUnlockGovernement[techID] then
            local pResearch = Research:Create(playerID)
            for _, govID in pairs(TechUnlockGovernement[techID]) do
                pResearch:UnlockGovernement(govID)
            end
        end
    end
     
    sunrisereader and Gedemon like this.
  12. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    ho, yes, thanks, lot of mistakes in not so many lines of code !

    I'll implement your fix in next version, thanks.

    about
    Code:
    local techID = <something> and <something2>
    in Lua if <something> and <something2> are neither nil or false then it assign <something2> to techID, not <true>
     
  13. DemonEmperor

    DemonEmperor Chieftain

    Joined:
    Jan 17, 2017
    Messages:
    56
    Huh. That's a quirk I haven't seen before. Noted.

    Also do you have any idea what's going on with spies? Imma see if I can hunt down why wonders aren't appearing as buildable later. In both cases the actions are clearly in the game (I've seen AI do both), but something on the UI broke so human players can't
     
  14. DemonEmperor

    DemonEmperor Chieftain

    Joined:
    Jan 17, 2017
    Messages:
    56
    Okay after much frustration I tracked down the issue.

    You forgot to add "GCO = ExposedMembers.GCO" to UI/EspionageChooser.lua
     
    Gedemon and sunrisereader like this.
  15. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    and no issue with EspionageOverview.lua ?
     
  16. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    New update, testing the first implementation of Science diffusion
    Code:
    - add "blank" Tablets, Scrolls, Books resources (Books creation is not implemented yet)
    - add Scribe House building that can create Tablets from Clay and Scrolls from Plants or Leather
    - add creation of Tech-specific Tablets, Scrolls, Books (when available) for known Techs
    - add creation of Scholars (knowledge) from imported Tablets, Scrolls, Books for (unlocked) unknown Techs 
    - switched Currency and Foreign Trade
    - add "resource in stock" research event for Iron Working (Iron) and Bronze Working (Copper)
    - bug fix : Government unlocking (thanks DemonEmperor)
    - bug fix : Espionage screens (thanks DemonEmperor)
    - add condensed/expanded mode for Research UI in TopPanel
    - update research texts to reflect the Scholars mechanism (only "resource" to directly generate science from knowledge)
    
    Spoiler Scholars learn with Tablets imported from other Civiliation :
    Clipboard-5.jpg


    Next I'll work on the UI for the City Banner tooltip, with a dedicated and sorted list for all science resources.
     
    SeelingCat and sunrisereader like this.
  17. DemonEmperor

    DemonEmperor Chieftain

    Joined:
    Jan 17, 2017
    Messages:
    56
    So I found the issue with Wonders not appearing.

    ProductionPanel.lua somewhere around line 2050
    Code:
    -- GCO <<<<<
    local bCanConstruct, requirementStr, prereqStr, bCanShow = pSelectedCity:CanConstruct(row.BuildingType)
    --if true then
    if (bCanShow or bCanStart) and not (row.IsWonder and (not bCanStart)) then
    bCanStart is never actually defined as far as I can tell, so the if statement above evaluates to:

    if bCanShow and not row.IsWonder then

    meaning it explicitly excludes all wonders. It vaguely looks like you wanted to do bCanConstruct, which half-works? it includes a lot of stuff that's already been built, so ... yeah. I'll have to investigate further but that's the issue
     
  18. DemonEmperor

    DemonEmperor Chieftain

    Joined:
    Jan 17, 2017
    Messages:
    56
    Alright slapped a bandage on it for a hotfix, and it's buggy but more manageable now

    in GCO_CityScrip.lua, at the end of CanConstruct:

    I modified the return statement to be: (and added a check to auto-set bCheckSpecial as false if it requires a religion be founded b/c there's no religion ... yet)
    return bHasComponents, requirementStr, table.concat(preReqStr), (bCheckBuildingAND and bCheckBuildingOR and bCoastalCheck and bCheckSpecial and bCheckNoUpgradeBuild and bCanShow)

    Meanwhile that spot in ProductionPanel.lua (circa line 2050) was thus modified to read
    if (not (isDisabled and bCanConstruct)) and bCanShow and not (row.IsWonder and isDisabled) then

    The theory here is that
    • wonders should show up if they're able to be constructed on a plot, or you can purchase a plot where they can be constructed (we can't plot purchase so idk how that one works)
    • bCanShow dictates if a building hasn't been built, coastal, has prereqs, etc etc. (literally says if a building can be shown, regardless of completion status)
    • not (isDisabled and bCanconstruct) tries (and half-succeeds) at handling mutual exclusivity clauses (and I guess special considerations like capital city only)
    • ^^ If the building is marked isDisabled, then clearly it's unable to be built for some reason. It's whatever constraints are thrown out by the game engine, which actually handles mutual exclusivity, and all the other fields. If we have the resources to build it, then clearly it failed one of those constraints, so we shouldn't be seeing it.
    One (theoretical) failure case there is that you don't have the resources to build something, so even though you're not supposed to see it (i.e. stables and barracks), it still pops up
     
  19. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    Thanks, I'll try to have a closer look, that part is still a W.I.P.

    I want unlocked buildings for which we just miss resources to be visible in the list (but disabled).
     
  20. Gedemon

    Gedemon Modder Moderator

    Joined:
    Oct 4, 2004
    Messages:
    9,439
    Location:
    France
    Small update
    Code:
    - add specific ToolTip for knowledge Sources on City Banners, with a filter by related Tech (All, Known, Researching, Locked)
     

Share This Page