FIFE forums

Please login or register.

Login with username, password and session length
Advanced search  


FIFE 0.4.0 has been released on 15th of January, 2017!

Author Topic: Object Definitions  (Read 2365 times)


  • Newbie
  • Posts: 3
    • View Profile
Object Definitions
« on: January 12, 2011, 10:28:56 pm »

I'm working on an object XML definitions generator for PARPG, and have stumbled upon a strange error. Without changes, the game runs. However, when I run the generator for animations/agents, the game fails. As fair as I have been able to deduce, the error is in parsing the XML. Here is an original animation.xml:

<animation delay="100" namespace="PAPRG" id="player:walk:270" x_offset="0" y_offset="-25">
   <frame source="walk_0.png" />
   <frame source="walk_1.png" />
   <frame source="walk_2.png" />
   <frame source="walk_3.png" />
   <frame source="walk_4.png" />
   <frame source="walk_5.png" />
   <frame source="walk_6.png" />
   <frame source="walk_7.png" />
   <frame source="walk_8.png" />
   <frame source="walk_9.png" />
   <frame source="walk_10.png" />
   <frame source="walk_11.png" />

Here is the generated version:
<animation delay="100" id="player:walk:270" namespace="PARPG" x_offset="0" y_offset="0">
   <frame source="walk_0.png"/>
   <frame source="walk_1.png"/>
   <frame source="walk_2.png"/>
   <frame source="walk_3.png"/>
   <frame source="walk_4.png"/>
   <frame source="walk_5.png"/>
   <frame source="walk_6.png"/>
   <frame source="walk_7.png"/>
   <frame source="walk_8.png"/>
   <frame source="walk_9.png"/>
   <frame source="walk_10.png"/>
   <frame source="walk_11.png"/>
<!-- Automatically made with ObjectXmlGenerator -->

Original player.xml:
<?fife type="object"?>
<object id="player" namespace="PARPG" blocking="1" static="0">
   <action id="pick_up">
      <animation source="pick_up/000/animation.xml" direction="0" />
      <animation source="pick_up/045/animation.xml" direction="45" />
      <animation source="pick_up/090/animation.xml" direction="90" />
      <animation source="pick_up/135/animation.xml" direction="135" />
      <animation source="pick_up/180/animation.xml" direction="180" />
      <animation source="pick_up/225/animation.xml" direction="225" />
      <animation source="pick_up/270/animation.xml" direction="270" />
      <animation source="pick_up/315/animation.xml" direction="315" />
   <action id="run">
      <animation source="run/000/animation.xml" direction="0" />
      <animation source="run/045/animation.xml" direction="45" />
      <animation source="run/090/animation.xml" direction="90" />
      <animation source="run/135/animation.xml" direction="135" />
      <animation source="run/180/animation.xml" direction="180" />
      <animation source="run/225/animation.xml" direction="225" />
      <animation source="run/270/animation.xml" direction="270" />
      <animation source="run/315/animation.xml" direction="315" />
   <action id="stand">
      <animation source="stand/000/animation.xml" direction="0" />
      <animation source="stand/045/animation.xml" direction="45" />
      <animation source="stand/090/animation.xml" direction="90" />
      <animation source="stand/135/animation.xml" direction="135" />
      <animation source="stand/180/animation.xml" direction="180" />
      <animation source="stand/225/animation.xml" direction="225" />
      <animation source="stand/270/animation.xml" direction="270" />
      <animation source="stand/315/animation.xml" direction="315" />
   <action id="use">
      <animation source="use/000/animation.xml" direction="0" />
      <animation source="use/045/animation.xml" direction="45" />
      <animation source="use/090/animation.xml" direction="90" />
      <animation source="use/135/animation.xml" direction="135" />
      <animation source="use/180/animation.xml" direction="180" />
      <animation source="use/225/animation.xml" direction="225" />
      <animation source="use/270/animation.xml" direction="270" />
      <animation source="use/315/animation.xml" direction="315" />
   <action id="walk">
      <animation source="walk/000/animation.xml" direction="0" />
      <animation source="walk/045/animation.xml" direction="45" />
      <animation source="walk/090/animation.xml" direction="90" />
      <animation source="walk/135/animation.xml" direction="135" />
      <animation source="walk/180/animation.xml" direction="180" />
      <animation source="walk/225/animation.xml" direction="225" />
      <animation source="walk/270/animation.xml" direction="270" />
      <animation source="walk/315/animation.xml" direction="315" />

Generated player.xml:

