Difference between revisions of "How to create smooth levels using Inkscape"

From X-Moto
Jump to: navigation, search
(Block properties)
(Zone properties)
Line 89: Line 89:
;For example: typeid=Zone
;The only possible value for a zone: typeid=Zone
== Generate level file ==
== Generate level file ==

Revision as of 18:41, 16 August 2006

Required softwares

  • Inkscape (>= 0.43)
  • Python (>= 2.4)
  • Svg2lvl converter (available in xmoto cvs)
$ cvs -z3 -d:pserver:anonymous@xmoto.cvs.sourceforge.net:/cvsroot/xmoto co -P xmoto/tools/svg2lvl/

Draw the level

Open Inkscape.


You're ready to draw your level using Inskcape. See Inskcape howto's from the help menu.


Transform all objects into paths

Inskcape deals with its own shapes like stars, circles, ... so you have to convert them to path of vertex.

Disclaimer: don't put objects properties before transforming them to paths ! Else properties will be lost... Inkscape remove them.

First, select the object, Inskcape-obj.png

Then, Shift+Ctrl+C (or use the menu)


And you got a path of vertex


Repeat this process for every inskcape shape (rectangle, circle, star, ...)

Level objects properties

Once your level is drawn, you have to put entities, blocks and sprites properties. Select an object, right click on it, then select 'object properties'.


Properties are put inside the 'label' box. They are seperate with a '|'. If no properties are set, then the object is put as a block with default texture. You can also fill the 'id' box, it's useful if you write a lua script for the level, because you got the blocks, zones and entities names to use in your script.

Block properties

  • background
  • dynamic
  • usetexture=texture_name


A background block (it's a block in the background and the player can't interact with it) using the Dark Dirt texture:


A dynamic block using the default texture:


A block using the default texture:

(you have nothing to put in, let it blank (or let what inkscape puts in it))

A block using the Dark Dirt texture:


Entity properties

  • typeid=[PlayerStart|EndOfLevel|Strawberry|Wrecker|ParticleSource|Sprite]
  • size=float_number (the entity colision radius)
  • param_name=param_value available params name are (there's more of them):
    • z (for Sprite)
    • name (for Sprite)
    • style (for every entity)
    • type (for ParticleSource)
For example

Zone properties

  • typeid=Zone
The only possible value for a zone

Generate level file

Inkscape works with bezier curves, but the converter only use vertex, so you have to smooth objects. Press F2 to select the appropriate tool then select an object. It's not having much vertex. Press Ctrl+A to select every vertex. Then press the '+' button (see screenshot)


Press the '+' button until you got enough vertex for the object to be smooth.


Repeat that for EVERY objects that have to be smooth blocks in the game (no need to do that for objects which'll be entities or zones)

launch the converter

Yes you have to use the command line. To make it easier, put you svg file inside the same directory than your python source files (also put your lua script file if your level have any)

$ python svg2lvl.py level.svg 100 level.lvl [level.lua]

Params are:

  • svg file
  • level scale (the bigger this value, the bigger the resulting level will be, play with it until you find the right value for your level)
  • lvl file
  • lua script file (optional)

Then, put your lvl generated file into your xmoto Levels directory, and you can play it:


Files used in this howto