Python Performance and Interface Overhaul (PPIO)

PPIO v0.5.9.6.8.1.4
SVN rev.10249
  • More technical, under the hood, code clean up.
    • No in-game changes that are noticeable.
Yes I know, boring updates, though it is good for performance and makes it easier for me to mod further on a later stage.
 
PPIO v0.5.9.6.8.1.4

Sure is a convoluted build number.:scan::lol:
 
I'm at the moment trying to find that upkeep issue for animals and Neanderthals. Once that's done I'll try to do this. :)
 
I'm at the moment trying to find that upkeep issue for animals and Neanderthals. Once that's done I'll try to do this. :)
I had another look at the finance screen in debug mode, turns out regular barbarians do pay unit upkeep, earlier I managed to confuse the insectoids with the barbarian team, because they have the same leaderhead and civ button.
Insectoids don't have units at all, so no wonder there was no unit upkeep for them.
I'm not so sure anymore that there's actually a problem there to fix...

It may be that the unit upkeep is calculated for the NPC's only because the finance screen python code is asking the dll how much unit upkeep they pay. Ideally it should answer 0 for the NPC's.
Python is in this case calling the calculateUnitCost and calculateUnitSupply functions that are within CvPlayer.cpp.
Edit: Perhaps the dll actually never runs those functions internally for the NPC teams. I may have sent you out on a goose chase.
Edit: the dll does perform the calculations for NPC teams a couople of times each turn.

Anyhow, any excuse to get you looking at the dll code is good as you do get better at reading it and understanding it the more you look. ^^
Spoiler Here's a place that could be improved a bit :
int CvPlayer::calculateUnitCost() const
{
if (isAnarchy())

{
return 0;
}

int iFreeUnits;
int iFreeMilitaryUnits;
int iPaidUnits;
int iPaidMilitaryUnits;
int iMilitaryCost;
int iBaseUnitCost;
int iExtraCost;
return calculateUnitCost(iFreeUnits, iFreeMilitaryUnits, iPaidUnits, iPaidMilitaryUnits, iBaseUnitCost, iMilitaryCost, iExtraCost);​
}
▬▬▬▬▬▬ NEW ▬▬▬▬▬▬
if (isAnarchy() || isNPC())

{
return 0;
}
 
Last edited:
The upkeep could still be Hampering those NPC factions.
Maybe, if you want to look over all the places where the result from calculateUnitCost and calculateUnitSupply is used then that would be great of course.
I looked a bit around myself, and saw in the cases I looked at that there are proper usage of the "isNPC() → simplify" for many AI economically related functions.

The change I showed in last post would make sure that the code always consider the NPC's as teams with absolutely no expenses at all internally. It will additionally reduce the amount of code processed for NPC teams each end turn.
There should be a function for calculateUnitSupply that may need a similar change.
Spoiler Yeah, here it is :
int CvPlayer::calculateUnitSupply() const
{
int iPaidUnits;
int iBaseSupplyCost;

if (isAnarchy())
{
return 0;
}

//ls612: Gold Modifiers by Gamespeed
int iCost = calculateUnitSupply(iPaidUnits, iBaseSupplyCost) * (GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getGoldModifier());
if (iCost != 0)
{
iCost /= 100;
}

return iCost;
}
▬▬▬▬▬▬ NEW ▬▬▬▬▬▬
int CvPlayer::calculateUnitSupply() const
{
if (isAnarchy() || isNPC())
{
return 0;
}
int iPaidUnits;
int iBaseSupplyCost;

int iCost = calculateUnitSupply(iPaidUnits, iBaseSupplyCost)

//ls612: Gold Modifiers by Gamespeed
if iCost
{
iCost *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getGoldModifier() / 100;
}
return iCost
}

PPIO v0.5.9.6.8.3
SVN rev.10252
  • Some initial work on the military advisor screen.
 
