[Kde-games-devel] Tileset format for KMahjongg

Mauricio Piacentini mauricio at tabuleiro.com
Thu Nov 16 21:00:57 CET 2006


Hi! Regarding this thread, I have finished the initial SVG and XML 
implementation for authors that want to work on mahjongg tilesets for 
KMahjongg, with the intention to use this in KShisen and future kdegames 
that need tiles as well. You can get samples at

http://websvn.kde.org/trunk/KDE/kdegames/kmahjongg/pics/default_tileset.svgz

and

http://websvn.kde.org/trunk/KDE/kdegames/kmahjongg/pics/default.tileset

I will add a text description of the format to the tree in the future, 
but there are basically two files:

The tilesetname.tileset format is an XML description of the tileset 
dimensions and general characteristics, including versioning. It can be 
named for example greek.tileset, or runes.tileset, or default.tileset in 
the case of the one I have checked in. I am planning to use the 
intermediary XML file not only for versioning, but also possibly for 
internationalization support and sanity checking (checking default sizes 
without having to render SVG elements, and making current code able to 
deal with future upgrades of the format.) If someone has tips on how we 
can achieve the internationalization bit, I am all ears... As you can 
see, currently there are no language tags. A sample is

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kdegames-tileset>
<kdegames-tileset version="1.0">
     <graphics type="svg">
	<path>default_tileset.svgz</path>
	<tilewidth>96</tilewidth>
	<tileheight>116</tileheight>
	<tilefacewidth>69</tilefacewidth>
	<tilefaceheight>89</tilefaceheight>
	<leveloffset>12</leveloffset>
     </graphics>
</kdegames-tileset>

As you can see, it specifies the type of graphics and the path. It also 
specifies the full tilewidth and height (including shadows if present). 
You can also specify the tilefacewidth and height. Leveloffset is the 
amount (in pixels) of offset the engine should apply for each layer when 
tiles are stacked. It corresponds roughly to the width/height of the 
whole tile minus shadow minus tileface.

Then there is the svg or svgz file, containing the actual graphics.

In the svgz file you have 8 generic tiles, corresponding to blank tiles 
in 4 angles (NW/SW/SE/NE), plus the selected versions of the same tiles. 
Each tile is grouped as an SVG element, examine the elementID to find 
out the names the engine is expecting (TILE_1, TILE_1_SEL, and so on).

As for the tilefaces, they are presented separately, also with SVG 
elementIDs used for identification. The naming follows the default 
mahjongg set (CHARACTER_1 to CHARACTER_9, BAMBOO_1 to BAMBOO_9, and so on).

Let me know if you need more information on this. As soon as Robert has 
adapted his art I can import it to the tree and maybe move this to a 
shared tileset location to be used for Kmahjongg, KShisen and all future 
games that rely on mahjongg tiles.

Regards,
Mauricio Piacentini


> The plan is to offer the same tilesets for KMahjongg and KShisen 
> eventually, and add an option so users can also download new ones.
> 
> However, I have not really finished the tileset XML format yet. I am 
> still implementing angle viewing for the tiles, so you will be able to 
> switch your view position. This is not really necessary for KShisen, but 
> it is a nice addition to KMahjongg, to see partially obscured tiles. So 
> the final layout of the SVG and element names are not defined yet, but 
> should be finished in the next couple of weeks.  If you are interested I 
> can email you when the format is final, and you could maybe adapt your 
> SVG to its specifications. Then your artwork would be useful for both 
> games at once.



More information about the kde-games-devel mailing list