Make a theme

From X-Moto
Revision as of 16:44, 24 August 2006 by Nadenislamarre (talk | contribs) (Add a theme entry)
Jump to: navigation, search

Introduction

Since X-Moto 0.2.0, it is possible to make new themes and add new sprites/textures easily. You can remake all the graphics of the game.

A theme is composed of an xml file and of pictures files. The xml file give information about the theme and gives name of the file to use for each component as described bellow.

Pictures must be squares and their sizes must be a power of 2 (64x64, 128x128, 256x256)
Pictures larger than 50Ko will not be accepted
Pictures must be png or jpg
Pictures must be GPL

Make a new theme

To create a theme, you should start by copying an existing one. If you update your themes in the game, you will found some theme files in the dir Themes in ~/.xmoto (UNIX) or in your install dir (Windows). A theme file looks like this :

<?xml version="1.0" encoding="utf8" ?>
<xmoto_theme name="Classic">
<sprite type="BikerPart" name="PlayerBikerBody"  file="Body1.png" />
<sprite type="BikerPart" name="PlayerBikerFront" file="Front1.png" />
...
</xmoto_theme>
  • First, copy an existing theme as a new file
  • Open the theme and change the theme name by a new one (replace "Classic" by "My Theme")

Congratulation ! You made your first theme which is simply a copy of an existing one. Now, you can try to modify or add new entries.

Currently, it's not possible to send your new themes via the website ; use the message tab and give your email to contact us if you want to make your theme downloadable by other players.

Theme entries

A theme entry is a line that explains to the game where can be found a picture for a given sprite. A sprite has a type (BikerPart, Texture, Entity, Effect, Font, Misc, UI) ; for each type, there could have some parameters. Moreover, a sprite has a name and some values to define the path of the picture.

Some sprite names are define in the game, for example, "PlayerBikerBody" is the name of the sprite of the biker body. But some new sprite can be define like textures or entities.

Sprites are found in the Textures dir on a subdirectory depending on the sprite type :

Sprite type Directory
BikerPart Textures/Riders
Texture Textures/Textures
Entity Textures/Sprites (or Textures/Sprites/Anims if it's an animation)
Effect Textures/Effects
Font Textures/Fonts
Misc Textures/Misc
UI Textures/UI
Existing sprites file are available at  http://xmoto.free.fr/sprites/Textures

Modify a theme entry

Just modify the parameters (if you want) and the file parameter : give the name of your new file.

Add a theme entry

Copy and paste an existing entry of same sprite type. Change the name parameter, and give a file parameter.

Test your theme

Since xmoto 0.2.1, you can test your theme by launching xmoto with the -testTheme option. It helps you to found if your theme respects the collision areas.

TestTheme.jpg