Difference between revisions of "Inksmoto-0.7.0"

From X-Moto
Jump to: navigation, search
(Editing the Inkscape launcher script)
(NEW: Inksmoto 0.7.0 for Inkscape 0.46-0.48.2)
Line 112: Line 112:
  
 
Download XQuartz: http://xquartz.macosforge.org
 
Download XQuartz: http://xquartz.macosforge.org
 
==NEW: Inksmoto 0.7.0 for Inkscape 0.46-0.48.2==
 
 
There is a another way to have Inksmoto 0.7.0 for Mac OS X. This time, you still need MacPorts, and a Inkscape binary .dmg
 
  
 
=MacPorts Installation=
 
=MacPorts Installation=

Revision as of 21:02, 5 May 2013

About

The Inksmoto level editor is implemented as an extension to Inkscape, an Open Source vector graphics editor.

Even if the application windows changed, there's still plenty of stuffs from the 0.4.1, 0.5.1 and 0.6.0 tutorials which applies to the 0.7.0 version, check them out:

Installation

Required softwares

The 0.7.0 version of Inksmoto requires Inkscape 0.46 or 0.47.

   * inkscape (>=0.46)
   * python (>=2.5) (tested on 2.5)
   * python-lxml
   * python-gtk2
   * libglade2
   * Inksmoto 0.7.0

Installation on Windows

Just download and execute this executable: http://download.tuxfamily.org/xmoto/svg2lvl/0.7.0/Inkscape-0.47.1_inksmoto-0.7.0_win32.exe

Installation on Linux

Ubuntu

Under Debian/Ubuntu, you can use this .deb file to install Inksmoto with the command line or graphically:

  • Command line:
wget http://download.tuxfamily.org/xmoto/svg2lvl/0.7.0/inksmoto-0.7.0.deb 
sudo dpkg -i inksmoto-0.7.0.deb

Warning: If you have previously installed the svn version in your home dir, you should better delete it:

rm -rf ~/.inkscape/extensions

Other Linuxes

Install the prerequisites first then install Inksmoto:

cd ~
wget http://download.tuxfamily.org/xmoto/svg2lvl/0.7.0/inksmoto-0.7.0.tar.gz
cd /usr/share/inkscape
sudo tar zxvf ~/inksmoto-0.7.0.tar.gz

Warning: If you have previously installed the svn version in your home dir, you should better delete it:

rm -rf ~/.inkscape/extensions

Installation on Mac OS X

  • Note There is no .pkg or .dmg file for Inksmoto 0.7.0 on Mac OS X.We have encounter some issues while doing it with package installers. In the future, we hopefully will get it fixed. We will have to do it the MacPorts way. The next version of Inkscape 48.4 for OS X will have py27-pygtk packaged with it. So, we will be using that version once its been released. Inkscape 48.4 will not run on X11/XQuartz, but GTK+ Quartz backend. So, once its released, you will not have to download and install X11/XQuartz.

Inksmoto 0.7.0 will work on Mac OS X Tiger, Leopard, Snow Leopard, Lion, and Mountain Lion. You will need to download MacPorts, choose the one for your right software.

  • For Mac OS X 10.4 Tiger:

https://distfiles.macports.org/MacPorts/MacPorts-2.1.3-10.4-Tiger.dmg

  • For Mac OS X 10.5 Leopard:

https://distfiles.macports.org/MacPorts/MacPorts-2.1.3-10.5-Leopard.dmg

  • For Mac OS X 10.6 Snow Leopard:

https://distfiles.macports.org/MacPorts/MacPorts-2.1.3-10.6-SnowLeopard.pkg

  • For Mac OS X 10.7 Lion:

https://distfiles.macports.org/MacPorts/MacPorts-2.1.3-10.7-Lion.pkg

  • For Mac OS X 10.8 Mountain Lion:

https://distfiles.macports.org/MacPorts/MacPorts-2.1.3-10.8-MountainLion.pkg

Next, is to run terminal, and type in:

$ sudo port install inkscape

This is will download and install Inkscape 48.4

Once its done, you need to type:

$ sudo port install python27

This command will download and install Python 2.7

Next, is to type:

$ sudo port install py27-pygtk

This will install PyGTK and GTK+ dependices

Next, you need to grab the Inksmoto 0.7.0 extensions from the website:

http://download.tuxfamily.org/xmoto/svg2lvl/0.7.0/inksmoto-0.7.0.tar.gz

