If we decide on XML, at least do it right ;)

I've attached a version of repair.xml that have been refactored to the
way *I* think it should be structured. What's not visible is the link
to the XSD Schema that defines the structure of this particular XML
format: the tree-structure, including the various property tags and
their datatypes.

A key part of XML is that it should be self-describing, which you
won't get if you have <property> tags with "name" attributes.
Besides, attributes should be reserved for *meta-data* (data about the
actual data) and not the *actual* data, which should instead be kept
between the start and end tags.

With this in mind, we get an XML format that is more concise, more
readable, easier to search with XPath, easier specify in XSD Schemas,
and so forth... (here follows a lengthy and boring speech on how Good
Design Pays!)

Anyway, you get the point :)

Cheers,
Karmazilla.

2006/11/28, Giel van Schijndel <[EMAIL PROTECTED]>:
Fearthecute schreef:
> Giel van Schijndel schrieb:
>> I wouldn't mind seeing special purpose scripts written in Lua. Whenever
>> your just storing data and describing object properties (which is just
>> about all that is being done in data/stats/*.txt AFAIK) though I think
>> XML is much more intuitive to use. It is also easier to create a
>> data-editor for XML than it is for Lua.
>>
> Because XML is a buzzword, xml is NOT good for everything.
> Its a markup language for a static tree-like definition list.
> And not for data storage...
>
As for the buzzword part I agree it is that much, but luckily, it is
more than just that (to my opinion). About describing XML as a data
storage container, let me rephrase that: XML is (to my opinion) better
for the purpose of describing than any programming/scripting language
is. The latter describes instructions/actions to be executed (e.g. by a
PC), whereas XML is designed to describe data, and importantly in this
case as opposed to plain text, it also describes the meaning of the data
(especially towards humans).
> And where do we have a tree-like static definition?
> How do you want to use it?
>
> ~~~~~
>
> <map name="MapName" player="2">
>       <tile x="1" y="1" textureID="17" textureAlign="2" height="128" />
>       <tile x="2" y="1" textureID="16" textureAlign="1" height="128" />
>       <tile x="3" y="1" textureID="12" textureAlign="1" height="128" />
>       <tile x="4" y="1" textureID="19" textureAlign="2" height="129" />
>       ...
> </map>
>
> ~~~~~
>
> This produces MUCH overhead and will increase the filesize by n^4 or
> whatever...
>
> Or something like
>
> ~~~~~
>
> <map name="MapName" player="2">
>       <mapdata>
>               1 1 17 2 128
>               2 1 16 1 128
>               3 1 12 1 128
>               4 1 19 2 129
>               ...
>       </mapdata>
> </map>
>
> ~~~~~
>
> That would be absolutly the same thing, like it's now handled.
> It's just beautyfied with some <NameHere></NameHere> tags.
> If you have something different in your mind, then i'm sorry :)
>
Yes, actually I have something different in mind. Just compare
http://svn.gna.org/svn/warzone/trunk/data/stats/repair.txt with my
attached example XML-file.

I agree that for the example you gave above, describing 3D-objects by
means of coordinates, XML isn't by far the best solution. Instead I
meant the data/stats/*.txt and mp/data/stats/*.txt files which has lots
of hierarchal relations, i.e. statistics about all sorts of objects.

The PIE-files (which define the 3D-objects if I'm not mistaken, and is
what you gave as example) are quite a different subject. I wouldn't use
XML for those exactly for that overhead you noted.

--
Giel



_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev






--
"All good software releases were accidents corrected in the next version."
<?xml version="1.0" encoding="UTF-8"?>
<stats name="Repair">
	<objectStats name="ZNULLREPAIR">
		<techLevel>ALL</techLevel>
		<buildPower>0</buildPower>
		<buildPoints>0</buildPoints>
		<weight>0</weight>
		<hitPoints>0</hitPoints>
		<systemPoints>0</systemPoints>
		<repairArmour>0</repairArmour>
		<repairPoints>0</repairPoints>
		<time>100</time>
		<!-- the abscense of "designable" means that the value is 'false' -->
	</objectStats>
	<objectStats name="NEXUSrepair">
		<techLevel>3</techLevel>
		<buildPower>0</buildPower>
		<buildPoints>0</buildPoints>
		<weight>0</weight>
		<hitPoints>0</hitPoints>
		<systemPoints>0</systemPoints>
		<repairArmour>1</repairArmour>
		<repairPoints>0</repairPoints>
		<time>100</time>
	</objectStats>
	<objectStats name="LightRepair1">
		<techLevel>-1</techLevel>
		<buildPower>50</buildPower>
		<buildPoints>250</buildPoints>
		<weight>800</weight>
		<hitPoints>0</hitPoints>
		<systemPoints>10</systemPoints>
		<repairArmour>0</repairArmour>
		<location>TURRET</location>
		<gfxFile>GNMREPAR.PIE</gfxFile>
		<mountGfx>TRMECM1.PIE</mountGfx>
		<repairPoints>15</repairPoints>
		<time>7</time>
		<designable />
	</objectStats>
</stats>


_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev

Reply via email to