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. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Yeah even if you have higher crime you can still counter the effects by having more :)/:health:/+:gold:. Thus you don't always need an anti-crime building to keep your city running. You can still counter the negative effects of crime the same way as if a normal building had :mad:/:yuck:/-:gold:.
     
  2. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    So -20 per turn from palace.
    Decay is 5% (?) so at -19 that would be +4 per turn

    Net is -3 so that leaves +13 per turn from diffusion? How does that work?
     
  3. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,418
    I modelled it a bit assymetric (which I should probably change) so a lower crime than the surrounding actually only diffuses to the plot on which the city is instead of to all surrounding plots but to compensate it diffuses 20%.
     
  4. ls612

    ls612 Deity Moderator

    Joined:
    Mar 10, 2008
    Messages:
    8,072
    Location:
    America
    @AIAndy: In my working copy of C2C, I was working on getting units to spread/stop crime, in preparation for the changes planned for after V22 is released. However, when I modified the Ambusher I have a small problem. Code is below, and the changes are in bold.

    Code:
    		<UnitInfo>
    			<Class>UNITCLASS_AMBUSHER</Class>
    			<Type>UNIT_AMBUSHER</Type>
    			<UniqueNames/>
    			<Special>NONE</Special>
    			<Capture>NONE</Capture>
    			<Combat>UNITCOMBAT_ARCHER</Combat>
    			<Domain>DOMAIN_LAND</Domain>
    			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
    			<Invisible>INVISIBLE_CAMOUFLAGE</Invisible>
    			<SeeInvisible>INVISIBLE_CAMOUFLAGE</SeeInvisible>
    			<Description>TXT_KEY_UNIT_AMBUSHER</Description>
    			<Civilopedia>TXT_KEY_UNIT_AMBUSHER_PEDIA</Civilopedia>
    			<Strategy>TXT_KEY_UNIT_AMBUSHER_STRATEGY</Strategy>
    			<Help/>
    			<Advisor>ADVISOR_GROWTH</Advisor>
    			<bAnimal>0</bAnimal>
    			<bFood>0</bFood>
    			<bNoBadGoodies>0</bNoBadGoodies>
    			<bOnlyDefensive>0</bOnlyDefensive>
    			<bNoCapture>0</bNoCapture>
    			<bQuickCombat>0</bQuickCombat>
    			<bRivalTerritory>1</bRivalTerritory>
    			<bMilitaryHappiness>1</bMilitaryHappiness>
    			<bMilitarySupport>1</bMilitarySupport>
    			<bMilitaryProduction>1</bMilitaryProduction>
    			<bPillage>0</bPillage>
    			<bSpy>0</bSpy>
    			<bSabotage>0</bSabotage>
    			<bDestroy>0</bDestroy>
    			<bStealPlans>0</bStealPlans>
    			<bInvestigate>0</bInvestigate>
    			<bCounterSpy>0</bCounterSpy>
    			<bFound>0</bFound>
    			<bGoldenAge>0</bGoldenAge>
    			<bInvisible>0</bInvisible>
    			<bFirstStrikeImmune>1</bFirstStrikeImmune>
    			<bNoDefensiveBonus>0</bNoDefensiveBonus>
    			<bIgnoreBuildingDefense>0</bIgnoreBuildingDefense>
    			<bCanMoveImpassable>0</bCanMoveImpassable>
    			<bCanMoveAllTerrain>0</bCanMoveAllTerrain>
    			<bFlatMovementCost>0</bFlatMovementCost>
    			<bIgnoreTerrainCost>0</bIgnoreTerrainCost>
    			<bNukeImmune>0</bNukeImmune>
    			<bPrereqBonuses>0</bPrereqBonuses>
    			<bPrereqReligion>0</bPrereqReligion>
    			<bMechanized>0</bMechanized>
    			<bSuicide>0</bSuicide>
    			<bHiddenNationality>1</bHiddenNationality>
    			<bAlwaysHostile>1</bAlwaysHostile>
    			<bWorkerTrade>0</bWorkerTrade>
    			<bMilitaryTrade>0</bMilitaryTrade>
    			<UnitClassUpgrades>
    				<UnitClassUpgrade>
    					<UnitClassUpgradeType>UNITCLASS_ROGUE</UnitClassUpgradeType>
    					<bUnitClassUpgrade>1</bUnitClassUpgrade>
    				</UnitClassUpgrade>
    			</UnitClassUpgrades>
    			<UnitClassTargets/>
    			<UnitCombatTargets/>
    			<UnitClassDefenders/>
    			<UnitCombatDefenders/>
    			<FlankingStrikes/>
    			<UnitAIs>
               		<UnitAI>
               			<UnitAIType>UNITAI_ATTACK</UnitAIType>
               			<bUnitAI>1</bUnitAI>
               		</UnitAI>
               		<UnitAI>
               			<UnitAIType>UNITAI_COUNTER</UnitAIType>
               			<bUnitAI>1</bUnitAI>
               		</UnitAI>
    			</UnitAIs>
    			<NotUnitAIs/>
    			<Builds/>
    			<ReligionSpreads/>
    			<CorporationSpreads/>
    			<GreatPeoples/>
    			<Buildings/>
    			<ForceBuildings/>
    			<ForceObsoleteTech>TECH_MATCHLOCK</ForceObsoleteTech>
    			<HolyCity>NONE</HolyCity>
    			<ReligionType>NONE</ReligionType>
    			<StateReligion>NONE</StateReligion>
    			<PrereqReligion>NONE</PrereqReligion>
    			<PrereqCorporation>NONE</PrereqCorporation>
    			<PrereqBuilding>BUILDING_POISONCRAFTERs_HUT</PrereqBuilding>
    			<PrereqTech>TECH_POISON_CRAFTING</PrereqTech>
    			<TechTypes/>
    			<BonusType>NONE</BonusType>
    			<PrereqBonuses/>
    			<ProductionTraits/>
    			<Flavors/>
    			<iAIWeight>0</iAIWeight>
    			<iCost>20</iCost>
    			<iHurryCostModifier>0</iHurryCostModifier>
    			<iAdvancedStartCost>100</iAdvancedStartCost>
    			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
    			<iMinAreaSize>-1</iMinAreaSize>
    			<iMoves>2</iMoves>
    			<bNoRevealMap>0</bNoRevealMap>
    			<iAirRange>0</iAirRange>
    			<iAirUnitCap>0</iAirUnitCap>
    			<iDropRange>0</iDropRange>
    			<iNukeRange>-1</iNukeRange>
    			<iWorkRate>0</iWorkRate>
    			<iBaseDiscover>0</iBaseDiscover>
    			<iDiscoverMultiplier>0</iDiscoverMultiplier>
    			<iBaseHurry>0</iBaseHurry>
    			<iHurryMultiplier>0</iHurryMultiplier>
    			<iBaseTrade>0</iBaseTrade>
    			<iTradeMultiplier>0</iTradeMultiplier>
    			<iGreatWorkCulture>0</iGreatWorkCulture>
    			<iEspionagePoints>10</iEspionagePoints>
    			<TerrainImpassables/>
    			<FeatureImpassables/>
    			<TerrainPassableTechs/>
    			<FeaturePassableTechs/>
    			<iCombat>3</iCombat>
    			<iCombatLimit>100</iCombatLimit>
    			<iAirCombat>0</iAirCombat>
    			<iAirCombatLimit>0</iAirCombatLimit>
    			<iXPValueAttack>8</iXPValueAttack>
    			<iXPValueDefense>4</iXPValueDefense>
    			<iFirstStrikes>1</iFirstStrikes>
    			<iChanceFirstStrikes>0</iChanceFirstStrikes>
    			<iInterceptionProbability>0</iInterceptionProbability>
    			<iEvasionProbability>0</iEvasionProbability>
    			<iWithdrawalProb>0</iWithdrawalProb>
    			<iCollateralDamage>0</iCollateralDamage>
    			<iCollateralDamageLimit>0</iCollateralDamageLimit>
    			<iCollateralDamageMaxUnits>0</iCollateralDamageMaxUnits>
    			<iCityAttack>-50</iCityAttack>
    			<iCityDefense>-50</iCityDefense>
    			<iAnimalCombat>0</iAnimalCombat>
    			<iHillsAttack>0</iHillsAttack>
    			<iHillsDefense>0</iHillsDefense>
    			<TerrainNatives>
    				<TerrainNative>
    					<TerrainType>TERRAIN_GRASS</TerrainType>
    					<bTerrainNative>1</bTerrainNative>
    				</TerrainNative>
    				<TerrainNative>
    					<TerrainType>TERRAIN_PLAINS</TerrainType>
    					<bTerrainNative>1</bTerrainNative>
    				</TerrainNative>
    				<TerrainNative>
    					<TerrainType>TERRAIN_DESERT</TerrainType>
    					<bTerrainNative>1</bTerrainNative>
    				</TerrainNative>
    			</TerrainNatives>
    			<FeatureNatives/>
    			<TerrainAttacks>
    				<TerrainAttack>
    					<TerrainType>TERRAIN_GRASS</TerrainType>
    					<iTerrainAttack>25</iTerrainAttack>
    				</TerrainAttack>
    				<TerrainAttack>
    					<TerrainType>TERRAIN_PLAINS</TerrainType>
    					<iTerrainAttack>25</iTerrainAttack>
    				</TerrainAttack>
    				<TerrainAttack>
    					<TerrainType>TERRAIN_DESERT</TerrainType>
    					<iTerrainAttack>25</iTerrainAttack>
    				</TerrainAttack>
    				<TerrainAttack>
    					<TerrainType>TERRAIN_MARSH</TerrainType>
    					<iTerrainAttack>25</iTerrainAttack>
    				</TerrainAttack>
    			</TerrainAttacks>
    			<TerrainDefenses/>			
    			<FeatureAttacks>
    				<FeatureAttack>
    					<FeatureType>FEATURE_JUNGLE</FeatureType>
    					<iFeatureAttack>10</iFeatureAttack>
    				</FeatureAttack>
    				<FeatureAttack>
    					<FeatureType>FEATURE_FOREST</FeatureType>
    					<iFeatureAttack>15</iFeatureAttack>
    				</FeatureAttack>
    			</FeatureAttacks>
    			<FeatureDefenses>
    				<FeatureDefense>
    					<FeatureType>FEATURE_FOREST</FeatureType>
    					<iFeatureDefense>10</iFeatureDefense>
    				</FeatureDefense>
    			</FeatureDefenses>
    			<UnitClassAttackMods/>
    			<UnitClassDefenseMods/>
    			<UnitCombatMods>
    				<UnitCombatMod>
    					<UnitCombatType>UNITCOMBAT_RECON</UnitCombatType>
    					<iUnitCombatMod>50</iUnitCombatMod>
    				</UnitCombatMod>
    			</UnitCombatMods>
    			<UnitCombatCollateralImmunes/>
    			<DomainMods/>
    			<BonusProductionModifiers/>
    			<iBombRate>0</iBombRate>
    			<iBombardRate>0</iBombardRate>
    			<SpecialCargo>NONE</SpecialCargo>
    			<DomainCargo>NONE</DomainCargo>
    			<iCargo>0</iCargo>
    			<iConscription>0</iConscription>
    			<iCultureGarrison>0</iCultureGarrison>
    			<iExtraCost>0</iExtraCost>
    			<iAsset>3</iAsset>
    			<iPower>9</iPower>
    			<UnitMeshGroups>
    				<iGroupSize>1</iGroupSize>
    				<fMaxSpeed>1.75</fMaxSpeed>
    				<fPadTime>1</fPadTime>
    				<iMeleeWaveSize>1</iMeleeWaveSize>
    				<iRangedWaveSize>0</iRangedWaveSize>
    				<UnitMeshGroup>
    					<iRequired>1</iRequired>
    					<EarlyArtDefineTag>ART_DEF_UNIT_AMBUSHER</EarlyArtDefineTag>
    				</UnitMeshGroup>
    			</UnitMeshGroups>
    			<FormationType>FORMATION_TYPE_DEFAULT</FormationType>
    			<HotKey/>
    			<bAltDown>0</bAltDown>
    			<bShiftDown>0</bShiftDown>
    			<bCtrlDown>0</bCtrlDown>
    			<iHotKeyPriority>0</iHotKeyPriority>			
    			<FreePromotions>
    				<FreePromotion>
    					<PromotionType>PROMOTION_INDUSTRYESPIONAGE</PromotionType>
    					<bFreePromotion>1</bFreePromotion>
    				</FreePromotion>
    				<FreePromotion>
    					<PromotionType>PROMOTION_COMMANDO</PromotionType>
    					<bFreePromotion>1</bFreePromotion>
    				</FreePromotion>
    				<FreePromotion>
    					<PromotionType>PROMOTION_MARAUDER</PromotionType>
    					<bFreePromotion>1</bFreePromotion>
    				</FreePromotion>
    			</FreePromotions>
    			<LeaderPromotion>NONE</LeaderPromotion>
    			<iLeaderExperience>0</iLeaderExperience>
    [B]			<PropertyManipulators>
    			  <PropertySource>
    			    <PropertySourceType>PROPERTYSOURCE_CONSTANT</PropertySourceType>
    			    <PropertyType>PROPERTY_CRIME</PropertyType>
    			    <iAmountPerTurn>5</iAmountPerTurn>
    			  </PropertySource>
    			</PropertyManipulators>[/B]
    		</UnitInfo>
    This is how it is set up for crime buildings in the xml, yet when I load C2C, in the pedia, it does not show that the Ambusher has any effect on crime (see pic attached). Is this a bug in the pedia, or am I doing it wrong? Thanks.
     
  5. AIAndy

    AIAndy Deity

    Joined:
    Jun 8, 2011
    Messages:
    3,418
    Seems like I forgot to add the display code for the property manipulators to the unit type. Check if the unit has any crime on it after a turn when you run it with this XML.
     
  6. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    I didn't respond to this last night because I wanted to think about it some more.

    Having now done so, I'd like to once again express my resistance to units with positive crime sources. Two reasons:

    • It (IMO) doesn't model anything! The only 'units' (aka groups of people) that spread crime are criminals pretty much. These could be units I guess, but they would NOT be player-controlled units. Give me an example of something that we would model by a player-controlled crime promoter (one exception below, but it's a very special case better handled differently). The amusher certainly isn't one. He's a sort of early special-ops military - having him spread crime is like saying you get more crime wherever CIA agents or navy seals go (at home!!)
    • I have thought about how I'd handle them in the AI some more, and basically I can't see how to do it without pretty much giving them a totally new and separate AI. The considerations needed for quarantining them from your cities and other troops are just too intrusive to work with any of the current routines.

    On the other hand, there are plenty of OTHER areas where I think we SHOUILD be expanding the use of the crime property (and properties generally):
    • Tags on actions for spies - thus promoting crime could be a new spy action (which would act as a crime source on the spy WHILE it was performing that mission only), which is the exception I mentioned above. Also other existing and new espionage missions should be property dependent (cost of generating riots etc. might be reduced by higher crime, cost of arson should be reduced by higher flammability, some missions should require pre-req values of crime, etc.)
    • Regular units should get NEGATIVE crime sources to model police. It's entirely reasonable that ngative sources should be player controlled. They would also be easily handled by the AI
     
  7. ls612

    ls612 Deity Moderator

    Joined:
    Mar 10, 2008
    Messages:
    8,072
    Location:
    America
    We have units named thiefs, rogues, guerillas, and police (men, cars, and mechs). These IMO all very directly impact crime, and should be modeled as such. I agree as well with the first of your two points for more crime, but not on the second. The Ambusher is just the name that was chosen for the precursor to the Rogue, so a bit of crime there would not IMO be a bad thing. The Sniper units that come later in the tree though would not spread crime.

    On to your second point. Normal military units may supress some crime, but in most cases military units stationed in civilian centers actually commit as much crime as they cause. The exceptions in C2C are ofcourse the Police units, which are specifically trained to stop crime.

    The point about the AI is much more concerning, and it is for that reason that I think I'll hold off on adding positive crime to units. The Police will still get negative crime though. Is there any "band-aid" AI fix that could be made to at least allow the AI not to kill themselves slowly and unwittingly with Thief-type units?
     
  8. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    I agree with ls612. If we are having police that give -crime then the thieves/rogues should give +crime. Controlling doesn't mean they won't still do bad things or influence others to do bad things.

    However since there is a limit on how many rogue/thief units you can build at a time I do not think that the AI will kill themselves on having too many crime units.
     
  9. ls612

    ls612 Deity Moderator

    Joined:
    Mar 10, 2008
    Messages:
    8,072
    Location:
    America
    @AIAndy: Well, when I added -crime to the Police Mech and tested it ingame, not only did it work as intended, but it also displayed correctly. It only seems to have problems with displaying +crime on units. Could you please look into this?
     
  10. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    I can probably do something with them, but it will certainly impact the way the ai uses these units. Basically it means it has to stop using them as spotters in it's cities, which means they will have to lose all the city ai types. Probably have to leave them with just pillage and explore ais.

    My biggest concern is that strategies around deliberate spreading of crime to your opponents using these units will become important, and that will need a lot more work in the ai to get it to do it effectively.
     
  11. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    @ls612

    Is it on the unit or the promotion? Because I am thinking that it would be better if +/- crime ere associated with a promotion rather than the unit directly. Such as Riot Control I giving -5 crime per turn and some new criminal promotion given to the crime units.
     
  12. ls612

    ls612 Deity Moderator

    Joined:
    Mar 10, 2008
    Messages:
    8,072
    Location:
    America
    That's on the unit. As I wrote in response to Koshling above, the only units I intend to apply crime to now (read, tomorrow, first thing after V22 comes out) are the Town Watch/Police units, which I think do deserve a small bit of crime-fighting power. The +crime to other units would have to wait until something could be arragned for the AI.

    I am also in favor of adding crime to promotions, and can do Riot Control specifically tomorrow if you want.

    Could you not add a UNITAI_CRIME, which would essentially say 'send this unit into enemy territory and wreak havoc', which is what I think those units should be doing anyways. That would sound like a reasonable short to mid-term fix.
     
  13. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Well all the anti-crime units have Riot Control I on them so they would all instantly get anti-crime. And since you cannot get the promotion normally it will not have an issue with other types of units (aka non-police).

    EDIT: I would also like to bring back Riot Control II, III, IV and V. These would each require the promotion before it and add -5 crime for each additional promotion. Thus at max you could have -25 crime per turn for a single unit.

    Could you add those promotions and just have use the same icon. Thus the requirements would be ...

    - Riot Control II (Req Riot Control I)
    - Riot Control III (Req Riot Control II)
    - Riot Control IV (Req Riot Control III)
    - Riot Control V (Req Riot Control IV)
     
  14. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    Yes, but I'd have to write bunch of new routines to implement the new ai type.
    for now just taking all the ai's off them apart from explore and pillage should do as a sticky tape solution.
     
  15. ls612

    ls612 Deity Moderator

    Joined:
    Mar 10, 2008
    Messages:
    8,072
    Location:
    America
    @Hydro and Koshling:

    OK, here's what my plan is.

    1. Add a small anti-crime bonus to all police units. Hydro, this is so that the later police units will have a greater impact on Crime, which seems reasonable to me.

    2. Add Riot Control promotions as Hydro has requested.

    3. Add +crime to the Bandit/thief units excepting Snipers. I'll also change the UnitAI for them as Koshling suggested as a temporary AI solution.

    Does this sound like a reasonable plan?
     
  16. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    Sounds good to me.

    Also do you think there should be a Crime promotion that is the inverse of the Riot Control? Would it be beneficial for a crime unit to give more crime?
     
  17. Hydromancerx

    Hydromancerx C2C Modder

    Joined:
    Feb 27, 2008
    Messages:
    16,281
    Location:
    California, USA
    @ls612



    Here are 5 icons/buttons for the riot control promotions. Please update Riot Control I and add the rest to the new promotions.
     
  18. ls612

    ls612 Deity Moderator

    Joined:
    Mar 10, 2008
    Messages:
    8,072
    Location:
    America
    I'd wait on a Crime promotion until the AI fully understands it.
     
  19. Koshling

    Koshling Vorlon

    Joined:
    Apr 11, 2011
    Messages:
    9,254
    Sounds good to me.

    I'd also agree that we should wait on the crime promotion a bit until we see how the rest settles in.
     
  20. ls612

    ls612 Deity Moderator

    Joined:
    Mar 10, 2008
    Messages:
    8,072
    Location:
    America
    @AIAndy: I figured out exactly what is wrong with the property displays, as well as finding an actual property bug. The mouseover on the map shows the negative crime, but it does not properly take into account multiple units on a tile, IE if i had three Police Mechs on one tile it would only show -35 crime/turn (what I set it to for testing), as opposed to -105, which is what it should be.

    The display bug seems limited only to the Pedia mouseover. Could you try to resolve these bugs please before midnight, when SO plans to release V22?
     

Share This Page