Unzip the tar.gz file with Archive Utility, and the extensions folder will pop up in your Downloads folder.

Next, is to open the Inkscape extensions folder by typing:

$ open `inkscape -x`

Next is to copy all of the extracted extensions directory, into the Inkscape extensions folder.

Finally, to open the Inkscape program, type in:

$ inkscape

This will open Inkscape program.*Warning You need have XQuartz installed, for it to be able to work.

Download XQuartz: http://xquartz.macosforge.org

MacPorts Installation

MacPorts will work for OS X Tiger 10.4 and higher. Download and install the right version for your right Mac OS X version.

MacPorts for Mac OS X 10.4 Tiger: https://distfiles.macports.org/MacPorts/MacPorts-2.1.3-10.4-Tiger.dmg

MacPorts for Mac OS X 10.5 Leopard: https://distfiles.macports.org/MacPorts/MacPorts-2.1.3-10.5-Leopard.dmg

MacPorts for Mac OS X 10.6 Snow Leopard: https://distfiles.macports.org/MacPorts/MacPorts-2.1.3-10.6-SnowLeopard.pkg

MacPorts for Mac OS X 10.7 Lion: https://distfiles.macports.org/MacPorts/MacPorts-2.1.3-10.7-Lion.pkg

Install MacPorts.

Getting .dmg of Inkscape

This will work between Inkscape versions 0.46-0.48.2

Inkscape 0.46 for Mac OS X 10.4 Tiger Universal: http://sourceforge.net/projects/inkscape/files/inkscape/0.46/Inkscape-0.46-3.TIGER.UNIVERSAL.dmg/download

Inkscape 0.47 for Mac OS X 10.5 Leopard Universal(If you are lower the 10.5.8): http://sourceforge.net/projects/inkscape/files/inkscape/0.47/Inkscape-0.47-1.LEOPARD%2B.dmg/download

Inkscape 0.48.2 for Mac OS X 10.5 Leopard(If you are on 10.5.8 or higher), 10.6 Snow Leopard, 10.7 Lion, and 10.8 Mountain Lion Universal: http://sourceforge.net/projects/inkscape/files/latest/download?source=files

There is more Inkscape versions on sourceforge if you want to get more versions, just make sure you get the right version for your right software: http://sourceforge.net/projects/inkscape/files/inkscape/

Put Inkscape.app into your Applications folder, to install it.

Now, we got MacPorts and Inkscape installed, we need to install the dependencies for it.

Installing dependencies using MacPorts

Here is the list of dependencies that we need:

Python 2.7
lxml for Python 2.7
PyGtk for Python 2.7
Gtk theme switch
Gnome themes

To install all of them at once, simply launch the Terminal app, and type in:

sudo port install python27 py27-pygtk py27-lxml gtk-theme-switch gnome-themes

Installing Inksmoto 0.7.0

After you install those, get the Inksmoto 0.7.0 extensions here: http://download.tuxfamily.org/xmoto/svg2lvl/0.7.0/inksmoto-0.7.0.tar.gz

Extract it, and drag everything in the extracted extensions directory, into the Inkscape extensions folder.

/Applications/Inkscape.app/Contents/Resources/extensions/

Editing the Inkscape launcher script

Inkscape has its own version of python. We need to let Inkscape launch with the system python. We simply need to edit the Inkscape launcher script. To do that, go to here:

/Applications/Inkscape.app/Contents/Resources/bin/Inkscape terminal file

Right click or ctrl click on the Inkscape terminal file, and open with any kind of text editing program(TextEdit for example).

Find line 28 that says:

export PATH="/usr/bin:$PATH"

Replace that with:

export PATH="$CWD:$PATH:/usr/bin"

Then save the file. We just made Inkscape launch with system python, instead of using Inkscape's own version of python.

Makeing a new python command file

Now we need to make a python command file with any kind of text editing program(TextEdit for example...again).

Make a new file, and copy/paste this link of the line of code into the text file:

