rst2xml.py v0.3 README
Jan 21, 2002
(this file is best viewed with netscape/mozilla)

rst2xml.py is a python program used to convert a VGAPlanets 3.x RST turn file into xml for further processing.

License: GNU GPL.
The Author, Tjabo Kloppenburg <tk@bitsex.de>, is very sorry about his bad english! :-)

Contents:
   Introduction
   Installation
   Help me!

   rst2xml.py (download: right click, save as...)

Introduction

In the middle of 2001 I was bored about not having a linux client for the strategic game VGAPlanets 3.5x by Tim Wissemann (see http://www.vgaplanets.org/). The game itself runs on a x86 machine with wine, but the gui is very ugly, and the additional tool EchoView (see ...) didn't work well.
So I decided to code a linux client, but after some months and starting to work for money I realized that it's too much work for a single person (and an old game). Finally, at the end of december 2001 I had the idea to rearrange the sources to become a RST-to-XML converter making it possible for nearly everyone to process the turn file data.

When you browse the source you'll see some ugly things, and I want to explain some of them:


First of all remember that rst2xml.py was build from the sources of plynets.py, a

PyGtk based client for VGA Planets. I've put all classes in one file to avoid the mess you get when unpacking a python project - dozens of files, and you don't know which file to start. If you like to use some of my classes for your projects you should unpack every class into a single file , and don't forget to add a little comment to your code stating where this part of your code came from.
When rearranging the sources I deleted the gui code. Other parts not used any more remained in the source, for example the olddata / newdata mechanism. 

To be able to generate a clients turn file (Player<n>.trn) the game client had to store both the data read from the turn file and the data changes by the player doing his turn.

The idea was to put all data in the instance of an empty class (olddata), and making a deepcopy into another instance "newdata". A member function like "ship.setTarget(2314, 1832)" would have changed the "newdata" namespace, making it possible to analyze the changes between olddata and newdata to generate a TRN turn file later.

The generated XML file is not a proper XML file - there's no encoding defined at the top. I did not know how to do this part, and sooner or later you or me will run into a problem: whenever a ships or a planets name or the rst password contains an xml special char like "<" or ">" we'll run into a failure (broken structure). If you have an idea how to scope with this problem please tell me!


Installation

Move or copy the file rst2xml.py where ever you want. Before starting the program the first time please change

the programs first line to start your python interpreter where it is installed. I use python2.2 for new

programs. My interpreter is in /usr/local/bin/python22, but I'ld bet yours is in another place...

Help me!

There are some things to code before the program is complete. If you have ideas or want to contribute some code/patches I'ld be very happy.
Have a look at this list to see what's lacking:

If you like to help please do... :-)

Have fun,
tk.