Python Performance and Interface Overhaul (PPIO)

I think so... Doesn't it work for you?

Just checking. I just installed it. Didn't want to break anything.

EDIT: It seems to break the game, it starts throwing up errors when trying to load C2C. The errors say "GFC error"
 
Last edited:
It seems to break the game, it starts throwing up errors when trying to load C2C. The errors say "GFC error"
Sounds like the error you get when the mod folder is misnamed, it must be named "Caveman2Cosmos", misnaming the C2C mod causes some bad issues even without my modmod, but my modmod takes it further, hence you won't be able to start the game without the folder being named properly.

N.B. This was my answer to a PM I got about the issue from Chaotic Paladin.
Mod folder name was indeed the cause of this error.
 
Last edited:
Thanks. It's working now.

Is it known that the UI means that several tech icons disappear from the score chart if you are supposed to know what the AI is researching? I see the turn timers but the tech button is blank. This only effects some. Some work fine.
 
Is it known that the UI means that several tech icons disappear from the score chart if you are supposed to know what the AI is researching? I see the turn timers but the tech button is blank. This only effects some. Some work fine.
I didn't know about that, I'll look into it.

Can you list some of the earliest techs that you have seen this happening with?
Or post a save where there is a case in the score-board.

Easier for me if I can check if what I do actually fix the issue.
 
Damn... I tried some stuff in python. @Toffer90 : check out the python changes in my last commit. Should be easy to see what I was doing there and why. If you have to adapt something on your end over this I'm sorry though I will probably soon need a little assistance to finalize the desired effect taking place in a few other locations.
 
It seems like latest commit breaks your mod
Nope the modmod is still compatible with the latest svn.
I deduce that you play directly from your SVN folder and when you updated the SVN, the MainInterface.py got changed, all the changes done to that file by this modmod might even have been reverted back to core C2C version (or the two files might have been merged and since they are completly different from alpha to omega it would just result in a mish mash of non-coherent code).

So in a way one could say that you installed the modmod incorrectly, that you did not copy all the files from this modmod to your C2C mod folder.
Even though you installed it correctly before the SVN started meddling with the content of MainInterface.py.

My best advice is to install the modmod every time you update your SVN unless you know the SVN did not change any of the files this modmod modify.

Damn... I tried some stuff in python. @Toffer90 : check out the python changes in my last commit. Should be easy to see what I was doing there and why. If you have to adapt something on your end over this I'm sorry though I will probably soon need a little assistance to finalize the desired effect taking place in a few other locations.
Nothing to adapt, my modmod doesn't cache all the tech buttons as UI image element like it is done in the code that you tweaked.
My modmod generates those UI elements on demand as we are talking about the tech buttons that appear at the tech bar when you have not selected a research; and there isn't enough of them showed at any one time to justify the caching of around 1000 small pictures to lay ready and hidden in the background at any given time..

The entire "if" "else" statement that you tweaked has been completely removed in this modmod.
 
Last edited:
The entire "if" "else" statement that you tweaked has been completely removed in this modmod.
Ok, well you see what it is intended to switch right? Can you make sure your modmod adapts a similar approach to the display of religious icons in these cases?
 
Ok, well you see what it is intended to switch right? Can you make sure your modmod adapts a similar approach to the display of religious icons in these cases?
Yeah, I think so, though I don't understand what the change would accomplish, does it have something to do with the praying hands on religions that are not founded, am I right in assuming that the praying hands does not show when using the "pick religion" game option? The praying hands show up correctly without the pick religion game-option with my modmod.
Here's the code that decides the tech buttons displayed in the "tech bar - tech selection" area used in my modmod:
Code:
# loops through all techs in the game, and does this for those that can be researched by the player:
artPath = ""
if CyPlayer.canFoundReligion() and GAME.isTechCanFoundReligion(i):
    for j in range(iReligionInfos):
        if not GAME.isReligionSlotTaken(j):
            CvReligionInfo = GC.getReligionInfo(j)
            if CvReligionInfo.getTechPrereq() == i:
                if self.GO_PICK_RELIGION:
                    artPath = CvReligionInfo.getGenericTechButton()
                else:
                    artPath = CvReligionInfo.getTechButton()
                break
