<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
  <!ENTITY ksirk '<application>KsirK</application>'>
  <!ENTITY ksirkskineditor '<application>KsirK Skin Editor</application>'>
  <!ENTITY kappname "&ksirkskineditor;">
  <!ENTITY package "kdegames">
  <!ENTITY % addindex "IGNORE">
  <!ENTITY % English "INCLUDE">
]>

<book id="ksirkskineditor" lang="&language;">

<bookinfo>
<title>The &kappname; Handbook</title>

<authorgroup>
<author>
<firstname>Gael</firstname>
<othername>Kleag</othername>
<surname>de Chalendar</surname>
<affiliation>
<address><email>Kleag@free.fr</email></address>
</affiliation>
</author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>


<copyright>
<year>2009</year>
<holder>Gael de Chalendar</holder>
</copyright>
<!-- Translators: put here the copyright notice of the translation -->
<!-- Put here the FDL notice.  Read the explanation in fdl-notice.docbook
     and in the FDL itself on how to use it. -->
<legalnotice>&FDLNotice;</legalnotice>

<!-- Date and version information of the documentation
Don't forget to include this last date and this last revision number, we
need them for translation coordination !
Please respect the format of the date (DD/MM/YYYY) and of the version
(V.MM.LL), it could be used by automation scripts.
Do NOT change these in the translation. -->

<date>22/05/2009</date>
<releaseinfo>4.3</releaseinfo>

<!-- Abstract about this handbook -->

<abstract>
<para>
&ksirk; is a computerized version of a well known strategy game. It is fully skinable. This manual explains how to create new skins from scratch, using a file browser, a SVG image editor and &kappname;.
</para>
</abstract>

<!-- This is a set of Keywords for indexing by search engines.
Please at least include KDE, the KDE package it is in, the name
 of your application, and a few relevant keywords. -->

<keywordset>
<keyword>KDE</keyword>
<keyword>kdegames</keyword>
<keyword>game</keyword>
<keyword>strategy</keyword>
<keyword>Risk</keyword>
<keyword>free</keyword>
<keyword>GPL</keyword>
<keyword>skin</keyword>
<keyword>editor</keyword>
</keywordset>

</bookinfo>

<!-- The contents of the documentation begin here.  Label
each chapter so with the id attribute. This is necessary for two reasons: it
allows you to easily reference the chapter from other chapters of your
document, and if there is no ID, the name of the generated HTML files will vary
from time to time making it hard to manage for maintainers and for the CVS
system. Any chapter labeled (OPTIONAL) may be left out at the author's
discretion. Other chapters should not be left out in order to maintain a
consistent documentation style across all KDE apps. -->

<chapter id="introduction">
<title>Introduction</title>

<!-- The introduction chapter contains a brief introduction for the
application that explains what it does and where to report
problems. Basically a long version of the abstract.  Don't include a
revision history. (see installation appendix comment) -->
<para>
&ksirk; is a computerized version of a well known strategy game. It is fully skinable. This manual explains how to create new skins from scratch, using a file browser, a SVG image editor and &kappname;.
</para>
<para>
<screenshot>
  <screeninfo>Here's a screenshot of &kappname;</screeninfo>
  <mediaobject>
    <imageobject>
      <imagedata fileref="main-snapshot.png" format="PNG"/>
    </imageobject>
    <textobject>
      <phrase>Screenshot</phrase>
    </textobject>
  </mediaobject>
</screenshot>
</para>
<para>
There is three main steps to create a new skin: creating the folders hierarchy; creating the graphics, all pooled inside a SVG file; and then placing sprites and naming things using &kappname;.
</para>
</chapter>

