Extending the generic property system

@Dancing Hoskuld

1. What do you want to replace my crime buildings with? And why?

2. Is the "Bad Person" like a "Great Person" but they just can build Crime buildings?

3. Are you thinking of having the crime buildings automatically building themselves? If so why could someone not just go into CTRL+A and delete the building? Note this is not considered cheating like say going into World Builder and deleting the building.

1. It makes no sense for a government to build crime buildings. If the government builds them then they aren't criminal.

2. I thought I had managed to get a copy of the art for these units but I did not. Bad People are not under your control. They try and spread their "business" to new cities. We may not need bad people at all with the property system it would just have looked cool having a Drug Lord send agents into cities to set up their business concerns.

3. Ctrl_A wont let you sell "free" buildings ie any buildings with a cost of -1 nor national or great wonders.

I found a very old mod idea from Sevo which looks interesting for expanding religions in a way that fits C2C & WLBO but is totally different to the other religion mods. I am thinking on it at the moment.
 
What about the special rogue/theif units? What buildings would unlock them?

1. It makes no sense for a government to build crime buildings. If the government builds them then they aren't criminal.

That's not entirely true. A government may want to bribe terrorist organizations or mob groups to do the dirt work for them that they cannot do without formally declaring war.

3. Ctrl_A wont let you sell "free" buildings ie any buildings with a cost of -1 nor national or great wonders.

Ah ok. However I disagree that you should not be able to make crime related buildings. Especially when it unlocks cool units like Pirates, Mob Cars and Assassins.

Not to mention just because something is a crime for the citizens doesn't mean the government will not break their own laws to do it secretly.

And as for micro managing unless your say a communist government that owns everything, the general way we micromanage the game such as building a forge or factory should really be something a company would but on its own and not the government. However having the AI build it for you would loose some of the fun I think.
 
Here are some other things that could use this system:

-Corporations: Could each be given unique spread propagators, adding another level to Realistic Corporations.
That is also something that would be useful for religions so religions can have actual strengths in a city and interact with each other.

One quick question; Does the AI know how to handle this, or does it need to be told about each individual property, or both?
As Koshling mentions you can have far more complex behaviors using this than a generic AI could ever hope to handle.
Nonetheless several of the things we want to model do not require that deep understanding for the AI to start with. Sources that add a property or remove it and interactions that convert a property to a property are examples. But it would be hard for it to evaluate if this propagator that spreads a property to the surrounding plots is a good or bad thing.
That does not mean that you need to avoid all those but the AI should still be able to make good decisions without knowing about it. At least at the start. Special AI code will need to be added wherever the AI needs to know more than the simple things.

An example: Lets assume you have a disease modelled with medic buildings that act as drains for the disease. From the property info the AI knows that this property is bad (it has a negative weight) so if in a disease breakout the value of that property in a city is high (near the operational maximum in the info), the AI considers it bad and it will give a high value to building the medic buildings. It can do that without knowing about the complex spreading behavior of the disease.
 
An example: Lets assume you have a disease modelled with medic buildings that act as drains for the disease. From the property info the AI knows that this property is bad (it has a negative weight) so if in a disease breakout the value of that property in a city is high (near the operational maximum in the info), the AI considers it bad and it will give a high value to building the medic buildings. It can do that without knowing about the complex spreading behavior of the disease.