#!/bin/sh
# unset env used in Inkscape.app
unset PYTHONHOME
unset DYLD_LIBRARY_PATH
unset FONTCONFIG_PATH
unset PANGO_RC_FILE
unset GTK_IM_MODULE_FILE
unset GDK_PIXBUF_MODULE_FILE
unset GTK_DATA_PREFIX
unset GTK_EXE_PREFIX
unset GNOME_VFS_MODULE_CONFIG_PATH
unset GNOME_VFS_MODULE_PATH
unset MAGICK_CONFIGURE_PATH
unset MAGICK_CODER_FILTER_PATH
unset MAGICK_CODER_MODULE_PATH
unset ASPELL_CONF
unset XDG_DATA_DIRS
# set locale (language) explicitly
export LANG="en_US.UTF-8"
exec /opt/local/bin/python "$@"

Test if the installation is ok

There is a couple of ways to make sure that the Inksmoto extensions is installed correctly.

  • 1st way: Check in the 'Effects' menu that there is an entry 'X-moto'
  • 2nd way: 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 X-Moto chat so we can help you find out why it failed.

Tutorial: First steps

This part of the tutorial learns the basics to be able to create a level.

Quick look at inkscape

Inksmoto 060 01.png

Here is the list of useful tools from Inkscape to create Xmoto levels:

  1. The selection tool
  2. The path editing tool
  3. The sculpting tool
  4. The zoom in/out tool
  5. The rectangle tool
  6. The circle tool
  7. The star tool
  8. The hand draw tool
  9. The bezier curves draw tool
  10. The Xmoto properties menu

To learn how to use Inkscape you can use the official Inkscape tutorials: Inkscape2.png

You can also get tutorials on YouTube.

The Xmoto extensions

The Xmoto extensions from the Effects menu allows you to set Xmoto properties to Inkscape objects in the drawing.

Here is a description of the different entries of the Xmoto menu:

  • Blocks
    • Change Block Properties: Change the properties of the selected blocks.
    • Change Block Texture: Change the texture and edge effects of the selected blocks.
  • Entities
    • Checkpoint: Convert the selected shapes into a checkpoint.
    • Strawberry: Convert the selected shapes into a strawberry.
    • End of level: Convert the selected shapes into a end of the level.
    • Particle Source: Convert the selected shapes into a particle source (fire or smoke).
    • Player Start: Convert the selected shapes into the start position of the player.
    • Sprite: Convert the selected shapes into a sprite (with many parameters for the sprite).
    • Wrecker: Convert the selected shapes into a wrecker.
  • Joint
    • Add Pin Joint: add a pin joint between two physical blocks.
    • Add Pivot Joint: add a pivot joint between to physical blocks.
    • Jointed Line...: create a line of jointed blocks
  • Level
    • Set layers properties: Set which layers are for background and what are their scrolling parameters.
    • Set sky properties: Change the sky of the level.
    • Set level properties: Mandatory options for the level, like its name and id.
    • Set other level properties: Allow sprite replacement of the /strawberry/wrecker/end of level/. Add a music to the level.
  • Other
    • Install keyboard shortcuts: Install the Inksmoto specific shortcuts.
    • Inksmoto tutorial: Display the link of this tutorial on the wiki.
    • Launch level in X-Moto: Launch the level in Xmoto.
    • Show the object informations: Show the Xmoto properties of the selected shapes.
    • Get new textures and sprites: Download new textures and sprites from the Internet.
    • Recreate last.lvl: Recreate the last.lvl level to reload it into Xmoto.
    • Copy: Copy the xmoto properties of an object.
    • Paste: Paste the xmoto properties stored into the selected objects.
    • Change id: Change the id of an element (mandatory use for entities).
    • Begin recording a trace session: For unittesting.
    • End recording a trace session: For unittesting (the generated tests are in ~/.inkscape/extensions/cur_tests).
  • Zones
    • Convert into Zone: Convert the selected shapes into zones (currently, only rectangular zones are used).

Install the Inksmoto shortcuts

You should begin by installing the Inksmoto specific shortcuts. Use the menu entry Effects->X-moto->Other->Install keyboard shortcuts.

Then restart Inkscape to enable them.

The shortcuts are:

  • "t": change texture of the selected blocks
  • "b": change properties of the selected blocks
  • "p": add a pin joint between two physical blocks
  • "o": add a pivot joint between two physical blocks
  • "d": change the selected objects into checkpoint
  • "y": change the selected objects into strawberry
  • "s": change properties of the selected sprites
  • "z": change the selected objects into zone
  • "w": change the selected objects into wrecker
  • "u": change the selected objects into a particle source
  • "r": change the selected objects into the player start
  • "e": change the selected objects into the end of level
  • "a": set layers properties
  • "n": set level properties
  • "h": set other level properties
  • "k": set sky properties
  • "x": launch the .lvl into Xmoto
  • "l": recreate last.lvl into the home directory (in .inkscape/extensions/)
  • "c": copy the xmoto properties of an object
  • "v": paste the xmoto properties stored in the selected objects
  • "i": change the id of an object