Last edited:
Maybe, if you want to look over all the places where the result from calculateUnitCost and calculateUnitSupply is used then that would be great of course.
I looked a bit around myself, and saw in the cases I looked at that there are proper usage of the "isNPC() → simplify" for many AI economically related functions.

The change I showed in last post would make sure that the code always consider the NPC's as teams with absolutely no expenses at all internally. It will additionally reduce the amount of code processed for NPC teams each end turn.
There should be a function for calculateUnitSupply that may need a similar change.

Yeah, here it is:
int CvPlayer::calculateUnitSupply() const
{

int iPaidUnits;
int iBaseSupplyCost;

if (isAnarchy())
{

return 0;
}

//ls612: Gold Modifiers by Gamespeed
int iCost = calculateUnitSupply(iPaidUnits, iBaseSupplyCost) * (GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getGoldModifier());
if (iCost != 0)
{

iCost /= 100;
}

return iCost;
}
▬▬▬▬▬▬ NEW ▬▬▬▬▬▬
int CvPlayer::calculateUnitSupply() const
{

if (isAnarchy() || isNPC())
{

return 0;
}
int iPaidUnits;
int iBaseSupplyCost;

int iCost = calculateUnitSupply(iPaidUnits, iBaseSupplyCost)

//ls612: Gold Modifiers by Gamespeed
if iCost
{

iCost *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getGoldModifier() / 100;
}
return iCost
}
I agree with this change and am including it in my next commit.
 
I agree with this change and am including it in my next commit.
You forgot to do the same for calculateUnitCost as you did for calculateUnitSupply in your last SVN update.
Perhaps you didn't realize that those two posts were about two different functions. ^^

P.S. It's great to have you back btw, I've missed your contributions lately. :hug:
 
Last edited:
You forgot to do the same for calculateUnitCost as you did for calculateUnitSupply in your last SVN update.
Perhaps you didn't realize that those two posts were about two different functions. ^^

P.S. It's great to have you back btw, I've missed your contributions lately. :hug:
Ok, that will be corrected on the next commit.

I'm still not going to be on full on mode here but I'm coming out of hiding a little. I took a sick day today and figured it'd be a good day to get caught up on some current issues.
 
It appears going to city doesn't work fully with custom domestic advisor.

I get sent to capital if I press on first city as if internally sorting did nothing.

Spoiler :

Civ4BeyondSword 2018-11-16 19-49-12-39.jpg
Civ4BeyondSword 2018-11-16 19-49-18-09.jpg

 
Filtering out of unconstructable buildings / units don't save between sessions. I deleted user settings but still no. Maybe it's main mod bug, not this modmod, not sure (SVN 10259, last PPIO).
 
Filtering out of unconstructable buildings / units don't save between sessions. I deleted user settings but still no. Maybe it's main mod bug, not this modmod, not sure (SVN 10259, last PPIO).
Look at BUG settings.
There is "Hide Unconstructable Buildings" option or something.
You need to restart game to make toggling this option work.

Constructable and unconstructable items are separated from each other.
 
Last edited:
Look at BUG settings.
There is "Hide Unconstructable Buildings" option or something.
You need to restart game to make toggling this option work.

Constructable and unconstructable items are separated from each other.

Restarted but not working :(
 
Filtering out of unconstructable buildings / units don't save between sessions. I deleted user settings but still no. Maybe it's main mod bug, not this modmod, not sure (SVN 10259, last PPIO).
I can confirm I've had this supremely annoying problem ever since... I think it was somewhere around v36 or 37 when we first went to not wanting to include the user settings or something and ever since then it doesn't save the filter toggle between games. I didn't bother mentioning it because I thought at the time that it would be such a nuisance to all that it would be quickly fixed by whomever was responsible but I should've known better... lol. I have no idea how those settings were saved in the first place though.

I'm talking main mod here - I don't know if this is an issue with Toffer's or not.
 
Back
Top Bottom