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

Extending the generic property system

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

  1. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,420
    When I thought about diseases and introducing a system of spreadables I noticed that actually I could just extend the property system.
    Instead of only static properties that are added by buildings and can trigger events or be a prerequisite to buildings, there could also be dynamic properties that have sources, decay, diffusion, spreading and interaction with each other according to rules defined in the property info.

    That would mean that plots and units can have properties as well and at certain levels of the property value it could add a promotion, a building or a secondary feature.

    In the end that would be quite flexible and could be used to track diseases, immunities, culture, ...

    What do you think?
     
  2. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    The idea is sound but it might be a good idea to extend the property system's UI first/in conjunction with new capabilities. Specifically (roughly in priority order):
    1. City screen itself needs to display property values somehow
    2. Build choice filtering/sorting needs to include defined properties
    3. If they get extended beyond buildings then UI for whatever entities they extend onto will require some extension
    Also, if you plan to use it for things like disease it's very much treading on the toes of the existing health attribute. Given a clean sheet there might well be a lot to be said for health (and happyness) themselves being implemented over a generic property system, but the sheet is far from clean and I'm not sure how the interplay would work out in practise. Converting health and happyness to just be attributes in a generic system would be a huge job, so it's probably not a realistic approach to take to integrating hem.
     
  3. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,540
    Gender:
    Male
    Location:
    Canberra, Australia
    Can it do what I outlined for malaria in the first post of my unhealthiness mod. Basically malaria is present in a city when the local conditions (terrain and latitude) are correct or when spread to a new city via an event. The effect of malaria is ongoing and increases with city population. Some buildings and technologies mitigate the effects somewhat but an outbreak will make them worse for awhile.

    Smallpox on the other hand is devastating spreading very rapidly via trade networks. Afterwards it lies dormant for long periods with an outbreak now and then.

    Typhus spreads through stacks of armed units when at war.
     
  4. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,420
    Depends on the spreading rule possibilities, so yes, something like that will be possible to model.
     
  5. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,420
    About UI:
    I will add a new tab in the city screen where the resources are displayed and then display a list of icons and value. Maybe also some categories once a lot more properties are added.

    About spreading:
    There will be sources and propagators. Both can be tagged to pretty much anything. They can have conditions or a chance to be active.
    Sources provide or drain properties on the objects they belong to (from production of a property to decay).
    Propagators cause a property change on both the object it belongs to and defined neighbor objects (so it can diffuse, spread or gather properties). The neighbor object can also be itself, but a different property (so it can model interactions between properties like conversions, competition or cooperation).
     
  6. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,573
    Gender:
    Male
    Location:
    MN
    That actually sounds like DH is saying, and alot better than the old system in the CvEventManger with diseases/tsunami etc, i am just wondering . .
     
  7. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,420
    It is quite powerful and can simulate a lot of different behaviors depending on what propagator types I add (and the respective code to solve the system).

    Examples would be:
    • Diseases
    • Culture
    • Resources that are produced and used up

    But definitely a lot more.
     
  8. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,420
    City screen has a display for properties now (turned bonus list into a tab and added a new tab for properties next to it).
     
  9. Dancing Hoskuld

    Dancing Hoskuld Deity

    Joined:
    Jul 5, 2004
    Messages:
    23,540
    Gender:
    Male
    Location:
    Canberra, Australia
    @AIAndy great job on the UI. naturally I would have done it different but that is normal when you have a bunch of creative people working on a project.

    I would have gone for three icons each representing OK, Warning and Danger and placed them where the icons are circles in red in the attached images. ;)

    Is it possible to have a property act in a similar way to GG/GP points? I a thinking of Bad People who will be generated by crime points and build bad buildings that take money from your empire and increase crime. It is still an idea at the moment, too many other things on the go, but I do have some units for the Bad People.
     

    Attached Files:

  10. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    If there are "bad" people then there should also be "good" people. In other words "lawful" vs "unlawful".
     
  11. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,573
    Gender:
    Male
    Location:
    MN
    You know "we" could also put in "Bad" Heroes also, and somehow do something with the stats there also, just a thought.
     
  12. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    You mean like historical Villains? That might be cool!
     
  13. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,573
    Gender:
    Male
    Location:
    MN
    Yes, like Mabuto, Saddam etc.
     
  14. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,420
    We can do that but there are still several mechanics that are needed before we are there (e.g. special neutral players to control the villains).
     
  15. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,420
    I have added change propagators to the property info XML.

    Example:
    Code:
          <ChangePropagators>
            <ChangePropagator>
              <GameObjectTypeFrom>GAMEOBJECT_CITY</GameObjectTypeFrom>
              <GameObjectTypeTo>GAMEOBJECT_PLAYER</GameObjectTypeTo>
              <iChangePercent>100</iChangePercent>
            </ChangePropagator>
          </ChangePropagators>
    That means propagate any change of this property type on a city to a player (from city to player that means the owner) with 100% strength. So if crime on the city increases by 5, crime on the player increases by 5 as well.

    These are the game object it knows:
    Code:
    	GAMEOBJECT_GAME,
    	GAMEOBJECT_TEAM,
    	GAMEOBJECT_PLAYER,
    	GAMEOBJECT_CITY,
    	GAMEOBJECT_UNIT,
    	GAMEOBJECT_PLOT,
     
  16. strategyonly

    strategyonly C2C Supreme Commander

    Joined:
    Mar 13, 2006
    Messages:
    20,573
    Gender:
    Male
    Location:
    MN
    I am quite, vague, on this subject, can you give a good example of what the heck your talking about:crazyeye: ( no offense):)
     
  17. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,420
    Well, an example:

    Lets assume you want the chance of an invasion of music loving aliens. So you add a generic property "Music Alien Threat". You add that property to all buildings that have anything to do with music.
    An alien threat is something global so you want the chance dependent on all cities. So you set a change propagator for "Music Alien Threat" from city to game. That means all the music buildings in the cities contribute to the "Music Alien Threat" of the game property object, of which there is only one.
    Now you can set up an invasion event that depends on the global "Music Alien Threat".
     
  18. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Nooo! We must stop Captain EO and his music loving aliens!!
     
  19. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,420
    Some more information about the source/drain or dynamic property system:
    Properties that are declared as bSourceDrain are produced or consumed on game objects, move/spread/diffuse to other game objects and interact with other properties on the same game object. Game objects are plot, unit, city, player, team and game.

    Property Source/Drains produce or consume a property on a game object when they are active. Examples: This can be a constant production with a limit or a percent based decay or growth that is exponential on low amounts and limited on higher amounts.

    Property Interactions model interactions between two different properties on the same game object. Examples: Two properties of which the higher reduces the other or a conversion between two properties or a spreading or diffusion from one property to the other.

    Property Propagators cause a property to interact with the same property on other game objects. Example: A property diffuses or spreads or moves to other game objects or gathers to a game object.

    These property manipulators can be tagged to a lot of different things:
    • Manipulators tagged to the property itself count for all game objects
    • Manipulators on civics count for the player object that has those civics active
    • On promotions it counts for the unit
    • Same for the unit type
    • Buildings count for the city
    • Manipulators on techs apply to the team object
    • Manipulators on terrain, feature, improvement apply to the plot

    Conditions change which manipulators are active when.
    Relations and conditions change which other game objects a propagator refers to.

    Three small examples to show how this system can be used:

    Gather yields for nomads: Sources with limits on the terrains and features generate the yields on the plots. Gather propagators on nomad units gather the yields from the plots.

    A different crime property: Sources and drains for crime on buildings (like they are static now). Diffuse to plots. Gather propagator on forests (good to hide in there).

    Limited resource property: Source on buildings for the resource property. Convert interactions and consume drains on other buildings. Diffuse property between cities.
     
  20. robomani

    robomani Chieftain

    Joined:
    Aug 3, 2010
    Messages:
    83

Share This Page