RevDCM Specific Code Proposals

OK, I should be able to do that pretty easily. I'll try to merge in Zappara's code and then add that XML tag into civicinfos and update the SVN pretty soon. One thing though, I don't mess around with ReadPass (because I don't know what I'm doing), so if it can't be done because of loading order (say civicinfos is loaded before PlayerInfos), it can't be done, but I think civicinfos is one of the last XML files to be loaded, so it should be fine.
 
@Afforess

Tried to compile the source code in this post and got this error:

1>CvGlobals.cpp
1>CvGlobals.cpp(4207) : error C2601: 'CvGlobals::getUSE_IS_VICTORY_CALLBACK' : local function definitions are illegal
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003/bin/cl.exe"' : return code '0x2'
1>Stop.

I simply winmerged all your changes in to the current RevDCM SVN. It all matched neatly though, I could have just copied the files over the top of the originals in the SVN. So not sure what's up, but something isn't working in your code.
 
@Afforess

Tried to compile the source code in this post and got this error:



I simply winmerged all your changes in to the current RevDCM SVN. It all matched neatly though, I could have just copied the files over the top of the originals in the SVN. So not sure what's up, but something isn't working in your code.

Either I or you forgot a brace when you merged. I don't know which, since it compiled fine here, but I have very different sources.
 
Everything just copied over fine, like I said I didn't even need to use winmerge, as the files were identical when I was done (could have just copied the files directly into my compiling source folder). Since you seem to know what the issue is, could you look at CvGlobals.cpp (or h, not sure which) in the attachement and just reupload that/those files? I probably wol't get around to it for a couple of days anyway, but I'd like to add this into the RevDCM core at some point. No sense in wasting time cycling through Python checks that are never referenced, so this just seems like a common sense update anyway. If save game compatibility is maintained, this should actually probably go in the UP, but I'm working under the assumption that it breaks save game due to the changes in CvGlobals.
 
Everything just copied over fine, like I said I didn't even need to use winmerge, as the files were identical when I was done (could have just copied the files directly into my compiling source folder). Since you seem to know what the issue is, could you look at CvGlobals.cpp (or h, not sure which) in the attachement and just reupload that/those files? I probably wol't get around to it for a couple of days anyway, but I'd like to add this into the RevDCM core at some point. No sense in wasting time cycling through Python checks that are never referenced, so this just seems like a common sense update anyway. If save game compatibility is maintained, this should actually probably go in the UP, but I'm working under the assumption that it breaks save game due to the changes in CvGlobals.

AFAIK, adding new python callbacks doesn't break saves, but I would want to double check that first.

Here's the problem, it was my bad:

Code:
int CvGlobals::getUSE_UPGRADE_UNIT_PRICE_CALLBACK()
{
    return m_iUSE_UPGRADE_UNIT_PRICE_CALLBACK;

int CvGlobals::getUSE_IS_VICTORY_CALLBACK()
{
    return m_iUSE_IS_VICTORY_CALLBACK;
}
}

This should actually be:

Code:
int CvGlobals::getUSE_UPGRADE_UNIT_PRICE_CALLBACK()
{
    return m_iUSE_UPGRADE_UNIT_PRICE_CALLBACK;
}

int CvGlobals::getUSE_IS_VICTORY_CALLBACK()
{
    return m_iUSE_IS_VICTORY_CALLBACK;
}

Just change that and it should compile.
 
Having this modifier as a civic option would be cool too. Isn't today's USA like this, they have troops all around the world and they do upgrade them anywhere (granted they have bases in many countries where they can train troops to use the new equipment).

I've added this in.

2 issues, first the AI doesn't know about it. When I set up this tag, it was in traits, so the AI got the ability regardless, it didn't have to decide to pick it (the AI will use the ability, obviously, as it simply makes it so the unit can upgrade outside national borders). With civics though the AI will not consider this ability when choosing the civic, as there is no code for the AI to weight it, nor do I know how to do this. If the AI does pick a civic with this ability, it will upgrade outside national borders with no issues.

Second issue, and this effects other things such as the new softcoding inquisitors, is the CivicScreen by Johnny Smith is too complex for me to be willing to deal with. In order to get new information to display I would have to modify CvGameTextManager.h, create a new void function, expose this to CyGameTextManager, and then add a whole slew of new code to some python files. It's just not worth it. If you want the new tags with information exposed to the player, delete the new civic screen python file, and just use BtS's. I refuse to go through all that extra coding to deal with a new overbuilt civic screen when BtS's civic screen works just fine with no extra work (I just have to add a couple lines to CvGameTextManager.cpp and it exposes). I realize some mods need the new screen because of all the new options, and if that's so, it's on you to code the new stuff so that it displays properly.
 