Drawing a simple level

Let's draw a simple level using only the Rectangle, Circle and Star tools.

First, set the zoom of Inkscape to 100% (defaulted to 35% when you create a new svg), then draw your level.

Here's is a simple level drawn using the Star tool and the Rectangle tool for the shapes and the Circle tool for the two little circles: Inksmoto 050 02.png

Set level properties

Now that the shapes of the level are drawn, we have to assign them Xmoto properties. For example, we want some shapes to be solid blocks, some others to be background blocks, change their texture...

Example

To change solid blocks texture, select them, then go to the Xmoto effect menu and use the menu entry Effects->X-moto->Blocks->Change Block Texture (or press 't').

Inksmoto 050 03.png

The Block textures window opens.

Inksmoto 070 1.png

Click on the white thumbnail to select the texture we want. The Texture Selection window pops up:

Inksmoto 070 2.png

Double click on the texture wanted for the blocks. Now the Block textures window displays the right texture:

Inksmoto 070 3.png

Press OK. The texture is then displayed in Inkscape:

Inksmoto 050 07.png

Repeat the same procedure to change the texture for the three other blocks.

Now, we want to set them as background blocks. Select them, and use this menu entry: Effects->X-moto->Blocks->Change Block Properties (or press 'b').

Inksmoto 050 08.png

The Block properties window opens. Check Background block then press OK.

Inksmoto 070 4.png

Now we have to set the level start and its end.

Select the first circle and use this menu entry: Effects->X-moto->Entities->Player Start. Then select the second circle and use this menu entry: Effects->X-moto->Entities->End Of Level.

The level looks like this:

Inksmoto 060 02.png

Save the level

Now that our level is drawn and its shapes have Xmoto properties, we have to set the properties of the level, like its name, author, ...

Use the Xmoto menu entry Effects->X-moto->Level->Set level properties. The Level properties window pops up:

Inksmoto 070 5.png

Entries in this window (bold ones are mandatory):

  • lua script: If your level has a lua script, enter the lua file with its full path.
  • level id: The id of the level (only letters, digits and underscore, no space).
  • level name: The real name of the level.
  • author: The author of the level (you).
  • description: A message to add to the level.
  • border texture: Choose the texture which be displayed around the level.

Test the level in Xmoto

Now our level is ready to be tested in Xmoto. Use the Xmoto menu entry Effects->X-moto->Other->Launch level in X-moto (or press 'x'). The Launch level in X-Moto window pops up:

Inksmoto 050 12.png

If the Xmoto executable is present in your PATH (under Linux and MacOSX), you don't have to fill the parameter. If you're under Windows or you want to use a specific Xmoto executable, then enter your Xmoto executable with its full path.

Here is the level in Xmoto:

Inksmoto 050 13.png

Get the .lvl in order to upload it

Now that the level is ready, we have to upload it to the Xmoto website http://xmoto.tuxfamily.org/index.php?page=sendyourlevel

You have to send the level as a .lvl file, not a .svg

  • svg: Vector graphic format
  • lvl: Xmoto level

There's two ways to get the .lvl:

  • When you launch the level in Xmoto from within Inksmoto, the file last.svg and last.lvl are created in the Inkscape home extensions directory:
    • Linux & MacOSX: ~/.inkscape/extensions
    • Windows: C:\Documents And Settings\<USER>\Application Data\Inkscape\extensions\
      • To open Application Data you might have to do Start->run...(or Win-Button+R)->%APPDATA%
  • You can also save the svg and the lvl separately using File->Save a Copy... and choosing the appropriate file format (X-Moto Level (*.lvl)).

Svg file of the tutorial

Here is the corresponding svg file of the tutorial level: Media:Tutorial_050.svg

Tutorial: What's new in 0.7.0

Optimize inksmoto: conversion from svg to lvl is now up to six times faster

Replace Tk with Gtk for windows toolkit

Extend range of edge texture depth to negative values

Per Block Smoothness

Use the theme scale/depth for default value of edges

Add support for checkpoints

Allow sprites free rotation degrees

Support for Inkscape version 0.47