Saturday, 11 December 2010

I can add narratives now, and save them and load them. This is coming on quite quickly

















I do have a bit of a problem, however. I'm using .NET's XmlSerializer to save the structures as XML. The trouble is, it wants to save them like this:

<?xml version="1.0" encoding="utf-8"?>
<Scene xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="intro" desc="In which our hero yadda yadda yadda">
  <narratives>
    <narrative>
      <items />
      <name>waking_up</name>
      <desc>start here</desc>
    </narrative>
    <narrative>
      <items />
      <name>exploration</name>
      <desc>what IS this place?</desc>
    </narrative>
  </narratives>
</Scene>


There are a couple of capitlisation issues there, but that's fixable. The real problem is that it wants to create a <narratives> tag to wrap the narrative elements. What's easiest? To change the Lua code to cope with MS export format? Or to write a custom serialiser for the lists?

The custom serialiser was a pain the last time I wrote one. But there's a shedload of xml snippets in the test harness, and I don't want to have to fix all of them, as well as re-writing the code that reads them.

I'm almost tempted to hand code the XML export. Easy enough. although the import routines are a bit more of a pain.

What to do, what to do ... ?

No comments: