View Full Version : Python, psyco & FFH


Hydrahypnotizer
Feb 03, 2008, 12:51 PM
As we all know, python is a good language for modding; It's got a nice syntax and does not need to be compiled. The only problem - it's slow.

Psyco (http://psyco.sourceforge.net/) is a python compiler that compiles the code before executing, resulting in a 2 to 100 times faster code.

I installed it, put the psyco folder in the FFH /assets/python, and edited some .py files to include psyco. Sure enough, it worked, but the interface was gone! :crazyeye:
After a few edits, i found out that putting psyco in one .py file bugged the promotion system, another the interface etc. Some files seemed to work.
On the positive side, the game was noticeably faster! Especially the between-turns wait. :)
(Okay, it could have been placebo, as i didn't do any statistics... ;) )

The questions i have are:

The python version shipped with Civ is 2.4; can i replace this with 2.5? The 2.5 version of psyco fixes a few bugs.

This (http://psyco.sourceforge.net/psycoguide/bugs.html) page has the know psyco bugs. Does anybody familiar with the FFH python code know if these bugs apply to FFH/Civ?

Kael
Feb 05, 2008, 07:55 AM
As we all know, python is a good language for modding; It's got a nice syntax and does not need to be compiled. The only problem - it's slow.

Psyco (http://psyco.sourceforge.net/) is a python compiler that compiles the code before executing, resulting in a 2 to 100 times faster code.

I installed it, put the psyco folder in the FFH /assets/python, and edited some .py files to include psyco. Sure enough, it worked, but the interface was gone! :crazyeye:
After a few edits, i found out that putting psyco in one .py file bugged the promotion system, another the interface etc. Some files seemed to work.
On the positive side, the game was noticeably faster! Especially the between-turns wait. :)
(Okay, it could have been placebo, as i didn't do any statistics... ;) )

The questions i have are:

The python version shipped with Civ is 2.4; can i replace this with 2.5? The 2.5 version of psyco fixes a few bugs.

This (http://psyco.sourceforge.net/psycoguide/bugs.html) page has the know psyco bugs. Does anybody familiar with the FFH python code know if these bugs apply to FFH/Civ?

Firaxis wrote the interface between C++ and python. As far as I know it isn't possible to change the python version.

Hydrahypnotizer
Feb 05, 2008, 11:22 AM
When i get back to my computer at home, i'm going to try some more stuff - including doing serious speed tests & searching for the thing that cause the bugs.

I hope changing python version is possible; I'll do a test.

MagisterCultuum
Feb 05, 2008, 11:43 AM
I believe that when there is a serious problem with the python the game doesn't load it (which causes the lack of the interface, etc). However, not loading python at all also makes the game much faster (since most of what slows the game down is in python) in addition to not allowing most of FfH's cool features.

Hydrahypnotizer
Feb 05, 2008, 03:55 PM
I believe that when there is a serious problem with the python the game doesn't load it

Can you enable some kind of verbose error messages, so civ notifies me of this? That would be really useful.

xienwolf
Feb 05, 2008, 04:05 PM
If you have it set to display Python Error Messages (instructions at bottom of first post in Bug Thread), it should do so when something happens to stop it from loading any further python.

Rod
Feb 08, 2008, 02:23 AM
Hello,

please get in touch with user musicfreak from this very forum. He is very on exactly the same project. (he is actually from the Rhyes and Fall of Civilization - Sub Forum).

As far as I recall he had success in using Python 2.5 but was working basically with the boost libraries. However the effect on the game performance was not satisfactory, but please get in touch with him and please update this post in this forum about any results.

I really like your idea to precompile the python files. It sounds ... awesome just awesome.

Please go ahead with this project!!

Hydrahypnotizer
Feb 08, 2008, 09:18 AM
Please go ahead with this project!!
Okay ;)

You will have to wait a week though, since I'm going on a holiday now :D