if not artPath:
    artPath = GC.getTechInfo(i).getButton()
I understand that "CvReligionInfo.getTechButton()" have the praying hands and that GC.getTechInfo(i).getButton() does not have the praying hands.
But I have no idea what button "CvReligionInfo.getGenericTechButton()" represents... and as it is here, it is only used when playing with the GO "pick religions", a GO that I never play with.

Edit:
Ah, I think I get what you were trying to do.
When playing on "Pick Religion" GO an AI might be the first to invent druidism but will chose shamanism as its religion.
For the human player the druidism tech should now no longer have the praying hands but the shamanism tech should have the praying hands despite shamanism already being founded.
Right?
 
Last edited:
Ah, I think I get what you were trying to do.
When playing on "Pick Religion" GO an AI might be the first to invent druidism but will chose shamanism as its religion.
For the human player the druidism tech should now no longer have the praying hands but the shamanism should have the praying hands despite shamanism already being founded.
Right?
Yeah, pick religion or not, with all options the game should change out the praying hands icon when the tech is researched, nothing to do with whether the religion is founded yet.
 
Does CvReligionInfo.getGenericTechButton() provide the same button as GC.getTechInfo(iReligionTech).getButton() ?
Doesn't matter if it does or not, the intention of the difference is to allow for a later adjustment to the post researched button which should point to getGenericTechButton(). We're updating the xml and art references for that on our end.

Generally speaking it IS the same art button reference being used in that slot at the moment and in the immediate future, yes.
 
Yeah, I think so, though I don't understand what the change would accomplish, does it have something to do with the praying hands on religions that are not founded, am I right in assuming that the praying hands does not show when using the "pick religion" game option?
You didn't answer this but I guess the intention in your change was to get the praying hands to show up when playing with the "Choose Religion" GO.

Ok, so to replicate what you did I simply have to remove the "if" "else" nested furthest down in the loop.
Code:
# loops through all techs in the game, and does this for those that can be researched by the player:
artPath = ""
if CyPlayer.canFoundReligion() and GAME.isTechCanFoundReligion(i):
    for j in range(iReligionInfos):
        if not GAME.isReligionSlotTaken(j):
            CvReligionInfo = GC.getReligionInfo(j)
            if CvReligionInfo.getTechPrereq() == i:
                artPath = CvReligionInfo.getTechButton()
                break
if not artPath:
    artPath = GC.getTechInfo(i).getButton()
Tested this change in a game with "Choose Religion" GO and it works as expected both with and without limited religion.
Why was it originally decided that the "Choose Religion" GO should disable the praying hands symbol for all religion techs, do you know?
 
Last edited:
You didn't answer this but I guess the intention in your change was to get the praying hands to show up when playing with the "Choose Religion" GO.
Yeah, pick religion or not, with all options the game should change out the praying hands icon when the tech is researched, nothing to do with whether the religion is founded yet.
That was the answer. Choose Religions (game option pick religion) should now be irrelevant to this switch. Under all options, the game should change out the praying hands icon (CvReligionInfo.getTechButton()) with the generic tech icon (CvReligionInfo.getGenericTechButton()) once the tech has been researched by any team in the game.

Do NOT base this switch on 'GAME.isReligionSlotTaken(j)' but rather on 'GAME.countKnownTechNumTeams(i) > 0'.

isReligionSlotTaken is completely useless in Divine Prophets at determining whether the religion is worth researching or not.
 
Do NOT base this switch on 'GAME.isReligionSlotTaken(j)' but rather on 'GAME.countKnownTechNumTeams(i) > 0'.
This is the equivalent piece of code from core C2C (latest rev):
Code:
szName = "ResearchButton" + str(i)

