Fractal Server Descriptions

Yesterday’s thoughts on implementing the single-player wizard in libtpclient-py.

I’m planning to use Python’s xml.sax module to parse multiple server/ruleset XML descriptions into a big list-and-dictionary structure. The structure for, say, tpserver-cpp-0.5.1.xml would look something like this (though the final product would, in general, consist of the data from multiple such files):

[ { 'name' : 'tpserver-cpp-0.5.1', 'longname' : 'tpserver-cpp', 'version' : '0.5.1', 'description' : 'Thousand Parsec server in C++.', 'parameters' : [ { 'name' : 'turnlength', 'type' : 'I', 'longname' : 'Turn Length', 'description' : 'Maximum length of a turn (0 for unlimited).', 'default' : 0, 'commandstring' : '--turn_length_over_threshold %d' } ], 'rulesets' : [ { 'name' : 'minisec', 'longname' : 'MiniSec', 'version' : '0.3', 'description' : '', 'parameters' : [] }, { 'name' : 'mtsec', 'longname' : 'MTSec', 'version' : '0.0', 'description' : '', 'parameters' : [] }, { 'name' : 'risk', 'longname' : 'Risk', 'version' : '0.1', 'description' : 'A modified Risk ruleset for tpserver-cpp.', 'parameters' : [ { 'name' : 'map', 'type': 'S', 'longname' : 'Map', 'description' : 'Map file to load.', 'default' : '', 'commandstring' : '--risk_map %s' } ] } ] } ]

Phew.

The other functions would pull data from this beast as necessary to build the wizard form and actually run the server with options. The AI client stuff, of course, would be mostly similar.

Jul 28th, 2008
Tags:
Comments are closed.