<chapter id="using-kapp">
<title>Creating a &ksirk; skin</title>
  <para>
    &ksirk; is fully skinable. For who have graphic capabilities, creating a new skin is as simple as copying an existing one, editing or changing the graphics and updating the data in a .desktop configuration file, which is done using the &kappname;. A last step is to edit the file describing what to install.
  </para>
  <para>All examples (text and images) are taken from the default skin of &ksirk;</para>
  
  <sect1 id="sdf">
    <title>Structure of folders and files</title>
    <para>
      <itemizedlist>
        <listitem>
          <para>Data/ : Data used by the program to handle the images of the skin.
            <itemizedlist>
              <listitem><para>CMakeLists.txt : Describes what to install.</para></listitem>
              <listitem><para>onu.desktop : Main file for the description of the skin. See its description below.</para></listitem>
            </itemizedlist>
          </para>
        </listitem>
        <listitem>
          <para>Images/ : The images of the skin (map, sprites, etc.)
            <itemizedlist>
              <listitem><para>CMakeLists.txt : Describes what to install.</para></listitem>
              <listitem><para>pool.svg : the map and all the sprites used in this skin.</para></listitem>
              <listitem><para>map-mask.png : the image allowing the program to find which country the mouse is over during the game (see below).</para></listitem>
              <listitem><para>*.png : the other images here are buttons images.</para></listitem>
            </itemizedlist>
          </para>
        </listitem>
        <listitem><para>CMakeLists.txt/ : Describes what to install.</para></listitem>
        <listitem><para>Sounds/ : sound files for the skin.</para></listitem>
      </itemizedlist>
    </para>
    <sect2 id="tdd">
      <title>The Data folder</title>
        <para>
          This folder contains only one file, world.desktop. This file is a description of the content of the skin. It is used to describe the organization of the world and how to display it. You don't have to fill it manualy as it will be handled by the &kappname;. But, for the sake of completeness, we will now describe its structure.
        </para>
        <para>
          An onu group contains a number of country entries, a number of nationality entries and lastly a number of continent entries. Then various groups contain the description of the different sprites, the description of the different countries, continents, nationalities and goals.
        </para>
        <para>
          The following sections describe the content of each group.
        </para>
        <sect3>
          <title>The onu group</title>
          <para>
            <table>
              <title>The onu group entries</title>
              <tgroup cols="2">
                <thead><row><entry>Entry name</entry><entry>Signification</entry></row></thead>
                <tbody>
                  <row><entry>width</entry><entry>The width of the skin's map</entry></row>
                  <row><entry>height</entry><entry>The height of the skin's map</entry></row>
                  <row><entry>skinpath</entry><entry>The path of the skin relative to the application data path (e.g. skins/default)</entry></row>
                  <row><entry>nb-countries</entry><entry>The number of countries (42 in the default skin). There should be the same number of country groups below</entry></row>
                  <row><entry>nb-nationalities</entry><entry>The number of nationalities (6 in the default skin). There should be the same number of nationality groups below</entry></row>
                  <row><entry>nb-continents</entry><entry>The number of continents (6 in the default skin). There should be the same number of continent groups below</entry></row>
                  <row><entry>pool</entry><entry>The path and name of the pool file relative to the skin path (e.g. Images/pool.svg)</entry></row>
                  <row><entry>map-mask</entry><entry>The path and name of the map mask file relative to the skin path (e.g. Images/map-mask.png)</entry></row>
                  <row><entry>format-version</entry><entry>The version of the skin file format (2.0)</entry></row>
                  <row><entry>name</entry><entry>The display name of the skin</entry></row>
                  <row><entry>desc</entry><entry>The long description of the skin</entry></row>
                  <row><entry>fighters-flag-y-diff</entry><entry>The height difference between flags and cannons sprites</entry></row>
                  <row><entry>width-between-flag-and-fighter</entry><entry>The number of pixels between the left most pixel of the flag and the right most pixel of the simple cannon (when not firing nor exploding)</entry></row>
                </tbody>
              </tgroup>
            </table>
          </para>
        </sect3>
        <sect3>
          <title>The sprites description groups</title>
          <para>
            Each type of sprite (flag, infantry, cavalry, cannon, firing cannon and exploding cannon) is defined by a group. Only some sprites have a width entry. This entry is used for relative positioning during animations: the cannons, firing or exploding should not "move" around the country's flag during fight.
            <table>
              <title>Sprite description group entries</title>
              <tgroup cols="2">
                <thead><row><entry>Entry</entry><entry>Signification</entry></row></thead>
                <tbody>
                  <row><entry>width</entry><entry>The reference width of the flag sprite frames</entry></row>
                  <row><entry>height</entry><entry>The reference height of the flag sprite frames</entry></row>
                  <row><entry>frames</entry><entry>The number of frames of the sprite</entry></row>
                  <row><entry>versions</entry><entry>The number of versions of the flag sprites</entry></row>
                </tbody>
              </tgroup>
            </table>
          </para>
        </sect3>
        <sect3>
          <title>The countries description groups</title>
          <para>
            Each country listed in the onu group, countries entry has its own group whose label is the country name. The table below lists the entries of these groups.
          </para>
          <para>
            <table>
              <title>Country entries</title>
              <tgroup cols="2">
                <thead><row><entry>Entry name</entry><entry>Signification</entry></row></thead>
                <tbody>
                  <row><entry>id</entry><entry>The integer unique identification number of the country, must start at zero (0)</entry></row>
                  <row><entry>name</entry><entry>The displayed name of the country</entry></row>
                  <row><entry>&lt;sprite&gt;-point</entry><entry>Each type of sprite (flag, infantry, etc.) in the country is displayed at a certain position defined by this entry made of two integers separated by a comma</entry></row>
                  <row><entry>neighbours</entry><entry>The list of the ids of the neighbors of the current country</entry></row>
                </tbody>
              </tgroup>
            </table>
          </para>
        </sect3>
        <sect3>
          <title>The nationalities description groups</title>
          <para>
            Each nationality listed in the onu group, nationalities entry has its own group whose label is the nationality name. The table below lists the entries of these groups.
          </para>
          <para>
            <table>
              <title>Nationality entries</title>
              <tgroup cols="2">
                <thead><row><entry>Entry name</entry><entry>Signification</entry></row></thead>
                <tbody>
                  <row><entry>name</entry><entry>The name of the nationality (e.g. Japan)</entry></row>
                  <row><entry>leader</entry><entry>The name that will be proposed to the player choosing this nationality</entry></row>
                  <row><entry>flag</entry><entry>The name of the country's flag sprite element in the onu SVG file</entry></row>
                </tbody>
              </tgroup>
            </table>
          </para>
        </sect3>
        <sect3>
          <title>The continents description groups</title>
          <para>
            Each continent listed in the onu group, continents entry has its own group whose label is the continent name. The table below lists the entries of these groups.
          </para>
          <para>
            <table>
              <title>Continent entries</title>
              <tgroup cols="2">
                <thead><row><entry>Entry name</entry><entry>Signification</entry></row></thead>
                <tbody>
                  <row><entry>name</entry><entry>The name of the continent (e.g. Africa)</entry></row>
                  <row><entry>id</entry><entry>The integer unique identification number of the continent</entry></row>
                  <row><entry>bonus</entry><entry>The number of armies obtained at the end of the turn by the player owning all the countries of the continent</entry></row>
                  <row><entry>continent-countries</entry><entry>The list of the ids of the countries inside the current continent</entry></row>
                </tbody>
              </tgroup>
            </table>
          </para>
        </sect3>
        <sect3>
          <title>The goals description groups</title>
          <para>
            Each goal listed in the onu group, goals entry has its own group whose label is the goal name. The table below lists the entries of these groups.
          </para>
          <para>
            <table>
              <title>Goal entries</title>
              <tgroup cols="2">
                <thead><row><entry>Entry name</entry><entry>Signification</entry></row></thead>
                <tbody>
                  <row><entry>type</entry><entry>The type of goal. Can be continents, countries or player</entry></row>
                  <row><entry>nbArmiesByCountry</entry><entry>set the minimal number of armies the player will have to put on each country</entry></row>
                  <row><entry>nbCountries</entry><entry>set the number of countries the player must possess</entry></row>
                  <row><entry>nbCountriesFallback</entry><entry>For a player goal type, if the target player is killed by another one, this sets the number of countries the player will have to conquer instead</entry></row>
                  <row><entry>desc</entry><entry>A full text description of the goal with appropriate placeholders (needs more doc here)</entry></row>
                  <row><entry>continents</entry><entry>The list of continents ids the player will have to conquer</entry></row>
                </tbody>
              </tgroup>
            </table>
          </para>
      </sect3>
    </sect2>
    <sect2 id="tid">
      <title>The Images folder</title>
      <para>
        This folder contains the buttons specific to &ksirk; and the pool SVG file that contains the map and all sprites.
      </para>
      <sect3>
        <title>The pool.svg file</title>
        <para>
          This SVG file contains the map and all the sprites of the game. Each element is named such that the game can select and render separately each of them.
        </para>
        <para>
          In the default skin, the sprites are flags, infantry, cavalry and cannon. Infantry represents one army, five for cavalry and ten for cannons. Cannons are also used to display fighting armies. That's why there is three kinds of cannon sprites: normal static or moving cannon, firing one and exploding one.
        </para>
        <para>
          Each sprite image is the concatenation of the various views of the object and for each view, its frames. Views are organized vertically and frames horizontally. Where to cut the image in individual frames is found by dividing the height of the image by the number of views and the width by the number of frames. These data are found in the onu.desktop file.
          <mediaobject><imageobject><imagedata fileref="cannon.png" format="PNG"/></imageobject><caption><para>An example of a sprite image: cannon.png</para></caption></mediaobject>
        </para>
        <para>
          For armies sprites, there is three different views, from top to bottom:</para>
          <itemizedlist><listitem><para>looking right</para></listitem>
          <listitem><para>looking left and</para></listitem><listitem>
          <para>facer</para></listitem></itemizedlist>
           <para> For flags, there is only one view. All sprites backgrounds should be set to transparent.
          <mediaobject><imageobject><imagedata fileref="italy.png" format="PNG"/></imageobject><caption><para>An example of a flag sprite image: italy.png</para></caption></mediaobject>
        </para>
        <para>
        <table>
        <title>The elements of the pool</title>
        <tgroup cols="3">
        <thead><row><entry>Element name</entry><entry>Sample Image</entry><entry>Signification</entry></row></thead>
        <tbody>
          <row>
            <entry>map</entry><entry><mediaobject><imageobject><imagedata fileref="map.png" format="PNG"/></imageobject></mediaobject></entry><entry>Map of the skins's world. Countries can have arbitrary shapes, but should be grouped in eye-recognizable continents, by location only or by color</entry>
          </row>
          <row>
            <entry>italy</entry><entry><mediaobject><imageobject><imagedata fileref="italy.png" format="PNG"/></imageobject></mediaobject></entry><entry>The flag of the Italy nation. There is one such entry for each nation</entry>
          </row>
          <row>
            <entry>infantry</entry><entry><mediaobject><imageobject><imagedata fileref="infantry.png" format="PNG"/></imageobject></mediaobject></entry><entry>Icon representing one army</entry>
          </row>
          <row>
            <entry>cavalry</entry><entry><mediaobject><imageobject><imagedata fileref="cavalry.png" format="PNG"/></imageobject></mediaobject></entry><entry>Icon representing five armies</entry>
          </row>
          <row>
            <entry>cannon</entry><entry><mediaobject><imageobject><imagedata fileref="cannon.png" format="PNG"/></imageobject></mediaobject></entry><entry>Icon representing ten armies</entry>
          </row>
          <row>
            <entry>firing</entry><entry><mediaobject><imageobject><imagedata fileref="firing.png" format="PNG"/></imageobject></mediaobject></entry><entry>Icon representing armies during a fight</entry>
          </row>
          <row>
            <entry>exploding</entry><entry><mediaobject><imageobject><imagedata fileref="exploding.png" format="PNG"/></imageobject></mediaobject></entry><entry>Icon representing armies when losing a fight</entry>
          </row>
          <row>
            <entry>Alaska</entry><entry><mediaobject><imageobject><imagedata fileref="alaska.png" format="PNG"/></imageobject></mediaobject></entry><entry>The shape of the Alaska country. This is used to highligth the country. There is one such shape for each country. Its color is not used. As such, the color is free.</entry>
          </row>
          <row>
            <entry>reddices</entry><entry><mediaobject><imageobject><imagedata fileref="reddices.png" format="PNG"/></imageobject></mediaobject></entry><entry>The red dices used to show battles results</entry>
          </row>
          <row>
            <entry>bluedices</entry><entry><mediaobject><imageobject><imagedata fileref="bluedices.png" format="PNG"/></imageobject></mediaobject></entry><entry>The blue dices used to show battles results</entry>
          </row>
          <row>
            <entry>mark1</entry><entry><mediaobject><imageobject><imagedata fileref="mark1.png" format="PNG"/></imageobject></mediaobject></entry><entry>This mark is added to fighting sprites to show the number of armies they represent, here 1. There is also a mark2 and a mark3 elements.</entry>
          </row>
        </tbody>
        </tgroup>
        </table>
        </para>
      </sect3>
      <sect3>
        <title>The map-mask.png file</title>
        <para>
          This is a png file representing also the map of the skins's world, but with coded colors that allows one to identify uniquely each country. Countries must have at least the same shapes as the corresponding countries on the map.png file so that users can click anywhere in a viewable country and select the good one. Countries, like little islands as Indonesia in the default map can be greater than the equivalent in the map.png file to facilitate the selection of the country.
          <mediaobject>
            <imageobject><imagedata fileref="map-mask.png" format="PNG"/></imageobject>
            <textobject><phrase>A sample map-mask</phrase></textobject>
          </mediaobject>
        </para>
        <para>
          The blue component (in RGB model) of a country's color identifies the country: index 0 is country 0 in the onu.xml file, index 1 is country 1, &etc;. White (0xFFFFFF in RGB) identifies the absence of country (sees or, why not, no man's lands).
        </para>
      </sect3>
      <sect3>
        <title>The buttons images</title>
        <para>The filenames are hard-coded in the code, so they should not be modified. The table below shows all the buttons that should be provided.</para>
        <table>
        <title>The buttons of the &GUI;</title>
        <tgroup cols="3">
        <thead><row><entry>Image</entry><entry>Filename</entry><entry>Signification</entry></row></thead>
        <tbody>
          <row>
            <entry><mediaobject><imageobject><imagedata fileref="newNetGame.png" format="PNG"/></imageobject></mediaobject></entry><entry>newNetGame.png</entry><entry>Tries to join a network game</entry>
          </row>
          <row>
            <entry><mediaobject><imageobject><imagedata fileref="recycling.png" format="PNG"/></imageobject></mediaobject></entry><entry>recycling.png</entry><entry>After all players have put their armies, it is possible to modify the distributions (named recycling). This button asks to do such a redistribution</entry>
          </row>
          <row>
            <entry><mediaobject><imageobject><imagedata fileref="recyclingFinished.png" format="PNG"/></imageobject></mediaobject></entry><entry>recyclingFinished.png</entry><entry>Chooses not to redistribute. All clients windows must have this button clicked to really end the distribution</entry>
          </row>
          <row>
            <entry><mediaobject><imageobject><imagedata fileref="nextPlayer.png" format="PNG"/></imageobject></mediaobject></entry><entry>nextPlayer.png</entry><entry>Ends the current player's turn and switch to the next one or to the next turn if the current player was the last one</entry>
          </row>
          <row>
            <entry><mediaobject><imageobject><imagedata fileref="attackOne.png" format="PNG"/></imageobject></mediaobject></entry><entry>attackOne.png</entry><entry>Chooses to start an attack with one army</entry>
          </row>
          <row>
            <entry><mediaobject><imageobject><imagedata fileref="attackTwo.png" format="PNG"/></imageobject></mediaobject></entry><entry>attackTwo.png</entry><entry>Chooses to start an attack with two armies</entry>
          </row>
          <row>
            <entry><mediaobject><imageobject><imagedata fileref="attackThree.png" format="PNG"/></imageobject></mediaobject></entry><entry>attackThree.png</entry><entry>Chooses to start an attack with three armies</entry>
          </row>
          <row>
            <entry><mediaobject><imageobject><imagedata fileref="defendOne.png" format="PNG"/></imageobject></mediaobject></entry><entry>defendOne.png</entry><entry>Chooses to defend an attacked country with one army</entry>
          </row>
          <row>
            <entry><mediaobject><imageobject><imagedata fileref="defendTwo.png" format="PNG"/></imageobject></mediaobject></entry><entry>defendTwo.png</entry><entry>Chooses to defend an attacked country with two armies</entry>
          </row>
          <row>
            <entry><mediaobject><imageobject><imagedata fileref="moveArmies.png" format="PNG"/></imageobject></mediaobject></entry><entry>moveArmies.png</entry><entry>Chooses to start the moving of armies between two countries (last action in the turn)</entry>
          </row>
        </tbody>
        </tgroup>
        </table>
      </sect3>
    </sect2>
    <sect2 id="tsd">
      <title>The Sounds folder</title>
      <para>This folder contains three sound files:</para>
      <itemizedlist><listitem><para>roll.wav played when armies are moving </para></listitem>
      <listitem><para>cannon.wav played when firing and </para></listitem><listitem>
      <para>crash.wav played when a cannon explodes</para></listitem></itemizedlist>
    </sect2>
  </sect1>
  <sect1 id="using-kse">
    <title>Using the &kappname;</title>
    <para>After creating the graphics in the right folder and SVG file, you just have to create countries, players, etc. and associate them with the right SVG element in the pool. This can be done with the &kappname;. Note that each part of this application is auto-described by tooltips and contextual help usualy reachable through the Ctrl+F1 shortcut.</para>
    <para>
      <screenshot>
        <screeninfo>Here's a screenshot of &kappname;</screeninfo>
        <mediaobject>
          <imageobject>
            <imagedata fileref="main-snapshot.png" format="PNG"/>
          </imageobject>
          <textobject>
            <phrase>Screenshot</phrase>
          </textobject>
        </mediaobject>
      </screenshot>
    </para>
  </sect1>
