Python Performance and Interface Overhaul (PPIO)

Found another issue with the bug mod, the bug mod had an override return value for the canBuild function call from dll to python.

Please test this version of PPIO where I removed this override.
Now it works - build actions are now visible and they work too.
I wonder if its exactly same issue as in core.

Placeable resources depend on terrain/feature combo, I'm not sure if latitude counts here too.
Resources are placed instantly by great farmers.

There are no red crosses in civic screen by the way.
 
Last edited:
PPIO v0.6.2
SVN rev.10613
  • Fixed Great Farmer.
Placeable resources depend on terrain/feature combo, I'm not sure if latitude counts here too.
Latitude and all other requirements (terrain, flatland/hill, river, etc) defined for a bonus must be satisfied for the great farmer to place the bonus in the plot with PPIO.
Without PPIO: the only requirement is that there is not another bonus in the plot already, otherwise the great farmer can place all bonuses in that plot.
You got to have access to the bonus already, both with and without PPIO, to do this though.
 
Last edited:
Latitude and all other requirements (terrain, flatland/hill, river, etc) defined for a bonus must be satisfied for the great farmer to place the bonus in the plot with PPIO.
Without PPIO: the only requirement is that there is not another bonus in the plot already otherwise the great farmer can place all bonuses in that plot.
You got to have access to the bonus already, both with and without PPIO, to do this though.
Probably because you are on a fast gamespeed where the number of turns are rounded down to 0.
Ah so that's why any bonus could be placed on any tile without resource on it when I was testing stuff without PPIO.
I was testing on Ultrafast and yeah probably that's why farmer instantly placed resource, but displayed turn timer was 2 or 3 turns as if something doesn't agree.


By the way one line is needlessly reverted in global text (7670):
[ICON_BULLET][COLOR_YELLOW]HELP: [COLOR_REVERT]Can remove non-state religions and associated buildings

I intentionally added HELP: in yellow color so those could be distinguished easily from regular tags.
 
Last edited:
By the way one line is needlessly reverted in global text (7670):
[ICON_BULLET][COLOR_YELLOW]HELP: [COLOR_REVERT]Can remove non-state religions and associated buildings

I intentionally added HELP: in yellow color so those could be distinguished easily from regular tags.
And I stated clearly that I didn't like it, hence why I never included that SVN change in PPIO.
I'm adding red HELP: on beginning of Help entry.
That is beginning of help entry will be: [ICON_BULLET][COLOR_RED]HELP: [COLOR_REVERT]
I don't like it. Just voicing my opinion.
So how you would format beginning of help entry?
I found it fine the way it was.
If someone forced me to pick a change, then I would choose to colorize the entire help text line in perhaps cyan or yellow.
 
Last edited:
@Toffer90

PPIO freaks out if you pause game with pause key.

That is while on pause clicking on city bar causes python errors.
 
Last edited:
I'm not getting any errors when on pause, could you post the save where this is happening?

For those who is wondering why the game has a pause button, just consider the implications of the simultaneous multiplayer game mode.
It is nice for one player to be able to pause the other player when leaving the computer as both play at the same time/turn, the other player can't un-pause.
It happened in that save - there was error when I clicked on cities while game was paused.
 
@Toffer90 I got this error when I clicked on Junta here.
Spoiler :

Civ4BeyondSword 2019-07-02 16-46-05-61.png


This civic is separate here, as certain civics in same category are placed in different techs but in same column (or close enough for beelining to do this).

By the way resource pages don't count buildings, that have Raw Vicinity tag.
 
Last edited:
@Toffer90 there is graphical bug with Djene mosque in Python
I'm not sure where it would be without PPIO, but with PPIO its in CvEventManager.Py

CyInterface().addMessage(iPlayer,False,15,TRNSLTR.getText("TXT_KEY_DJENNE_PYTHON",()),'',0,'Art/Interface/Buttons/Buildings/Djenne.dds',ColorTypes(44), X, Y, True,True)

must be converted to:

CyInterface().addMessage(iPlayer,False,15,TRNSLTR.getText("TXT_KEY_DJENNE_PYTHON",()),'',0,'Art/Interface/Buttons/Great_Wonders/great_mosque_of_djenne.dds',ColorTypes(44), X, Y, True,True)
 
PPIO v0.6.1.4
SVN rev.10541
  • Worked on the civic screen today, managed to get a fast version working already, It's a work in progress.
    • The current version is quite simplistic.
    • I have some ideas for alternate versions of the civic tab.
    • I'll try to set up a tab, that resembles the old one, further down the road.
    • The policy tab is just broken now, as the code just leads into the ruins of the old civic screen code that I've partly demolished.
  • Partly fixed error reported by Fermongu above, it would only happen to those who use the chipotle cheat code.
    • Clicking shift+t will still cause the same error, but hitting ctrl+shift+t no longer throws the error.
    • I'll fix the true error later, shift+t is somehow related to getting/giving free techs to players with the chipotle setup.
