Blade XML Map Format Proposal

This proposal is an experimental XML protocol for defining client maps, based on Sal's MIM format, but customized and jiggered around to better fit the structure of the COAL (Client Object Aggregation Library) library.

All Blade content is enclosed in a toplevel element.

The Blade DTD

<!ELEMENT blade (media?,objects?,map?)+>

<!ELEMENT media (graphic|areafill)+> <!ELEMENT objects (name)+> <!ELEMENT map (region|object)+>

<!ELEMENT graphic (name,file+,(color|desc)*)> <!ELEMENT areafill (name,(color|texture|algorithm)+)> <!ELEMENT color (red,green,blue)> <!ELEMENT texture (graphicref)+> <!ELEMENT algorithm (seed|contents)+>

<!ELEMENT region (name,layer,geometry,fill)> <!ELEMENT geometry (vertices)> <!ELEMENT vertices (coord)+> <!ELEMENT object (name|coord|graphicref)+> <!ELEMENT coord (x,y,z?)> <!ELEMENT contents (graphicref)+>

<!ELEMENT name (#PCDATA)> <!ELEMENT desc (#PCDATA)> <!ELEMENT file (#PCDATA)> <!ELEMENT graphicref (#PCDATA)> <!ELEMENT layer (#PCDATA)> <!ELEMENT shape (#PCDATA)> <!ELEMENT fill (#PCDATA)>

<!ELEMENT red (#PCDATA)> <!ELEMENT green (#PCDATA)> <!ELEMENT blue (#PCDATA)> <!ELEMENT x (#PCDATA)> <!ELEMENT y (#PCDATA)> <!ELEMENT z (#PCDATA)>

<!ATTLIST graphic type (2d|3d) #IMPLIED> <!ATTLIST texture style (tile|stretch) #IMPLIED> <!ATTLIST file orient (base|n|s|e|w|nw|ne|sw|se) #IMPLIED> <!ATTLIST geometry shape (circle|square|rect|polygon) #IMPLIED>

Example of Blade Map

The following blade map is a direct translation of Sal's test1.mim example file into Blade format.

<?xml version="1.0"?>
<!DOCTYPE blade SYSTEM "blade.dtd">
<blade>
  <media>

<graphic type="2d"> <name>Grass</name> <file orient="base">media/tiles/ground/grass/bluegrass3.png</file> <file orient="w">media/tiles/ground/grass/bluegrass33.png</file> <file orient="n">media/tiles/ground/grass/bluegrass34.png</file> <file orient="e">media/tiles/ground/grass/bluegrass31.png</file> <file orient="s">media/tiles/ground/grass/bluegrass32.png</file> <file orient="nw">media/tiles/ground/grass/bluegrass13.png</file> <file orient="ne">media/tiles/ground/grass/bluegrass14.png</file> <file orient="se">media/tiles/ground/grass/bluegrass11.png</file> <file orient="sw">media/tiles/ground/grass/bluegrass12.png</file> <!-- * Color of graphic in radar view * --> <color> <red>57</red> <green>73</green> <blue>16</blue> </color> <desc>Blue Field Grass</desc> </graphic>

<graphic type="2d"> <name>Grass</name> <file orient="base">media/tiles/water/bluewater2.png</file> <file orient="w">media/tiles/water/bluewater23.png</file> <file orient="n">media/tiles/water/bluewater24.png</file> <file orient="e">media/tiles/water/bluewater21.png</file> <file orient="s">media/tiles/water/bluewater22.png</file> <file orient="nw">media/tiles/water/bluewater13.png</file> <file orient="ne">media/tiles/water/bluewater14.png</file> <file orient="se">media/tiles/water/bluewater11.png</file> <file orient="sw">media/tiles/water/bluewater12.png</file> <color> <red>8</red> <green>81</green> <blue>99</blue> </color> <desc>Blue Water</desc> </graphic>

<graphic> <name>Tree</name> <file orient="base"> media/sprites/vegetation/trees/oak/oak_1_young_leaves_1_hh.png </file> <color> <red>150</red> <green>0</green> <blue>0</blue> </color> </graphic>

<areafill> <name>Grassfill</name> <texture> <graphicref>Grass</graphicref> </texture> </areafill> <areafill> <name>Waterfill</name> <texture> <graphicref>Water</graphicref> </texture> </areafill> </media>

<map> <region> <name>Grassregion</name> <layer>1</layer> <!-- * shape attribute determines how many coords --> <geometry shape="square"> <vertices> <coord> <x>3</x> <y>3</y> </coord> <coord> <x>9</x> <y>9</y> </coord> </vertices> </geometry> <!-- Must be an areafill from above * --> <fill>Grassfill</fill> </region> </map> </blade>

Test1.mim MIM File

And here is Sal's original MIM file, tweaked a little for XML compliance:

<map format="mim">
<entity>
        <name>Grass </name>
        <color>57,73,16 </color>
        <type>0 </type>
        <prop_2d type="poly">
                media\ground\grass\bluegrass3.png,
                media\ground\grass\bluegrass33.png,
                media\ground\grass\bluegrass34.png,
                media\ground\grass\bluegrass31.png,
                media\ground\grass\bluegrass32.png,
                media\ground\grass\bluegrass13.png,
                media\ground\grass\bluegrass14.png,
                media\ground\grass\bluegrass11.png,
                media\ground\grass\bluegrass12.png,
        </prop_2d>
        <prop_3d>
        </prop_3d>
</entity>
<entity>
        <name>Water </name>
        <color>8,81,99 </color>
        <type>0 </type>
        <prop_2d type="poly">
                media\landscape\waters\bluewater2.png,
                media\landscape\waters\bluewater23.png,
                media\landscape\waters\bluewater24.png,
                media\landscape\waters\bluewater21.png,
                media\landscape\waters\bluewater22.png,
                media\landscape\waters\bluewater13.png,
                media\landscape\waters\bluewater14.png,
                media\landscape\waters\bluewater11.png,
                media\landscape\waters\bluewater12.png,
        </prop_2d>
        <prop_3d>
        </prop_3d>
</entity>
<entity>
        <name>Tree </name>
        <color>150,0,0 </color>
        <type>1 </type>
        <prop_2d>
        </prop_2d>
        <prop_3d>
        </prop_3d>
</entity>
<region>
        <name>Grass </name>
        <seed>0 </seed>
        <base_entity>none </base_entity>
        <subtractive>1 </subtractive>
        <item>
                <entity_name>Grass </entity_name>
                <frequency>100.000000 </frequency>
                <edging>0 </edging>
        </item>
 </region>
<region>
        <name>Water </name>
        <seed>0 </seed>
        <base_entity>none </base_entity>
        <subtractive>1 </subtractive>
        <item>
                <entity_name>Water </entity_name>
                <frequency>100.000000 </frequency>
                <edging>0 </edging>
        </item>
 </region>
<polygon shape="square">
        <region_name>Grass </region_name>
        <layer>1 </layer>
        <vertices>
3,3,9,3,9,9,3,9,3,9, 
        </vertices>
</polygon>
</map>