</chapter>



<chapter id="commands">
<title>Command Reference</title>

<sect1 id="kapp-mainwindow">
<title>The main &kappname; window</title>
<sect2>
<title>The buttons</title>
<para>
<variablelist>
  <varlistentry>
    <term>
        <inlinemediaobject>
          <imageobject>
            <imagedata fileref="load.png" format="PNG"/>
          </imageobject>
          <textobject>
            <phrase>Load</phrase>
          </textobject>
        </inlinemediaobject>
      <guibutton>Load</guibutton>
    </term>
    <listitem><para><action>Causes the program to load an existing skin.</action></para>
    </listitem>
  </varlistentry>
  <varlistentry>
    <term>
        <inlinemediaobject>
          <imageobject>
            <imagedata fileref="save.png" format="PNG"/>
          </imageobject>
          <textobject>
            <phrase>Save</phrase>
          </textobject>
        </inlinemediaobject>
      <guibutton>Save</guibutton>
    </term>
    <listitem>
      <para><action>Saves the currently edited skin</action></para>
    </listitem>
  </varlistentry>
</variablelist>
</para>

</sect2>

</sect1>
</chapter>

<chapter id="developers">
  <title>Developer's Guide to &kappname;</title>
  
  <para>
    Please refer to <ulink url="http://api.kde.org/">http://api.kde.org/</ulink> for the documentation of the API.
  </para>