I've added this in.

2 issues, first the AI doesn't know about it. When I set up this tag, it was in traits, so the AI got the ability regardless, it didn't have to decide to pick it (the AI will use the ability, obviously, as it simply makes it so the unit can upgrade outside national borders). With civics though the AI will not consider this ability when choosing the civic, as there is no code for the AI to weight it, nor do I know how to do this. If the AI does pick a civic with this ability, it will upgrade outside national borders with no issues.

I can write some AI code for you if you want. It wouldn't be incredibly complex or be 100% perfect, but better than nothing.

Second issue, and this effects other things such as the new softcoding inquisitors, is the CivicScreen by Johnny Smith is too complex for me to be willing to deal with. In order to get new information to display I would have to modify CvGameTextManager.h, create a new void function, expose this to CyGameTextManager, and then add a whole slew of new code to some python files. It's just not worth it. If you want the new tags with information exposed to the player, delete the new civic screen python file, and just use BtS's. I refuse to go through all that extra coding to deal with a new overbuilt civic screen when BtS's civic screen works just fine with no extra work (I just have to add a couple lines to CvGameTextManager.cpp and it exposes). I realize some mods need the new screen because of all the new options, and if that's so, it's on you to code the new stuff so that it displays properly.

Please, Please, Please, Please ditch Jonny's screen. StrategyOnly's civic screen is way way way way easier to use. It doesn't require the stupid changes to CvGameTextMgr and all those python calls. RoM and AND already switched. Trust me, it's a good change.
 
I can write some AI code for you if you want. It wouldn't be incredibly complex or be 100% perfect, but better than nothing.
That would be nice. While you're at it if you could check the AI's evaluation of the bMilitaryFoodProduction and improvement yield changes tags in Civic infos, I'd be very greatful. In LoR I've set it so Serfdom enables MilitaryFoodProduction, and gives some commerce for farms, and the AI drastically undervalues the civic. It generally gets 1/2 the AI weight as Slavery, even when at war or having alot of farms. I think it might just not take bMilitaryFoodProduction into account at all, and is valuing the increased yields it'd get from a civic by about 1/2 of what it should.

Please, Please, Please, Please ditch Jonny's screen. StrategyOnly's civic screen is way way way way easier to use. It doesn't require the stupid changes to CvGameTextMgr and all those python calls. RoM and AND already switched. Trust me, it's a good change.
I'm all for this. If RoM has already done it, would you be willing to apply this change to RevDCM, and upload the changed files for me? I'd then merge in the changes. I'm asking because if you've already done the work for RoM, I see no point in trying to reinvent the wheel and refiguring out how you did it.


Anyway for all this give me a few hours or maybe a day. I'm going to start implementing the Python side of the softcoding of inquisitor code, I've just finished with the SDK stuff (added the new tags and all that), and now need these tags to actually do something in the Python code, since Inquisitions lives in Python. I'll let you know when I update the SVN with the new changes so you have something to work with.
 
That would be nice. While you're at it if you could check the AI's evaluation of the bMilitaryFoodProduction and improvement yield changes tags in Civic infos, I'd be very greatful. In LoR I've set it so Serfdom enables MilitaryFoodProduction, and gives some commerce for farms, and the AI drastically undervalues the civic. It generally gets 1/2 the AI weight as Slavery, even when at war or having alot of farms. I think it might just not take bMilitaryFoodProduction into account at all, and is valuing the increased yields it'd get from a civic by about 1/2 of what it should.

Can I see the code? The SVN is 2 weeks old.

I'm all for this. If RoM has already done it, would you be willing to apply this change to RevDCM, and upload the changed files for me? I'd then merge in the changes. I'm asking because if you've already done the work for RoM, I see no point in trying to reinvent the wheel and refiguring out how you did it.

Yeah, I coded Strategy's screen to scale based on resolution too, so it's more useful. I tore out the RoM/AND specific code, it should work right out of the box with Revolutions.

I'd appreciate it, if you decide to stick with it, to remove all the extraneous unneeded functions in CvGameTextMg that Johnny Smith added, so it's less of a pain to merge stuff in the future.

View attachment New Civic Screen.rar
 
