Added AI to evaluate building/city properties (flammability etc.). This works as follows:
When deciding whether to build a particular building, the property evaluation part of the routine looks at each property that building adjusts. For each of these it then looks at the city's current value, calculates the city's would-be value if the building were to be built, and then normalizes both of these quantities to a percentage through the operational range of the property (0 always for anything below the low of the operational range, 100 for anything above the top).
It then multiplies the difference between the would-be and the current values by the AI weight to obtain a base value for that building for that property. This is then multiplied up by a measure of how far through the operational range the city is (in the bad direction which may be up or down depending on the sign of the AI weight). This last adjustment is just to make the AI a bit cautious and take more notice of the property as it gets worse.
If the property has a scale type of 'city' (flammability and crime both do) that's it. For other scale types it multipies by the number of cities the scale takes in (so number in landmass for 'area', owned by player in 'player', owned by team in 'team').
The AI currently has NO evaluation for building 'all city' properties (i.e. - those that the building changes the value of in every city of the same owner). These will actually be rather expensive to calculate, and since we don't currently have any (do we?) I have just put it off for now.
I have done an approximate tune of the values for the flammability property as follows:
I chose these values based on what I gleened from what I think Ori is doing for flammability events. I **think** none of his bad events go off for flammability less than about 200 (so set the operational low a bit below this to provide a little leeway), and things basically are as bad as they are going to get around 500 (hence the operational range high). Obviously more flammability is bad, so the AI weight is negative. The -100 actual value is slightly arbitrary - I actually set this first and then tuned some of the ineternal multipliers to put that into what seemed like the right range relative to other factors the AI evaluates on buildings (I wanted a reasonable sized number so that it can be tuned down in small steps if we need to, so starting with -1 would be bad since there is nowhere to go between that and 0!).
So, please keep an eye on AI builds, and if you think they are either overly influenced by flammability, or ignoring it too much, let me know - probably means the AI weight needs chnaging.
@Ori/Hydro - if you have some reason to believe the operational range is wrong (i.e. - events I don't know about) feel free to adjust or discuss.
@Hydro - I have made no attempt to set the values for the crime property since I don't think it has any events (or even usage??) yet. That will need to be done when it does.
- Each property has an operational range (value below which further changes won't make any difference, to value above which it won't)
- Each property has an AI Weight
- Each city has value for each defined property (flammability and crime currently)
- Buildings add or subtract a set amount to the city they are in (or optionally the player for 'all city' properties, but see later)
When deciding whether to build a particular building, the property evaluation part of the routine looks at each property that building adjusts. For each of these it then looks at the city's current value, calculates the city's would-be value if the building were to be built, and then normalizes both of these quantities to a percentage through the operational range of the property (0 always for anything below the low of the operational range, 100 for anything above the top).
It then multiplies the difference between the would-be and the current values by the AI weight to obtain a base value for that building for that property. This is then multiplied up by a measure of how far through the operational range the city is (in the bad direction which may be up or down depending on the sign of the AI weight). This last adjustment is just to make the AI a bit cautious and take more notice of the property as it gets worse.
If the property has a scale type of 'city' (flammability and crime both do) that's it. For other scale types it multipies by the number of cities the scale takes in (so number in landmass for 'area', owned by player in 'player', owned by team in 'team').
The AI currently has NO evaluation for building 'all city' properties (i.e. - those that the building changes the value of in every city of the same owner). These will actually be rather expensive to calculate, and since we don't currently have any (do we?) I have just put it off for now.
I have done an approximate tune of the values for the flammability property as follows:
- Operational range low 100
- Operational range high 500
- AI Weight -100
I chose these values based on what I gleened from what I think Ori is doing for flammability events. I **think** none of his bad events go off for flammability less than about 200 (so set the operational low a bit below this to provide a little leeway), and things basically are as bad as they are going to get around 500 (hence the operational range high). Obviously more flammability is bad, so the AI weight is negative. The -100 actual value is slightly arbitrary - I actually set this first and then tuned some of the ineternal multipliers to put that into what seemed like the right range relative to other factors the AI evaluates on buildings (I wanted a reasonable sized number so that it can be tuned down in small steps if we need to, so starting with -1 would be bad since there is nowhere to go between that and 0!).
So, please keep an eye on AI builds, and if you think they are either overly influenced by flammability, or ignoring it too much, let me know - probably means the AI weight needs chnaging.
@Ori/Hydro - if you have some reason to believe the operational range is wrong (i.e. - events I don't know about) feel free to adjust or discuss.
@Hydro - I have made no attempt to set the values for the crime property since I don't think it has any events (or even usage??) yet. That will need to be done when it does.