C2C SVN Changelog

Added AI to evaluate building/city properties (flammability etc.). This works as follows:

  • 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.
 
Update
I have added tags to provide more than one resource from a building: <ExtraFreeBonuses>
 
Update
I have added tags to provide more than one resource from a building: <ExtraFreeBonuses>

The AI will need code to handle that in buildign evaluation.

@Hydro/DH - plaese let me know as soon as this tag goes into use (since that'll give me a ready made test case), and I'll adjust thwe AI for it (won't be hard)
 
Just pushed to SVN:

Slight rework of a very badly written piece of code that is part of AI building evaluation, and was the major cause of slowdowns since we added more resource types (26 seconds down to 3 seconds spent in building evaluation with current assets in my own game end-turn). Since it was actually the same piece of code that needed changing for AIAndy's new extraFreeBonus stuff I did that at the same time, so the AI now evaluates that tag correctly as well.
 
@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.

Yeah Ori has not made any crime events yet (as far as I know) so the crime/law building's values do nothing at the moment.

The AI will need code to handle that in buildign evaluation.

@Hydro/DH - plaese let me know as soon as this tag goes into use (since that'll give me a ready made test case), and I'll adjust thwe AI for it (won't be hard)

I will need to update my schemas I guess. I have some already in mind like the apiary to provide both wax and honey. I will try to post it later today.
 
The AI will need code to handle that in buildign evaluation.

@Hydro/DH - plaese let me know as soon as this tag goes into use (since that'll give me a ready made test case), and I'll adjust thwe AI for it (won't be hard)

Done. Most herd buildings provide carcass and the animal resource. Since the doco was not clear I did one herd with no "free bonus" just "extra free bonuses" just to be difficult. Actually, I had done it before I had thought about it - now you know one of the reasons I was used to test documentation when I worked.:mischief:

The pedia works. Now we need to find some graphics for the resources and put them in the gamefont_75 file so the correct icon appears where it should.
 
Just pushed to SVN:

Slight rework of a very badly written piece of code that is part of AI building evaluation, and was the major cause of slowdowns since we added more resource types (26 seconds down to 3 seconds spent in building evaluation with current assets in my own game end-turn). Since it was actually the same piece of code that needed changing for AIAndy's new extraFreeBonus stuff I did that at the same time, so the AI now evaluates that tag correctly as well.
I was following all references to the functions of the old tag in the code to replicate the functionality but annoyingly enough the AI code was not showing up. Looks like it loses track of what kBuilding is halfway through that very, very long function in the AI that uses it.
 
Update
I have added tags to provide more than one resource from a building: <ExtraFreeBonuses>

Thx this is going to be needed alot soon;)

Just pushed to SVN:

Slight rework of a very badly written piece of code that is part of AI building evaluation, and was the major cause of slowdowns since we added more resource types (26 seconds down to 3 seconds spent in building evaluation with current assets in my own game end-turn). Since it was actually the same piece of code that needed changing for AIAndy's new extraFreeBonus stuff I did that at the same time, so the AI now evaluates that tag correctly as well.

I knew there was something going bonkers, WOW that a huge improvement and muchly needed;) I see AIAndy had a question also about this in a earlier post?

Most herd buildings provide carcass and the animal resource. Since the doco was not clear I did one herd with no "free bonus" just "extra free bonuses" just to be difficult. Actually, I had done it before I had thought about it - now you know one of the reasons I was used to test documentation when I worked.:mischief:

The pedia works. Now we need to find some graphics for the resources and put them in the gamefont_75 file so the correct icon appears where it should.

To the one that handles the TGA file, how much is too much for these resources before they "get out of hand."
 
Personally I think having such diverse resources is great. The main limit is map resources since there is only so much space on the map for them to generate. But building made resources have lots of potential.

I understand that, i guess i wrote stuff wrong again, but i was meaning to say, in the TGA file, are the resources going to be going array if "too" much is added there like before? I hope this is a better explanation?
 
I understand that, i guess i wrote stuff wrong again, but i was meaning to say, in the TGA file, are the resources going to be going array if "too" much is added there like before? I hope this is a better explanation?

Oh you mean is there a 2nd limit? Yeah I have no idea. We wil just have to see. So far all the old goods are converted so that's good. Has anyone encountered a graphics error yet? If none then we at least got that far.
 
Oh you mean is there a 2nd limit? Yeah I have no idea. We wil just have to see. So far all the old goods are converted so that's good. Has anyone encountered a graphics error yet? If none then we at least got that far.

Correctamoondo!;)

Also, now that i have separated the FPK's, let me know if anything goes a little crazy or not, "ahem", i mean in the game:p
 
Oh you mean is there a 2nd limit? Yeah I have no idea. We wil just have to see. So far all the old goods are converted so that's good. Has anyone encountered a graphics error yet? If none then we at least got that far.

Limit should be very high. The issue I am seeing is more a usability one now, that it's hard to see what's going on with resource trading, since the resources the players are willing/unwilling (mostly the latter for me!) to trade are scrunched up in their own little scrollable box, which now always needs scrolling through. Not a big deal though really. Might be nice to have a button in the trade advisor screen you can press that hides resources you already have in the willing/unwilling windows of other players maybe?
 
Just pushed to SVN:
  • Fixed an incorrect building evaluation of REV stability
  • Added REV stability evaluation to AI civic choices
 
@Koshling:
Is there some way to get Tortoise to ignore files on commit (like the Makefile which tends to be locally different)?
It always gives me those files preselected to upload when I do a commit and it happens that you forget to uncheck them (like now when I accidently uploaded the Makefile and Depends without meaningful changes).
 
Back
Top Bottom