Python Performance and Interface Overhaul (PPIO)

This modmod really does a good job of improving performance. I have noticed a considerable difference, thank you for such a great modmod.
 
it indeed helps performance, I especially notice it after alt tabbing out of the game,
 
Whenever I add the new tooltip to something, I reduce performance as I move code from the dll to python so that e.g. a buttons functionality is handled fully in python.. Python code is slower than the dll's C++ code.
So I feel it's important to optimize wherever it's possible, to retain some balance in the overall performance budget of C2C.
 
Python code is slower than the dll's C++ code..
This is a lie. Or at worst a mistake. Python code may be slower than C++ but C++ may also be slower than Python.

There is an overhead in switching between the two. All this overhead is attributed to Python when most of it is caused by poorly written C++ code.

As has been shown by Koshling this overhead can be increased greatly by bad coding in the dll. Increase the efficiency in the dll can reduce this overhead greatly.
 
so I guess from what I can make up from what's said here, what Toffer is doing is moving things from badly written dll to optimized Python :) because I can at points notice the difference in speed, (outside of the obvious Pedia change, which simply is stellar in comparison to the old),
regardless, you're doing amazing work Toffer,

*edit* Found an interesting bug, when you manually change the working tile in a city the city UI will stop updating, so you can't switch between resources and Properties, the Buiding/Wonder/concepts tab same deal, the Specialists just up and disappear entirely, Food and Hammers don't change their value, and switching from one city to the next without closing the city screen would copy the hammer value of the other city,
you can still add things in the build queue fine,
 
Last edited:
so I guess from what I can make up from what's said here, what Toffer is doing is moving things from badly written dll to optimized Python :)
Most of my optimizations have been on the code that has always been in python, the stuff I fetch from the dll was pretty optimized the way I found it
*edit* Found an interesting bug, when you manually change the working tile in a city the city UI will stop updating, so you can't switch between resources and Properties, the Buiding/Wonder/concepts tab same deal, the Specialists just up and disappear entirely, Food and Hammers don't change their value, and switching from one city to the next without closing the city screen would copy the hammer value of the other city,
you can still add things in the build queue fine,
Thanks for reporting this, it went right under my nose.
This is a lie. Or at worst a mistake. Python code may be slower than C++ but C++ may also be slower than Python.
Maybe I'm wrong, but I thought compiled code utilized the hardware circuitry better generally.
 
Last edited:
Maybe I'm wrong, but I thought compiled code utilized the hardware circuitry better generally.

You are correct. Un-compiled code has to do what the compiler would do first, so is slower.

I think what DH was referring to, was the skills of the individual programmers. C++ should be faster if programmed correctly. If not Python may be faster.
 
Maybe I'm wrong, but I thought compiled code utilized the hardware circuitry better generally.
Generally, perhaps, but not always. I have demonstrated this a number of times in my (former) working life (I am now retired) in real world examples with large to very large sets of data. It all depends on what the task is and the skill and knowledge of the person doing the coding.
 
v0.5.7.6 - Minor update
  • Unit HP bar tooltip.
  • Performance tweaks.
View attachment 480259

Hi Toffer90

Not sure what i'm doing wrong but i have no city UI or tabs when i double click on a city, only the list of possible buildings and units to build in this version and the previous to be precise. I have removed the Bug Main Interface.ini but to no avail. Any ideas ? (Am on SVN 9741).

Cheers
ColonelFlag
 
Hi Toffer90

Not sure what i'm doing wrong but i have no city UI or tabs when i double click on a city, only the list of possible buildings and units to build in this version and the previous to be precise. I have removed the Bug Main Interface.ini but to no avail. Any ideas ? (Am on SVN 9741).

Cheers
ColonelFlag
I'm not sure what might be wrong atm. I'll get back to you on the city glitches when I've had time to investigate.

In the meantime, could you take a look in the pythonErr.log file, I would like a copy of it if it's not empty, to speed up the debugging process.
The log file is completely emptied every time you start C2C so you will have to check it right after the error might have occurred in-game before you eventually start the game again.

Spoiler Anyone who might want to help me debug this modmod :
To get pop-ups about python errors in-game you can in your %USER%\Documents\My Games\Beyond the Sword\CivilizationIV.ini
change this setting from 1 to 0 .
HidePythonExceptions = 0
The pop ups will tell you whenever something is written into the PythonErr.log

Also in BUG options under the system tab you can find an option for the level of python logging to the pythonDbg.log file.
Make sure it is set to "Debug".
The pythonDbg.log file can help me understand what happened in code before and right after the error.
But it is important that you alt+tab out of the game whenever you get a python error message and secure the pythonDbg.log (make a copy of it) file before doing anything else in your game, that way the last lines in the pythonDbg.log file is what happened in code right before the error message popped up.

The screen logging level is not important, I have it set at "Info". It shows python debugging info in the message window right below your research bar.

v0.5.7.6.1 - hotfix
*edit* Found an interesting bug, when you manually change the working tile in a city the city UI will stop updating, so you can't switch between resources and Properties, the Buiding/Wonder/concepts tab same deal, the Specialists just up and disappear entirely, Food and Hammers don't change their value, and switching from one city to the next without closing the city screen would copy the hammer value of the other city,
you can still add things in the build queue fine,
  • Fixed
 
I hope that soon this will be included in the Main files. ;) Would save me some time with each update of the SVN. :p

Good stuff here Toffer! And Thank you for doing this. :D
 
v0.5.8
  • I managed to get plot help to be displayed in my enhanced tooltip without apparent glitches.
    • Thanks to TB's help on some dll changes that was necessary for this to work..
SVN rev 9741 is required from this point onwards.
I hope that soon this will be included in the Main files. ;) Would save me some time with each update of the SVN. :p
I'll need to hear the opinions of DH and SO before I merge this with core C2C.
 
Last edited:
Perhaps I should set up a new BUG option that makes it so that you have to hold down the "Ctrl" button for plot help to show...

I'll only set it up if someone express that they would like this, so, anyone?
 
Perhaps I should set up a new BUG option that makes it so that you have to hold down the "Ctrl" button for plot help to show...

I'll only set it up if someone express that they would like this, so, anyone?
Might be nice to have a few kinds of settings on that. Keep in mind that plot help interacts heavily with the chipotle cheatcode and hotkeys already so you might inadvertently cut off visibility of something if this sort of thing is pursued without care.
 
I'll need to hear the opinions of DH and SO before I merge this with core C2C.
I am still having trouble with Windows 10 eating itself. Yesterday the XMLValidate program I have been using to check C2C's, and other mod's, XML has stopped working and I keep getting a message about one of the Win10 dlls not being for Win10.:crazyeye: Apparently I need to wipe the disk and reinstall Win 10 to fix things. This means making sure my backups are correct first.
 
Having said that, if you split it into two projects one for the pedia and another for the main interface I think we could progress faster. If I remember correctly there was only one concern I still had with the pedia which I would like to see resolved before it gets merged. The work on the main UI though has a lot more issues, beyond my not being able to get it to work at all at v0.5.7.?.
 
0.5.8 works like a charm for me
 
Combat odds almost never show up when i drag my units over enemies :(

SVN: 9741
Tofferpedia: 0.5.8
 
Back
Top Bottom