if(pPlayer.canFoundReligion() and gc.getGame().isTechCanFoundReligion(i)):
  for j in range( gc.getNumReligionInfos() ):
    if (gc.getReligionInfo(j).getTechPrereq() == i):
      if( not gc.getGame().isReligionSlotTaken(j) ):
        szName = "ReligionButton" + str(j)
        break
As you can see the GAME.isReligionSlotTaken(j) is what is used in C2C, not something I added to that code.
I just found out the last hour that I could remove the "if not GAME.isReligionSlotTaken(j):" line from the code from my modmod without it influencing the praying hands under any game options though, so you are probably right that it is useless to have there.

So now my code is this:
Code:
artPath = ""
if CyPlayer.canFoundReligion() and GAME.isTechCanFoundReligion(i):
    for j in range(iReligionInfos):
        CvReligionInfo = GC.getReligionInfo(j)
        if CvReligionInfo.getTechPrereq() == i:
            artPath = CvReligionInfo.getTechButton()
            break
if not artPath:
    artPath = GC.getTechInfo(i).getButton()
If your goal was to have praying hands show where appropriate while using the "Choose Religion" GO, then I have now incorporated that intent in this modmod for the next version release.
 
Last edited:
As you can see the GAME.isReligionSlotTaken(j) is what you use in C2C, not something I added to that code.
I just found out the last hour that I could remove the "if not GAME.isReligionSlotTaken(j):" line from the code from my modmod without it influencing the praying hands under any game options though, so you are probably right that it is useless to have there.
I thought I changed this last night. Can we change the call to isReligionSlotTaken to GAME.countKnownTechNumTeams(i) > 0?

If your goal was to have praying hands show where appropriate while using the "Choose Religion" GO
My goal is:
Under all game option combinations, the game should change out the praying hands icon (CvReligionInfo.getTechButton()) with the generic tech icon (CvReligionInfo.getGenericTechButton()) once the tech has been researched by any team in the game.
GC.getTechInfo(i).getButton() should never be called for any use or purpose once the tech tree is also updated to this method. Essentially it would be the same as (CvReligionInfo.getGenericTechButton()) so if you want to use it as a fall back for the current XML not having filled out the GenericTechButton tags, by all means use it as a default if the previous comes up with basically nothing.

Why is GenericTechButton important? Because we may want to try putting the grey scale button in that slot to make it REALLY obvious the tech has been taken.
 
There was conflict when I updated to latest SVN.

Either I could use Thunderbords modified file or use your file.
When I extracted your mod, then his change here is not here :p
Looks like this change didn't do anything in tech tree (thunder forgot to post chagelog for SVN 9844 :p)
Using Thunderbords modified MainInterface.py along with the rest of this modmods files would be like having honey on the pizza instead of cheese. It's not compatible. Try using a compare program like winmerge on the modmods version of MainInterface and compare it to the core SVN version of that file. TB changed one line in that file, while my modmod changed thousands of lines.
 
I thought I changed this last night.
You changed what button is cached as a UI element under the name "ReligionButton" + str(j)

The code I showed above is the code that determines if it should use the cached
"ReligionButton" + str(j)
or the cached
"ResearchButton" + str(i)
UI element for a religion tech.

Can we change the call to isReligionSlotTaken to GAME.countKnownTechNumTeams(i) > 0?
Wouldn't that always produce the same result as:
gc.getGame().isTechCanFoundReligion(i)
which is in the top level "if"?
 
Wouldn't that always produce the same result as:
gc.getGame().isTechCanFoundReligion(i)
which is in the top level "if"?
No. In Divine Prophets and Limited Religions this can differ from whether the tech has been researched. The only call that works in ALL situations correctly is if the tech has been researched by any team.

You changed what button is cached as a UI element under the name "ReligionButton" + str(j)

The code I showed above is the code that determines if it should use the cached
"ReligionButton" + str(j)
or the cached
"ResearchButton" + str(i)
UI element for a religion tech.

And that button is referred to later in the code so plugs in wherever it should, but I may have defined them incorrectly. Worth taking another look. I might've done it a little hasty and incorrect as to which button is supposed to replace the ReligionButton.
 
Back
Top Bottom