I'm using Articy XML exports as the main data source for the game (Articy is much faster for doing non-linear dialogue than hand-writing scripts), but unfortunately loading times are creeping up steadily. I've gone through a couple rounds of optimizing, and at this point when I run a profiler it reports that out of 28 seconds my startup code is taking 3 seconds while ElementTree is taking 25 to parse the XML so getting cElementTree working is the clear next step.
Anyway, here's what I've tried:
1) I started with the basic "import cElementTree as ET", which failed due to not finding the class. I Googled "renpy celementtree" and found a match in the Git hub but nothing useful, so I tried some other changes...
2) I've had success getting standard Python modules working in Ren'Py by taking their .py files from python27/lib and copying them to my game source code directory, and tried copying over cElementTree.py. That got past the first error but then gave a new error of "Unable to import _elementtree".
3) On research, that error means that the C library files are missing. I tried coping over to _elementtree.lib and _elementtree.pyd from Python27/libs to my game directory, and the import error remained. I then copied them to renpy-6.18.3-sdk\lib\pythonlib2.7 and was able to start the program.
4) The program would start...but then immediately threw the exception below:
Code: Select all
I'm sorry, but an uncaught exception occurred.
While executing init code:
File "game/script.rpy", line 31, in script
init python:
File "game/script.rpy", line 104, in <module>
articy = Articy()
File "game/articy.rpy", line 60, in __init__
tree = ET.parse(xml_file)
RuntimeError: cannot load dispatch table from pyexpat
I welcome suggestions! I figure there's a knack to including C libraries with Ren'Py, and am happy to test different approaches.