OK Afforess the RevDCM SVN is updated. Let me know if you get any working AI code to value the bUpgradeAnywhere tag, and also if you improve the current valuation of existing BtS Civic tags, such as bFoodMilitaryProduction and the ImprovementYieldChanges (I'm sure there are other improperly evaluated default BtS CivicInfos tags, but I know those two don't give enough value because I've used them and the AI barely seems to care, in the instance of bFoodMilitaryProduction I don't think firaxis coded AI for it's evaluation at all).
 
OK Afforess the RevDCM SVN is updated. Let me know if you get any working AI code to value the bUpgradeAnywhere tag, and also if you improve the current valuation of existing BtS Civic tags, such as bFoodMilitaryProduction and the ImprovementYieldChanges (I'm sure there are other improperly evaluated default BtS CivicInfos tags, but I know those two don't give enough value because I've used them and the AI barely seems to care, in the instance of bFoodMilitaryProduction I don't think firaxis coded AI for it's evaluation at all).

I'll grab it right now, and post anything I come up with here tomorrow.
 
Okay, I'm done. The reason for the issue with the isMilitaryFoodProduction is because there was no AI code AI code at all. The problem with the ImprovementYieldChange was because the Firaxis dev's accidentally put a "+" sign instead of a "*" sign, causing it to be woefully undervalued.

I also wrote new code for the Upgrade Anywhere, I think it's okay, but playtesting is needed to prove it.

My comments are clearly marked. Should be an easy merge.
View attachment CvPlayerAI.rar
 
Wow that was fast thanks. You should consider passing along the AI code fixes for the default BtS tags to the UP as well. Regardless they are going into RevDCM now :)
 
Wow that was fast thanks. You should consider passing along the AI code fixes for the default BtS tags to the UP as well. Regardless they are going into RevDCM now :)

Not UP, (Someone will just argue that the bugs were intentional, or some other BS...), but they should probably get pushed into Better AI. As for speed, well... I've messed with the AI a lot now, you just get faster with experience... memorizing function names helps too.;)

Hopefully they turn out to be more good than harm though, as I said, make sure you test a few games and see if the AI make better decisions.
 
OK Afforess the RevDCM SVN is updated. Let me know if you get any working AI code to value the bUpgradeAnywhere tag, and also if you improve the current valuation of existing BtS Civic tags, such as bFoodMilitaryProduction and the ImprovementYieldChanges (I'm sure there are other improperly evaluated default BtS CivicInfos tags, but I know those two don't give enough value because I've used them and the AI barely seems to care, in the instance of bFoodMilitaryProduction I don't think firaxis coded AI for it's evaluation at all).
If I recall correctly the BtS doesn't evaluate civics' building health changes at all. It's been a while since I've looked RevDCM sources so don't know if this has been changed/fixed.
 
If I recall correctly the BtS doesn't evaluate civics' building health changes at all. It's been a while since I've looked RevDCM sources so don't know if this has been changed/fixed.

Zappara's right. Building Health Changes are non-existent in the SDK. Worse, cities don't know that the buildings give extra happiness or health either. So if I am using a civic that gives +1 health with an Aqueduct, the AI don't value the civic more, and cities don't value building aqueducts more with the extra health boost. Pretty terrible.

I added some more Civic Code so that the AI are aware of the building health changes, and some AI code to cities, so that they know that some buildings are actually boosting healthiness or happiness with their current civic.

View attachment CvGameCoreDLL.rar
 
While you're at it, check to see if the AI evaluates when a building causes unhealthiness/happiness with resources. I have a feeling it does not, or at least it doesn't evaluate things correctly. In fact the current AI behavior leads me to believe the AI does not understand negative values, and thinks coal plants actually produce healthiness.
 
While you're at it, check to see if the AI evaluates when a building causes unhealthiness/happiness with resources. I have a feeling it does not, or at least it doesn't evaluate things correctly. In fact the current AI behavior leads me to believe the AI does not understand negative values, and thinks coal plants actually produce healthiness.

Resource Calculations look fine to me. As for power plants, you are right there. The AI sees that Coal Plants cause 2 :yuck:, but didn't know that dirty power causes 2 more :yuck:. I added that in too. Here's the most up to date version.

View attachment CvGameCoreDLL.rar
 
@jdog
Do you want to incorporate in Afforess's submitted code when you update the BBAI component, or should I just go ahead and merge it now?
 
Back
Top Bottom