[Verse-dev] Saving and Loading

Emil Brink emil at obsession.se
Mon Sep 5 16:05:21 CEST 2005


Hello.

Earlier today, in the Uni-Verse PCC meeting, we talked about persistance
and saving/loading Verse server state.

There are tools to do this, but they are not officially released yet. If
there is interest in having them, we must of course make them available 
anyway, to help you out.

So, here goes. Beware that this is certainly classified as "work in 
progress", though.

The "save" part of the equation is provided by a tool Eskil wrote, that
simply uses the Enough library to download and buffer the contents of a
server, and then writes that out to disk. It can (optionally) continue
to do so periodically, to give a snapshot every N seconds. The files
written out are in a format called "VML", which is XML. For a very
simple example, here's what it can look like:

<?xml version="1.0"?>

<vml>
  <node id="0" type="V_NT_OBJECT" name="cube">
   <scale>1.0 1.0 1.0</scale>
   <links>
    <link node="1" label="geometry" target="0"/>
   </links>
  </node>

  <node id="1" type="V_NT_GEOMETRY" name="cube-geometry">
   <layers>
    <layer name="vertex" type="VN_G_LAYER_VERTEX_XYZ">
     <v>0 -1  1 -1</v>
     <v>1  1  1 -1</v>
     <v>2  1  1  1</v>
     <v>3 -1  1  1</v>
     <v>4 -1 -1  1</v>
     <v>5  1 -1  1</v>
     <v>6  1 -1 -1</v>
     <v>7 -1 -1 -1</v>
    </layer>
    <layer name="polygon" type="VN_G_LAYER_POLYGON_CORNER_UINT32">
     <p>0 1 2 3</p>
     <p>4 5 6 7</p>
     <p>3 2 5 4</p>
     <p>2 1 6 5</p>
     <p>1 0 7 6</p>
     <p>0 3 4 7</p>
    </layer>
   </layers>
   <vertexcrease layer="" default="0xffffffff"/>
   <edgecrease   layer="" default="0xffffffff"/>
  </node>
</vml>

That defines a simple cube object+geometry pair.

The saver lives in the "quelsolaar" Verse CVS module, in the file
"vml-saver.c". Build instructions are in the Makefile in that module.

To load such files back into the server, I've written another little
tool. This tool relies on parts of the "Purple" codebase for much of its
heavy lifting, which makes releasing/managing it a bit troublesome. I
don't want to release "yet another C utility library" into the world,
but maintaining the code becomes troublesome if it's used in two
projects at the same time. Locally, I just symlink the needed files
between my main Purple working dir and the loader's.

In the meantime, I guess I can just release this code to interested
parties in the form of a source archive. That steps around the problem
of sharing code between two CVS modules, and still gets it into your hands.

Right now, I seem unable to publish things to any Verse web site, so
I've instead archived the loader code up, and asked Camilla to host it, 
to which she very graciously agreed. Thus, the archive is here:
<http://www.elmindreda.org/verse/vml-loader-20050905.tar.gz>.

Please note that this never has been built on anything else but my local 
Linux workstation. However, Purple has, and that's almost 2/3s of the 
code here.

Comments or questions welcome, as always.

Regards,

/Emil



More information about the Verse-dev mailing list