Very true. However, if the spreading behaviour is influencable (e.g. - it travels on units, or (to a lesser extent) along routes), it would be desirable for the AI to be clued into these factors, because there are meaningful strategies implied (reduce routes to minimal connectivity rather than everywhere spam for example might be a factor, reduce unit movement between cities, or certainly FROM cities with high disease would certainly be meaningful and a human player would liekly clue in to this.

If disease spread is just via plots based on distance however (not units), or entirely a city matter, then indeed the AI doesn't need to know anything more.
 
With the automatic addition of buildings when properties are in a defined range, I think it is time to move crime to the drain/source system.

The necessary steps are:
  • Replace all the +crime on buildings with property sources
  • Add decay and propagators
  • Add some crime buildings that are not built manually but automatically added in certain crime ranges. While the low crime ones might still have some benefits the high crime ones should be mostly negative.
 
Guess I better make a list of all the buildings ...

Crime
- Assassin's Den
- Bandit's Hideout
- Brothel
- Casino
- Chop Shop
- Drug Lord's Mansion
- Mercenary Camp
- Mercenary Stables
- Military Airbase
- Mob Storefront
- Pirate's Cove
- Poacher's Camp
- Rebel's Camp
- Saloon
- Smuggler's Shanty
- Terrorist's Compound

Law
- AI Surveillance
- Alcatraz
- Check Point
- Chief's Hut
- Courthouse
- Crucifixion Crosses
- Cryogenic Prison
- Electric Chair
- Gallows
- Guillotine
- Insane Asylum
- Intelligence Agency
- Interrogation Building
- Jail
- Lethal Injection
- Maximum Security Prison
- Meeting Hall
- Mind Control Center
- Ordinance - Neighborhood Watch
- Ordinance - Youth Curfew
- Panopticon Prison
- Police Academy
- Police Station
- Reeducation Center
- Scotland Yard
- Security Bureau
- Security Center
- Sheriff's Office
- Stocks
- Supreme Court
- Town Watch

If anyone knows of any more I missed let me know.
 
With the automatic addition of buildings when properties are in a defined range, I think it is time to move crime to the drain/source system.

The necessary steps are:
  • Replace all the +crime on buildings with property sources
  • Add decay and propagators
  • Add some crime buildings that are not built manually but automatically added in certain crime ranges. While the low crime ones might still have some benefits the high crime ones should be mostly negative.

Should we also add property sources to the Crime units (the Ambusher-Thief line)?
 
Guess I better make a list of all the buildings ...

Crime
- Assassin's Den
- Bandit's Hideout
- Brothel
- Casino
- Chop Shop
- Drug Lord's Mansion
- Mercenary Camp
- Mercenary Stables
- Military Airbase
- Mob Storefront
- Pirate's Cove
- Poacher's Camp
- Rebel's Camp
- Saloon
- Smuggler's Shanty
- Terrorist's Compound

If anyone knows of any more I missed let me know.

I would not call the ones I highlighted in red crime buildings. Some of them may contribute to crime, although why a Military Airbase should contribute more than a barracks is beyond me.

The ones in red, with perhaps the pirates cove, may be government run. Where as the others should not be player controlled and should only have malus increasing the crime rate and requiring a unit similar in form to the inquisitioner to remove.
 
@Dancing Hoskuld

I am merely listing all the buildings that currently give +crime. How we alter them for the new system is another matter. Either way the crime code needs to be removed (and replaced) from all the buildings no matter if they have + or - crime.

Why does a Military Airbase increase crime? Why doesn't a Naval Academy or other military building?
 
Should we also add property sources to the Crime units (the Ambusher-Thief line)?
That depends on if we want to have crime rating on units in general.
If units have crime rating that diffuses to the plot below them then they will leave a crime trail, especially the crime units.
 
Any way I was pointing out which buildings could be ones build by having too much crime - the black ones.

That's one thing I don't understand. How are you suppose to get crime if you cannot build the crime buildings? And once the crime buildings are build do they just add even more crime?

Seems like a chicken or the egg mixed with a snowball effect.
 
That's one thing I don't understand. How are you suppose to get crime if you cannot build the crime buildings? And once the crime buildings are build do they just add even more crime?

Seems like a chicken or the egg mixed with a snowball effect.
Well, we could add some base crime source from population. And you could still build some crime buildings. But the non controllable crime buildings are more bad than good then (unhappiness, -:gold: or something else depending on the theme of the building).
 
I saw this so i figured I would toss something out there.

So could a unit spread spirit? I mean could there be a unit charged up from running around on individual quests and then produce a religious devotion. So this in turn creates some religious nonsense that gives more happiness, culture or whatever, and it effects units.

I am asking because of the nomadic camp acting like a city. Could you build a specialist like unit then it runs around giving whatever crime, disease, spirit, and etc to units in the vicinity?
 
I saw this so i figured I would toss something out there.

So could a unit spread spirit? I mean could there be a unit charged up from running around on individual quests and then produce a religious devotion. So this in turn creates some religious nonsense that gives more happiness, culture or whatever, and it effects units.

I am asking because of the nomadic camp acting like a city. Could you build a specialist like unit then it runs around giving whatever crime, disease, spirit, and etc to units in the vicinity?
In short: Yes.

EDIT: Actually it is a quite interesting idea to have some generic religious spirit. If you would need it to found a religion but that would convert the spirit into the specific religion strength that could prevent the tech leader from getting all the religions.
 
Reference: How to add a new property
Step 1: The property info

Open Assets/XML/GameInfo/CIV4PropertyInfos.xml
Currently there is no remapping implemented so only add at the end.
Most of the entries are text references to Assets/XML/Text/Properties_Civ4GameText.xml.
Mind that not all of those texts are actually used at the moment and some of the displays have been replaced with easier ones using the icons.

iAIWeight tells the AI if the property is good or bad and how good or bad it is. Positive is good, negative is bad.
AIScaleType tells the AI how it should scale the weight. AISCALE_CITY will cause it to consider the property more important in larger cities and less important in smaller cities.
iOperationalRangeMin and iOperationalRangeMax will tell the AI in which range the property will usually be and the AI will assume that getting a negative property close to the end of the range will cause considerably worse effects than having it somewhere in the mid of the range.

The most important thing to consider is bSourceDrain. It decides the behavior of the property. A property that is not source/drain will behave similar to something like happiness. Buildings add it or remove it, but the happiness remains constant when you don't build or lose buildings (except for temporary effects).
Source/drain properties on the other hand are dynamic properties that have sources that provide a property increase every turn and drains that decrease it. There are also interactions that might convert a property to a different one each turn or similar things. And finally there are propagators that spread, diffuse or gather properties to other objects.

ChangePropagators allow you to copy changes to a property on one object to another object type. This generates a kind of accumulated value. Example: Flammability uses that by propagating 100% of the city flammability to the player. So the player flammability will always be the sum of the flammabilities of the cities of that player.

PropertyManipulators are used for source/drain properties and are explained in the previous tutorial (using them in the property info itself applies them to all objects of a certain type).

PropertyBuildings allow you to specify buildings that should be automatically built when the property is in a certain range and removed once it is not. This might be real buildings (but always give them a hammer cost of -1 so they are not sellable) or pseudo buildings. The important thing is that that allows you to apply all kinds of effects on the cities depending on the property value. Mind that currently the requirements defined in the building info are ignored for this (I will change that at some point but it requires reevaluating the property buildings not only on property changes but also on changes that might influence those requirements).

PropertyPromotions is the same as PropertyBuildings except that it applies to units via promotions. So you can apply effects on the units depending on the property value. Important here is as well that you don't use promotions that the unit might get in another way.


Step 2: Add a property icon

Property icons are added to the game font so you have to open the game font TGAs in Assets/res/Fonts. I recommend using Asaf's Game Font Editor ( http://forums.civfanatics.com/showthread.php?t=429541 ).
Below the religion and corporation icons you will see the icons for crime and flammability. New properties need to be added here in the same order as they have in the XML.


Step 3: Add the properties to other info XMLs

If your property is not a drain source property then the main next step is to consider all the buildings that you want to add that property to and then add them there in the building XMLs.
For drain source properties you can add property manipulators to a lot of different info XMLs depending on what you want to model (buildings, unit types, promotions, leader traits, ...).
You can also require minimum and maximum property values to allow building something (this is not the same as auto building).
Events can be given property requirements as well.

If you want to model something specific and notice that you cannot do it with the tools currently in there I can add more.
 
That's one thing I don't understand. How are you suppose to get crime if you cannot build the crime buildings? And once the crime buildings are build do they just add even more crime?

Seems like a chicken or the egg mixed with a snowball effect.

There are many studies that indicate that a lack of expected culture leads to increased crime. Same goes for lack of security and infrastructure but to a lesser extent.
 
@DH: Could you please add links to all of AIAndy's Extended Property System tutorials in the stickied Modders Documentation thread? I'm pretty sure that these will soon get buried, and it would be nice to have links to them in one convienent location. Thanks.
 
Back
Top Bottom