Speed of processing the python in FFH

mtagge

Clueless Tweaker
Joined
Dec 29, 2007
Messages
111
Location
Frankfurt
I am definately not a python guru, but I just wanted to float an idea out there for some speed enhancements to FFH II. I noticed that all throughout the python code in FFH (I still don't have the latest version, darn third world countries, so let me know if it is changed) that gc.getInfoTypeForString() is used almost frequently, and that code is executed quite frequently.

Correct me if I am wrong, but the way I understand it, CIV IV assigns each attribute an integer ID that is unique for each game (which is why you can't add a unit/promotion/event/etc to the XML then load a saved game) at the onset of each game. Doesn't the python code have to interact with the DLL each time the gc.getInfoTypeForString() is run?

I was able to make significant improvements in the speed of my code by not running the gc.getInfoTypeForString() in the middle of the turn, but by making all my variables global (although within the class where that variable is used) and calling the def in each class containing all the gc.getInfoTypeForString() on game start and game load. That way some of the heavy lifting is done once at the start of the session (when I am more patient) rather than constant calls to the gc each time a unit moves, turn starts, or spell is used.

I don't know about code editing tools, but there might be something out there that can pull all the gc.getInfoTypeForString() calls out and replace them with the global friendly code. Or someone could whip up a custom script that can pull it out, my VBScript is a little rusty, but I might be able to come up with something in a week or two if Kael is willing to give it a try.
 
Top Bottom