</chapter>

<chapter id="faq">
<title>Questions and Answers</title>

&updating.documentation;

</chapter>

<chapter id="credits">

<!-- Include credits for the programmers, documentation writers, and
contributors here. The license for your software should then be included below
the credits with a reference to the appropriate license file included in the KDE
distribution. -->

<title>Credits and License</title>

<para>
&kappname;
</para>
<para>
Program copyright 2009 Gael de Chalendar <email>kleag@free.fr</email>
</para>

<para>
Documentation copyright 2009 Gael de Chalendar <email>kleag@free.fr</email>
</para>

<!-- TRANS:CREDIT_FOR_TRANSLATORS -->

&underFDL;               <!-- FDL: do not remove. Commercial development should -->
<!-- replace this with their copyright and either remove it or re-set this.-->

<!-- Determine which license your application is licensed under,
     and delete all the remaining licenses below:

     (NOTE:  All documentation are licensed under the FDL,
     regardless of what license the application uses) -->

&underGPL;           <!-- GPL License -->

</chapter>

<appendix id="installation">
<title>Installation</title>

<sect1 id="getting-ksirk">
<title>How to obtain &kappname;</title>
&install.intro.documentation;
</sect1>

<sect1 id="compilation">
<title>Compilation and Installation</title>
&install.compile.documentation;
</sect1>


</appendix>

&documentation.index;
</book>
<!--
Local Variables:
mode: sgml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
-->













