1. Firaxis celebrates the "Asian American and Pacific Islander Heritage Month", and offers a give-away of a Civ6 anthology copy (5 in total)! For all the details, please check the thread here. .
    Dismiss Notice
  2. We have selected the winners of the Old World random draw and competition. For the winning entries, please check this thread.
    Dismiss Notice
  3. Old World has finally been released on GOG and Steam, besides also being available in the Epic store . Come to our Old World forum and discuss with us!
    Dismiss Notice

New Resources Question

Discussion in 'Civ5 - Creation & Customization' started by sman1975, Dec 3, 2020.

  1. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    Hello, I'm trying to add some new Resources to the game, bringing together the disparate efforts of several modders. Looking at the legacy code, I've noticed there are two tables that are confusing me:

    1. Resource_FeatureBooleans
    2. Resource_FeatureTerrainBooleans

    Both have the same schema (Resource Type, Terrain Type). Additionally, there are overlaps in the game's versions of these table, representing duplicate entries between the two tables, and also entries in each that are unique to the table.


    Question: Does anyone know the difference between the 2 tables, and/or what their relationships to each other are?


    I'm not sure if I should only use one table, duplicate data into both tables, or get creative on which terrain type goes with which resource type in which table?

    Thanks!
     
  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,587
    Location:
    Near Portsmouth, UK
    BOTH are only considered if there is a feature on the plot, first the Resource_FeatureBooleans expects a feature type and determines if the resource can occur, then the Resource_FeatureTerrainBooleans expects a terrain type and determines is the resource can occur. So you can set a resource up to occur on any tile that has a forest (feature) or any tile that is a tundra (terrain) that has ANY feature. If you want any plot that is tundra without a feature you need to use the Resource_TerrainBooleans table.

    Neither table is used directly by the DLL, so they are only used by the map scripts.
     
    Last edited: Dec 4, 2020
    sman1975 likes this.
  3. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    Forgive me. I'm such a jackass. The question should have been: what's the difference between the Resource_TerrainBooleans and the Resource_FeatureTerrainBooleans tables?

    Those are the 2 tables that share the same schema (ResourceType, TerrainType), and have similar, but not always identical data inside.

    I've read a lot about the advantages of not changing the "AssignStartingPlots" code when adding map features. So, I plan on adding the Resources to the map using a function that executes after the map script has ran (like @Horem did here: https://forums.civfanatics.com/resources/horems-new-resources-hnr.21758/), then would either of these tables have an impact on my new resources?

    Thanks, and sorry for the confusion. :wallbash:
     
  4. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,587
    Location:
    Near Portsmouth, UK
    Answer is (edited) above.

    The code in CanHaveResource is
    if (plot has ANY feature) {
    if (plot has feature in Resource_FeatureBooleans) {
    can place resource on plot = true
    } else if (plot has terrain in Resource_FeatureTerrainBooleans) {
    can place resource on plot = true
    }
    } else {
    if (plot has terrain in Resource_TerrainBooleans) {
    can place resource on plot = true
    }
    }
     
    sman1975 likes this.
  5. sman1975

    sman1975 Emperor

    Joined:
    Aug 27, 2016
    Messages:
    1,246
    Location:
    Dallas, TX
    Thanks, @whoward69, for such a good explanation. My dyslexia is a real pain sometimes in trying to keep things like these straight. Appreciate it!
     

Share This Page