<?fife type="object"?>
<object blocking="1" id="player" namespace="PARPG" static="0">
   <action id="pick_up">
      <animation direction="000" source="pick_up/000/animation.xml"/>
      <animation direction="045" source="pick_up/045/animation.xml"/>
      <animation direction="090" source="pick_up/090/animation.xml"/>
      <animation direction="135" source="pick_up/135/animation.xml"/>
      <animation direction="180" source="pick_up/180/animation.xml"/>
      <animation direction="225" source="pick_up/225/animation.xml"/>
      <animation direction="270" source="pick_up/270/animation.xml"/>
      <animation direction="315" source="pick_up/315/animation.xml"/>
   <action id="stand">
      <animation direction="000" source="stand/000/animation.xml"/>
      <animation direction="045" source="stand/045/animation.xml"/>
      <animation direction="090" source="stand/090/animation.xml"/>
      <animation direction="135" source="stand/135/animation.xml"/>
      <animation direction="180" source="stand/180/animation.xml"/>
      <animation direction="225" source="stand/225/animation.xml"/>
      <animation direction="270" source="stand/270/animation.xml"/>
      <animation direction="315" source="stand/315/animation.xml"/>
   <action id="run">
      <animation direction="000" source="run/000/animation.xml"/>
      <animation direction="045" source="run/045/animation.xml"/>
      <animation direction="090" source="run/090/animation.xml"/>
      <animation direction="135" source="run/135/animation.xml"/>
      <animation direction="180" source="run/180/animation.xml"/>
      <animation direction="225" source="run/225/animation.xml"/>
      <animation direction="270" source="run/270/animation.xml"/>
      <animation direction="315" source="run/315/animation.xml"/>
   <action id="use">
      <animation direction="000" source="use/000/animation.xml"/>
      <animation direction="045" source="use/045/animation.xml"/>
      <animation direction="090" source="use/090/animation.xml"/>
      <animation direction="135" source="use/135/animation.xml"/>
      <animation direction="180" source="use/180/animation.xml"/>
      <animation direction="225" source="use/225/animation.xml"/>
      <animation direction="270" source="use/270/animation.xml"/>
      <animation direction="315" source="use/315/animation.xml"/>
   <action id="walk">
      <animation direction="000" source="walk/000/animation.xml"/>
      <animation direction="045" source="walk/045/animation.xml"/>
      <animation direction="090" source="walk/090/animation.xml"/>
      <animation direction="135" source="walk/135/animation.xml"/>
      <animation direction="180" source="walk/180/animation.xml"/>
      <animation direction="225" source="walk/225/animation.xml"/>
      <animation direction="270" source="walk/270/animation.xml"/>
      <animation direction="315" source="walk/315/animation.xml"/>
<!-- Automatically made with ObjectXmlGenerator -->

I diff'ed the old and new, only difference I have found is the ordering of the attributes and the offsets. I wouldn't think that effects anything - am I wrong? It didn't cause any issues for the static objects, so it's specifically an issue with animations. I don't think it's an issue with the offsets either, but I could be wrong. I'm digging through all the XML files generated to look for anything else that could be different.

Using the FIFE python module found here:  /home/corey/PARPG/FIFE/engine/python/fife
Psyco acceleration not used
Traceback (most recent call last):
  File "", line 94, in <module>
  File "", line 80, in main
    app = PARPGApplication(loadSettings())
  File "/home/corey/PARPG/parpg/game/scripts/", line 125, in __init__
  File "/home/corey/PARPG/parpg/game/scripts/", line 409, in readAllAgents
    self.addAgent(self.ALL_AGENTS_KEY, agent) 
  File "/home/corey/PARPG/parpg/game/scripts/", line 388, in addAgent
    loadImportFile(self.obj_loader, import_file, self.engine)
  File "/home/corey/PARPG/FIFE/engine/python/fife/extensions/serializers/", line 38, in loadImportFile
  File "/home/corey/PARPG/FIFE/engine/python/fife/extensions/serializers/", line 86, in loadResource
  File "/home/corey/PARPG/FIFE/engine/python/fife/extensions/serializers/", line 93, in do_load_resource
    tree = ET.parse(file)
  File "<string>", line 45, in parse
  File "<string>", line 32, in parse
SyntaxError: unclosed token: line 54, column 0
« Last Edit: January 12, 2011, 10:31:03 pm by KB1PKL »


  • Newbie
  • Posts: 6
  • ATDAlpha - Developer/Project Manager/...
    • View Profile
    • AITech Solutions - We're here to help you Succeed!
Re: Object Definitions
« Reply #1 on: January 12, 2011, 11:23:10 pm »


Hmm, Off the cuff I'd say,

It's complaining about line 54 column 0:

"SyntaxError: unclosed token: line 54, column 0"

Maybe it does not like the comment line in player.xml.
If I put your generated player.xml in an editor, the comment is on line 54.

<!-- Automatically made with ObjectXmlGenerator -->

Try removing that and just have a newline (or CR on windows) there and give it a try.

Hope that helps,


  • Newbie
  • Posts: 3
    • View Profile
Re: Object Definitions
« Reply #2 on: January 13, 2011, 06:02:31 am »

Hmm, that fixed it. Strange, comments shouldn't have any bearing on the parsing, and it doesn't on the static objects.  :-\

Thanks Tim.


  • Developer
  • Full Member
  • *
  • Posts: 206
    • View Profile
Re: Object Definitions
« Reply #3 on: January 14, 2011, 07:13:25 am »

Did you put a newline at the bottom of the xml definition file? There is currently a bug listed here detailing the problem. Basically the xml reader fails to load the file properly without a newline after the last definition line.

Its a bug in the reading of the xml file and is slated to be fixed in the upcoming 0.3.3 release.



  • Newbie
  • Posts: 3
    • View Profile
Re: Object Definitions
« Reply #4 on: January 14, 2011, 12:59:38 pm »

Ah, no I wasn't. I wrote that comment to the file manually, not through ElementTree, which probably would have added the newline.