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

From X-Moto
Jump to: navigation, search
(Inksmoto Level Editor versions)
 
(20 intermediate revisions by 7 users not shown)
Line 1: Line 1:
[[Ca:Inkscape|Català]]
+
[[Ca:Inkscape|Català]] - [[Es:Inkscape|Español]] - [[Das Erstellen eines Levels mit Inkskape|Deutsch]]
  
----
+
==svg2lvl changes its name, it's now called: '''Inksmoto Level Editor'''==
  
'''Caution: this software is still in development.'''
+
=Inksmoto Level Editor versions=
'''Please report bugs on the irc.'''
 
  
----
+
Use the documentation appropriate to your version of Inksmoto Level Editor
  
=Required softwares =
+
* [[Inksmoto-0.6.0| Old version (0.6.0)]]
 +
* [[Inksmoto-0.7.0| Actual version (0.7.0)]]
 +
* [[Inkscape-dev|Developpement version]]
  
* [http://www.inkscape.org/ Inkscape] (>= 0.44)
+
=Short description about the new Inksmoto Level Editor=
* [http://www.python.org/ Python] (>= 2.4) (not required under Windows, it's included with Inkscape)
 
* Svg2lvl converter  and inkscape extension
 
**current version available from [http://xmoto.free.fr/ http://xmoto.free.fr/]
 
**developpement version available in xmoto cvs with:
 
$ cvs -z3 -d:pserver:anonymous@xmoto.cvs.sourceforge.net:/cvsroot/xmoto co -P xmoto/tools/svg2lvl/
 
  
= Pre-requesites =
+
Inksmoto Level Editor is the new xmoto level editor. It uses [http://www.inkscape.org Inkscape] to draw levels, then it allows you to save your drawing as a xmoto level (.lvl file). It also allow you to edit xmoto level properties from within [http://www.inkscape.org Inkscape] such as make background block, strawberries, wreckers, end of level, checkpoints, etc.
  
You have to install the svg2lvl inkscape extension.
+
Inksmoto Level Editor is written in [http://www.python.org/ Python], it's an [http://www.inkscape.org Inkscape] extension.
 
 
== GNU/Linux ==
 
 
 
===Current version installation ===
 
 
 
We suppose that you have downloaded the svg2lvl-*.tar.gz archive into ~/download/
 
 
 
You have to change the '*' with the version of svg2lvl you have download (for example 0.2.0)
 
 
 
$ cd ~/download/
 
$ tar zxvf svg2lvl-*.tar.gz
 
$ cd svg2lvl-*
 
$ mkdir -p ~/.inkscape/extensions/
 
$ cp *.inx *.py ~/.inkscape/extensions/
 
$ ln -s /usr/share/inkscape/extensions/bezmisc.py ~/.inkscape/extensions/bezmisc.py
 
$ ln -s /usr/share/inkscape/extensions/inkex.py ~/.inkscape/extensions/inkex.py
 
 
 
Then, you can launch inkscape.
 
 
===CVS installation===
 
 
 
We suppose that you have do the cvs checkout to ~/xmoto-cvs/
 
 
 
$ cd ~/xmoto-cvs/
 
$ cd xmoto/tools/svg2lvl/
 
$ mkdir -p ~/.inkscape/extensions/
 
$ cp *.inx *.py ~/.inkscape/extensions/
 
$ ln -s /usr/share/inkscape/extensions/bezmisc.py ~/.inkscape/extensions/bezmisc.py
 
$ ln -s /usr/share/inkscape/extensions/inkex.py ~/.inkscape/extensions/inkex.py
 
 
 
Then, you can launch inkscape.
 
 
 
== Windows ==
 
 
 
Extract the svg2lvl-*.tar.gz archive you have downloaded with your preferred extraction tool (unrar, 7-zip, ...).
 
Go to the share/extensions/ directory inside your Inkscape installation. Copy the .py and .inx files from the archive into that directory.
 
 
 
Then, launch inkscape.
 
 
 
==Test if the installation is ok==
 
 
 
*Check in the 'Effects' menu that there is an entry 'X-moto'
 
*Do 'Save as...' (Shift-Ctrl-S), and check that you can select the 'X-Moto Level (*.lvl)' file format.
 
 
 
If the installation is not ok, please go to the IRC so we can help you find out why it failed.
 
 
 
= Draw the level =
 
 
 
Open Inkscape.
 
 
 
[[Image:inkscape-empty.png]]
 
 
 
----
 
 
 
You're ready to draw your level using Inskcape. See Inskcape howto's from the help menu.
 
 
 
[[Image:inskcape-drawn.png]]
 
 
 
You no longer have to transform all objects into paths. The svg2lvl script handles that itself.
 
 
 
= Put level objects properties =
 
 
 
Once your level is drawn, you have to put entities, blocks and sprites properties.
 
 
 
There is two ways of doing it. Manually or using inkscape ''effects''.
 
 
 
==Using inkscape Effects==
 
 
 
The easiest way to change objects properties.
 
 
 
Select the objets whose you want to change their properties. Then go to the ''Effect'' menu and choose the ''X-moto'' sub-menu. From there you got other sub-menus to transform your objects into the desired type (Zones, Blocks and Entities).
 
 
 
Depending on the object type, its color changes. Colors are pretty ugly for the moment... but feel free to give idea about which colors could suit better. Adding a texture edge to a block adds an ugly green edge to the block in inkscape.
 
 
 
(Info: It just updates the object label (see next section for a better description)).
 
 
 
----
 
 
 
For example, we want to change the circle into a dynamic block using the texture '''Texture1''' (it's a fake one, it doesn't exists). (Note that you can select more than one object at a time). First, we select the right entry in the ''X-moto'' submenu.
 
 
 
[[Image:Effect-inkscape.png]]
 
 
 
Then we put the texture name
 
 
 
[[Image:Effect-param.png]]
 
 
 
And here is the result. To see it, right click on an object then select ''object properties''.
 
 
 
[[Image:Effect-result.png]]
 
 
 
==Edit Manually==
 
 
 
The other way to change objects properties.
 
 
 
Select an object, right click on it, then select 'object properties'.
 
 
 
[[Image:inskcape-properties.png]]
 
 
 
----
 
 
 
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.
 
 
 
WARNING : properties are case sensitive ! Write them with the exact case as show below.
 
 
 
===Block properties===
 
* background
 
* dynamic
 
* usetexture=texture_name
 
* edgeTexture=edge_texture_name
 
* physics:grip=grip_value
 
 
 
====Examples====
 
 
 
A background block (it's a block in the background and the player can't interact with it) using the Dark Dirt texture:
 
 
 
background|usetexture=DarkDirt
 
 
 
A dynamic block using the default texture:
 
 
 
dynamic
 
 
 
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:
 
 
 
usetexture=DarkDirt
 
 
 
A dynamic block with grass on it and the Bricks texture
 
 
 
usetexture=Bricks|dynamic|edgeTexture=Grass
 
 
 
A block using the Dark Dirt texture and which grips like ice (grip values range is [1.0 - 50.0], the default value is 20.0. The smallest the value, the less grip is the block)
 
 
 
usetexture=DarkDirt|physics:grip=1.0
 
 
 
===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====
 
 
 
A particle source throwing smoke:
 
 
 
typeid=ParticleSource|type=Smoke
 
 
 
A strawberry:
 
 
 
typeid=Strawberry
 
 
 
A tree sprite put under foreground blocks
 
 
 
typeid=Sprite|name=Tree1|z=-1
 
 
 
Player start:
 
 
 
typeid=PlayerStart
 
 
 
End of level:
 
 
 
typeid=EndOfLevel
 
 
 
===Zone properties===
 
*typeid=Zone
 
 
 
;The only possible value for a zone: typeid=Zone
 
 
 
= Generate level file =
 
 
 
You no longer have to add many vertex, the script handles that itself !
 
 
 
DISCLAIMER : Save you level in svg format too.
 
.lvl is a loosy format, you'll loose informations about bezier curves,
 
because there are remplaced with many vertex.
 
Furthermore, inkscape can't open .lvl files (feel free to send a patch to correct this).
 
 
 
==Launch the converter==
 
 
 
In order to save your level in the .lvl file format, use the menu ''File -> Save as...'' (or use Shift-Ctrl-S) and choose the ''X-Moto Level'' file extension, put the level file name then press ''Save''.
 
 
 
[[Image:Save-as.png]]
 
 
 
A new window pops, you have to put:
 
 
 
* level width : the level width in xmoto unit. play with it until you find the right value for your level
 
* smoothitude : the higher the value, the smoothest the level. But don't add to much vertex, because xmoto doesn't scale very well with big levels made with thousands of vertex... and became quite slow...
 
* lua script  : the absolute path to your lua script (leave blank if your level doesn't have a lua script)
 
* level id    : the level id (each level got a unique one)
 
* level name: the name of the level in the level list
 
* author: your name/pseudo
 
* description: short description of the level
 
* sky: the sky you want to use with your level
 
* rversion: the minimum xmoto version required to play this level (default to 0.2.0).
 
 
 
The rversion depends on the lua scripts functions you're using. (see [[Scripted_levels]] for a list of lua functions and the xmoto version where they are available)
 
 
 
Then your level file will be save in the place you choose in the ''Save as...'' window.
 
 
 
Disclaimer: There's a bug in Inkscape. The very first time you save a level in lvl, put something into the ''lua script'' box (default: None). Else Inkscape will abort...
 
 
 
[[Image:Script-params.png]]
 
 
 
Then, put your lvl generated file into your xmoto Levels directory, and you can play it (see how the grass is only added on the upper side of the block):
 
 
 
[[Image:Sample-level-editor.png|level in the editor]]
 
 
 
[[Image:sample-level.jpg|thumb|Our level in X-Moto]]
 
 
 
The script add a log file svg2lvl.log into your home directory.
 
 
 
== Files used in this howto==
 
 
 
*svg file: [[Media:sample.svg]]
 
*lvl file: [[Media:sample.lvl]]
 

Latest revision as of 22:47, 22 May 2013

Català - Español - Deutsch

svg2lvl changes its name, it's now called: Inksmoto Level Editor

Inksmoto Level Editor versions

Use the documentation appropriate to your version of Inksmoto Level Editor

Short description about the new Inksmoto Level Editor

Inksmoto Level Editor is the new xmoto level editor. It uses Inkscape to draw levels, then it allows you to save your drawing as a xmoto level (.lvl file). It also allow you to edit xmoto level properties from within Inkscape such as make background block, strawberries, wreckers, end of level, checkpoints, etc.

Inksmoto Level Editor is written in Python, it's an Inkscape extension.