There is something wrong with the version number.
 
There is something wrong with the version number.
So there was. ^^

v0.6.1.2 was supposed to be v0.6.2 as it was the version after v0.6.1.13, I guess things went a bit too fast that day.

PPIO v0.6.4.1
SVN rev.10654
  • Fixed NPC teams appearing in top civ ranking pop ups.
  • Made the intervals between each time the top civ ranking pops up a bit random, between 40-60 turns.
    • After loading a game it will always pop up at the first turn number that is a multiplication of 50 (turn: 50, 100, 150, 200, ..., n*50).
    • After that the randomness takes over.
  • Optimized some code here and there.
PPIO v0.6.4.2
SVN rev.10654
  • Removed the usage of player.getEffectiveGold() function calls, and replaced it with 1 000 000 * player.getGreaterGold() + player.getGold().
    • This should fix some strangeness, as getEffectiveGold could not return values greater than 1 000 000.
PPIO v0.6.4.3
SVN rev.10654
  • Managed to somehow mix "MToS-PPIO patch" python into PPIO by mistake sometime after v0.6.4. ▬ Fixed.
    • Caused issues with getting the tribal guardian unit when settling first city among other small issues.
    • This is what I get for modding two modmods, a patch between the two, as well as the svn at the same time.
    • Gotta keep it more separated from now on so it doesn't start spinning. ^^
PPIO v0.6.4.4
SVN rev.10654-10663
  • Brightened the color of very dark civs in the scoreboard to increase readability for some nations who have very dark colors.
    • The color in the scoreboard may not match exactly the color of cultural borders, but I tried to change hue as little as possible by adding the same amount of color to the red, blue and green as much as that was possible.
Spoiler Quite the funky code for this :
Code:
iPlayerRed        = CyPlayer.getPlayerTextColorR()
iPlayerGreen    = CyPlayer.getPlayerTextColorG()
iPlayerBlue        = CyPlayer.getPlayerTextColorB()
iSum = iPlayerRed + iPlayerGreen + iPlayerBlue
if iSum < 360:
    iAddRed = iAddGreen = iAddBlue = iAdd = (360 - iSum)/3

    while True:

        if iPlayerRed + iAddRed > 255:
            iAdd = (iAddRed - (255 - iPlayerRed))/2
            if not iAdd:
                iAdd = 1
            if not iAddGreen or not iAddBlue:
                iAdd *= 2
                if iAddGreen:
                    iAddGreen += iAdd
                elif iAddBlue:
                    iAddBlue += iAdd
            else:
                iAddGreen += iAdd
                iAddBlue += iAdd
            iAddRed = 0
            iPlayerRed = 255

        elif iPlayerGreen + iAddGreen > 255:
            iAdd = (iAddGreen - (255 - iPlayerGreen))/2
            if not iAdd:
                iAdd = 1
            if not iAddRed or not iAddBlue:
                iAdd *= 2
                if iAddRed:
                    iAddRed += iAdd
                elif iAddBlue:
                    iAddBlue += iAdd
            else:
                iAddRed += iAdd
                iAddBlue += iAdd
            iAddGreen = 0
            iPlayerGreen = 255

        elif iPlayerBlue + iAddBlue > 255:
            iAdd = (iAddBlue - (255 - iPlayerBlue))/2
            if not iAdd:
                iAdd = 1
            if not iAddRed or not iAddGreen:
                iAdd *= 2
                if iAddRed:
                    iAddRed += iAdd
                elif iAddGreen:
                    iAddGreen += iAdd
            else:
                iAddRed += iAdd
                iAddGreen += iAdd
            iAddBlue = 0
            iPlayerBlue = 255
        else:
            break

    iPlayerRed += iAddRed
    iPlayerGreen += iAddGreen
    iPlayerBlue += iAddBlue
 
Last edited:
Index page now loads almost instantly - that one with 13000 entries, its accessed on bottom left of pedia.
Now I wonder if you or @alberts2 speeded it up somewhere in code :D
 
I haven't done anything on that front since I initially reworked the index page early in this modmod's life.
Back then it took between 1-3 seconds to open for me, it still does for me (tested it now.).
Perhaps what you finally noticed is that after opening the index the first time, stuff will be cached in such a way that when opening it again it will be instant.
That cache is emptied when exiting the pedia, so the next time you open the pedia the index will take 1-3 sec. to open, but after the first time, it will be instant to jump forth and back between the index and regular pedia entries.
That index caching has been there pretty much all along. I allowed this heavy caching here as there is no way you can build up very much RAM usage in the pedia anyhow, and since it will be released when exiting the pedia.
Weird, I remember, that it took more time to open it for me before, like 5 - 10 seconds.
 
Never experienced such a wait on the PPIO index. Have you changed CPU, or perhaps you remember wrongly?
Could be a CPU difference, but after the initial caching is done, even a slow CPU should open it almost instantly.
I guess I remembered wrongly when I opened it last time :lol:
 
Back
Top Bottom