Make a theme

From X-Moto
Jump to: navigation, search

Català - Español - Français - Norsk

Introduction

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

A theme is composed of an xml file and of pictures and audio 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
Audio files must be ogg or wav files

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 home dir in the .xmoto directory (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" />
...
<music name="menu1" file="menu.ogg" />
<sound name="Headcrash" file="Headcrash.ogg" />
...
</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 an image for a given sprite can be found. A sprite has a type (BikerPart, Texture, Entity, Effect, Font, Misc, UI); for each type, there may be parameters. Moreover, a sprite has a name and some values to define the path of the picture.

Some sprite names are defined in the game, for example, "PlayerBikerBody" is the name of the sprite of the biker body, but a new sprite can also be defined as 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

You can also modify music and sound elements and place new audio files into the Textures/Musics and Textures/Sounds directories.

Existing sprites are available at http://xmoto.tuxfamily.org/index.php?page=all_sprites

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

Note that with X-Moto 0.3.0, you will have to press F5 in the main menu to make X-Moto recognize the updated theme! Or you could just press F10 to switch to the test theme mode.

TestTheme.jpg