This wiki has been moved to https://github.com/SuperTux/wiki into the mediawiki branch.

Difference between revisions of "Level format"

From SuperTux
Jump to: navigation, search
(Lightning orb)
(Updated from current SVN revision.)
Line 1: Line 1:
{{Outdated}}
+
The level format is a bit complex, which is why the [[Editor FAQ|level editor]] can prove itself very useful. If you are interested in how the levels look like or want to edit them manually (and find some of the parameters not self-explanatory enough), then you may read or skim through this section.
The level format is a bit complex, which is why [http://flexlay.berlios.de/ Flexlay] can prove itself very useful as an editor. If you are interested in how the levels look like or want to edit them manually (and find some of the parameters not self-explanatory enough), then you may read or skim through this section.
+
<pre>
<pre>;; Generated by Flexlay Editor (or Emacs or Vi or whatever)
+
 
(supertux-level                      ;; This initiates a level.
 
(supertux-level                      ;; This initiates a level.
  
Line 11: Line 10:
  
 
   (author "Ondra Hosek")              ;; Put your name here unless you are me (very improbable)
 
   (author "Ondra Hosek")              ;; Put your name here unless you are me (very improbable)
 +
 
 +
  (license "public domain")          ;; Choose under which license you wish this level to be redistributed.
 +
                                      ;; You can basically type anything here. The presets are "GPL 2+ / CC-by-sa 3.0"
 +
                                      ;; (both GNU GPL 2 or later and Creative Commons Attribution-ShareAlike 3.0)
 +
                                      ;; and "non-redistributable" (all rights reserved). In the spirit of SuperTux,
 +
                                      ;; we're politely asking you to allow redistribution, but it's your decision.
  
 
   (sector                            ;; A level is divided into independent sectors that can be connected
 
   (sector                            ;; A level is divided into independent sectors that can be connected
                                       ;; by doors.
+
                                       ;; by doors or teleporters.
  
 
     (name "main")                    ;; Tux begins in the sector named "main".
 
     (name "main")                    ;; Tux begins in the sector named "main".
Line 23: Line 28:
  
 
     (tilemap                          ;; Here come the tiles.
 
     (tilemap                          ;; Here come the tiles.
       (layer "background")           ;; Currently, there are three layer types: "background",
+
       (z-pos -100)                   ;; What layer the tilemap is supposed to be on. If you remember milestone 1,
                                       ;; "interactive" and "foreground".
+
                                       ;; "background" is now -100, "interactive" is 0 and "foreground" is 100.
  
 
       (solid  #f)                    ;; Will Tux collide with tiles in this tilemap?
 
       (solid  #f)                    ;; Will Tux collide with tiles in this tilemap?
Line 30: Line 35:
  
 
       (speed  1.0)                    ;; If the tilemap is solid, this has to be 1. Basically sets how
 
       (speed  1.0)                    ;; If the tilemap is solid, this has to be 1. Basically sets how
                                       ;; fast the tilemap scrolls.
+
                                       ;; fast the tilemap scrolls horizontally.
 +
 
 +
      (speed-y 1.0)                  ;; Same, but vertical scrolling. If the tilemap is solid, this has to be 1.
  
 
       (width  5)                      ;; Number of tiles you plan to put in a row...
 
       (width  5)                      ;; Number of tiles you plan to put in a row...
Line 45: Line 52:
 
     )
 
     )
 
     (tilemap
 
     (tilemap
       (layer "interactive")
+
       (z-pos 0)
       ;; See the background layer definition.
+
      (solid #t)
 +
       ;; See the definition of layer -100. Tux will collide with the tiles in this tilemap.
 
     )
 
     )
 
     (tilemap
 
     (tilemap
       (layer "foreground")
+
       (z-pos 100)
 
       ;; ...
 
       ;; ...
 
     )
 
     )
  
     (camera                           ;; Definitions of the camera paths
+
     (camera-config                    ;; Definitions of the camera mode and paths
  
 
       (mode "autoscroll")            ;; This can be set to "normal" to deactivate
 
       (mode "autoscroll")            ;; This can be set to "normal" to deactivate
Line 61: Line 69:
 
       (path                          ;; Forced scrolling path
 
       (path                          ;; Forced scrolling path
  
         (point (x 2) (y 3) (speed 2)) ;; Point to which camera will scroll.
+
         (mode "circular")             ;; "circular": A -> B -> C -> A -> ...
 +
                                      ;; "ping-pong": A -> B -> C -> B -> A -> ...
 +
                                      ;; "one-shot": A -> B -> C
  
         (point
+
         (xmode 1)                    ;; These two specify the feel of the camera.
 +
        (ymode 1)                    ;; 1 is fix, 2 is Mario/Yoshi, 3 is Kirby
 +
                                      ;; see src/objects/camera.cpp for special options
 +
 
 +
        (node (x 2) (y 3) (time 2))  ;; Point to which camera will scroll.
 +
 
 +
        (node
 
           ;; ...
 
           ;; ...
 
         )
 
         )
 
       )
 
       )
 
      (backscrolling #f)              ;; You can prevent the camera from scrolling
 
                                      ;; backwards with this setting. Applies only
 
                                      ;; to the normal camera mode.
 
 
     )
 
     )
  
 
     (background
 
     (background
       (image "ocean.jpg")             ;; Background from data/images/background
+
       (image "ocean.jpg")               ;; Background from data/images/background
       (speed 0.5)                     ;; Scrolling speed
+
       (speed 0.5)                       ;; Scrolling speed
 +
      (speed-y 0.5)                      ;; Vertical scrolling speed
 +
      (layer -100)                      ;; Which layer should the background scroll on?
 +
      (image-top "arctis_top.jpg")      ;; Image at the top
 +
      (image-bottom "arctis_bottom.jpg") ;; Image at the bottom
 
     )
 
     )
  
Line 96: Line 112:
 
     ;; It is advisable only to use one particle system at a time.
 
     ;; It is advisable only to use one particle system at a time.
  
     (particles-&lt;type&gt;                ;; Valid values for &lt;type&gt; are rain, snow and clouds
+
     (particles-&lt;type&gt;                ;; Valid values for &lt;type&gt; are rain, snow, comets, ghosts and clouds
  
 
       (layer 201)                    ;; -100 are background, 0 are interactive, 200 are foreground tiles.
 
       (layer 201)                    ;; -100 are background, 0 are interactive, 200 are foreground tiles.
Line 124: Line 140:
 
   (x 270)                ;; The badguy's X coordinate.
 
   (x 270)                ;; The badguy's X coordinate.
 
   (y 126)                ;; The badguy's Y coordinate. (Note that the origin is in the top-left corner!)
 
   (y 126)                ;; The badguy's Y coordinate. (Note that the origin is in the top-left corner!)
   (stay-on-platform #f)  ;; Optional. Should the badguy do its best not to fall from the platform it's on? (NYI)
+
   (dead-script "
 +
// A squirrel script that is executed once the Yeti dies. Optional.
 +
")
 +
   (direction "auto")      ;; Direction in which the badguy will move after spawning. "left", "right" or "auto".
 +
                          ;; Optional (except with some badguys).
 
)
 
)
 
</pre>
 
</pre>
  
Bouncing Snowballs, Flying Snowballs, Jumpies, Mr Bombs, Mr Iceblocks, Mr Rockets, Mr Trees, World 1 Noloks, Poison Ivies, Snowballs, Spikies, Stalactites, Yeti Stalactites and Zeeklings only require this list of parameters. Simply substitute <tt><badguy-name></tt> with one of the following:
+
Angry Stones, Bouncing Snowballs, Fish, Flying Snowballs, Ghost Trees, Igels, Jumpies, Moles, Mr Bombs, Mr Iceblocks, Mr Rockets, Mr Trees, Plants, Poison Ivies, Skullyhops, Snails, Snowballs, Spider Mites, Spikies, Sleeping Spikies, Stalactites, Stumpies, Toads, Totems, Yeti Stalactites, Walking Leaves, Yetis and Zeeklings only require this list of parameters. Simply substitute <tt><badguy-name></tt> with one of the following:
  
 +
*<tt>angrystone</tt>
 
*<tt>bouncingsnowball</tt>
 
*<tt>bouncingsnowball</tt>
 +
*<tt>fish</tt>
 
*<tt>flyingsnowball</tt>
 
*<tt>flyingsnowball</tt>
 +
*<tt>ghosttree</tt>
 +
*<tt>igel</tt>
 
*<tt>jumpy</tt>
 
*<tt>jumpy</tt>
 +
*<tt>mole</tt>
 
*<tt>mrbomb</tt>
 
*<tt>mrbomb</tt>
 
*<tt>mriceblock</tt>
 
*<tt>mriceblock</tt>
 
*<tt>mrrocket</tt>
 
*<tt>mrrocket</tt>
 
*<tt>mrtree</tt>
 
*<tt>mrtree</tt>
*<tt>nolok_01</tt>
+
*<tt>plant</tt>
 
*<tt>poisonivy</tt>
 
*<tt>poisonivy</tt>
 +
*<tt>skullyhop</tt>
 +
*<tt>snail</tt>
 
*<tt>snowball</tt>
 
*<tt>snowball</tt>
*<tt>snowsnail</tt>
 
 
*<tt>spidermite</tt>
 
*<tt>spidermite</tt>
 
*<tt>spiky</tt>
 
*<tt>spiky</tt>
 +
*<tt>sspiky</tt>
 
*<tt>stalactite</tt>
 
*<tt>stalactite</tt>
 +
*<tt>stumpy</tt>
 +
*<tt>toad</tt>
 +
*<tt>totem</tt>
 +
*<tt>yeti</tt>
 
*<tt>yeti_stalactite</tt>
 
*<tt>yeti_stalactite</tt>
 +
*<tt>walkingleaf</tt>
 
*<tt>zeekling</tt>
 
*<tt>zeekling</tt>
 +
 +
==== Dart trap ====
 +
<pre>(darttrap
 +
  (initial-delay 3)      ;; How long to wait after being activated before starting to shoot?
 +
  (fire-delay 3)          ;; How long to wait between shots?
 +
  (ammo -1)              ;; How many shots do we have? (-1 is infinity)
 +
  (direction "left")      ;; This common parameter is NOT optional with the dart trap.
 +
)</pre>
  
 
==== Dispenser ====
 
==== Dispenser ====
Line 152: Line 192:
 
    
 
    
 
   (badguy random)        ;; Valid values are "snowball", "bouncingsnowball", "mrbomb",
 
   (badguy random)        ;; Valid values are "snowball", "bouncingsnowball", "mrbomb",
                           ;; "mriceblock", "mrrocket", "poisonivy", "snowsnail", or "random".
+
                           ;; "mriceblock", "mrrocket", "poisonivy", "skullyhop", "snail", or "random".
 
)</pre>
 
)</pre>
  
Line 164: Line 204:
  
 
==== Lightning orb ====
 
==== Lightning orb ====
The lightning orb ("kugelblitz") ignores the <tt>y</tt> coordinate, spawning above the visible screen.
+
The lightning orb (<tt>kugelblitz</tt>) ignores the <tt>y</tt> coordinate, spawning above the visible screen.
 +
 
 +
==== Mr. Rocket ====
 +
<tt>direction</tt> is not optional.
  
 
==== Spike ====
 
==== Spike ====
Line 173: Line 216:
 
)</pre>
 
)</pre>
  
==== Yeti ====
+
==== Will-o-Wisp ====
<pre>(yeti
+
<pre>(willowisp
   (dead-script "
+
   (sector "main")        ;; Sector to teleport player into when touched
// A squirrel script that is executed once the Yeti dies.
+
  (spawnpoint "willo1")  ;; Spawnpoint to teleport player to
")
+
  (name "wisp1")          ;; Name for scripting control
 +
  (flyspeed 3)            ;; Speed at which wisp flies towards player
 +
  (track-range 30)        ;; How near must the player be to be followed?
 +
  (vanish-range 60)      ;; How far must the player be for the wisp to vanish?
 +
  (running #f)            ;; Follow a preset path
 +
  (path
 +
    ;; Path to follow if running is true. See the path in camera-config for the syntax.
 +
  )
 
)</pre>
 
)</pre>
  
 
[[Category:Game Engine]]
 
[[Category:Game Engine]]

Revision as of 04:58, 21 June 2007

The level format is a bit complex, which is why the level editor can prove itself very useful. If you are interested in how the levels look like or want to edit them manually (and find some of the parameters not self-explanatory enough), then you may read or skim through this section.

(supertux-level                       ;; This initiates a level.

  (version 2)                         ;; This document only describes version 2. Version 1 is deprecated
                                      ;; and I'm not going to teach it since it lacks a lot of features.

  (name (_ "Some demo level"))        ;; Name of the level. Call it a nice name. Note that this should be
                                      ;; internationalised (that's why the extra underscore and brackets).

  (author "Ondra Hosek")              ;; Put your name here unless you are me (very improbable)
  
  (license "public domain")           ;; Choose under which license you wish this level to be redistributed.
                                      ;; You can basically type anything here. The presets are "GPL 2+ / CC-by-sa 3.0"
                                      ;; (both GNU GPL 2 or later and Creative Commons Attribution-ShareAlike 3.0)
                                      ;; and "non-redistributable" (all rights reserved). In the spirit of SuperTux,
                                      ;; we're politely asking you to allow redistribution, but it's your decision.

  (sector                             ;; A level is divided into independent sectors that can be connected
                                      ;; by doors or teleporters.

    (name "main")                     ;; Tux begins in the sector named "main".

    (music "ondraschipdisko.ogg")     ;; Name of the music file. See the data/music/ directory.

    (gravity 10.0)                    ;; Gravity of Tux. 10.0 is the default and sanest value (unless you
                                      ;; are ready to apply the level design correctly).

    (tilemap                          ;; Here come the tiles.
      (z-pos -100)                    ;; What layer the tilemap is supposed to be on. If you remember milestone 1,
                                      ;; "background" is now -100, "interactive" is 0 and "foreground" is 100.

      (solid  #f)                     ;; Will Tux collide with tiles in this tilemap?
                                      ;; Note: only one tilemap can be solid per sector.

      (speed  1.0)                    ;; If the tilemap is solid, this has to be 1. Basically sets how
                                      ;; fast the tilemap scrolls horizontally.

      (speed-y 1.0)                   ;; Same, but vertical scrolling. If the tilemap is solid, this has to be 1.

      (width  5)                      ;; Number of tiles you plan to put in a row...
      (height 5)                      ;; ... and in a column. (5x5 is pretty tiny; small Tux
                                      ;; takes up 1x1 tiles, big Tux 1x2 tiles).

      (tiles                          ;; Integer lists of which tiles you want to use.
        0 0 0 0 0                     ;; The tiles and their numbers are defined in
        0 0 0 0 0                     ;; data/images/tiles.strf.
        0 0 0 0 0
        0 0 0 0 0
        0 0 0 0 0
      )
    )
    (tilemap
      (z-pos 0)
      (solid #t)
      ;; See the definition of layer -100. Tux will collide with the tiles in this tilemap.
    )
    (tilemap
      (z-pos 100)
      ;; ...
    )

    (camera-config                    ;; Definitions of the camera mode and paths

      (mode "autoscroll")             ;; This can be set to "normal" to deactivate
                                      ;; forced scrolling. Then you can omit the
                                      ;; "path" directive.

      (path                           ;; Forced scrolling path

        (mode "circular")             ;; "circular": A -> B -> C -> A -> ...
                                      ;; "ping-pong": A -> B -> C -> B -> A -> ...
                                      ;; "one-shot": A -> B -> C

        (xmode 1)                     ;; These two specify the feel of the camera.
        (ymode 1)                     ;; 1 is fix, 2 is Mario/Yoshi, 3 is Kirby
                                      ;; see src/objects/camera.cpp for special options

        (node (x 2) (y 3) (time 2))   ;; Point to which camera will scroll.

        (node
          ;; ...
        )
      )
    )

    (background
      (image "ocean.jpg")                ;; Background from data/images/background
      (speed 0.5)                        ;; Scrolling speed
      (speed-y 0.5)                      ;; Vertical scrolling speed
      (layer -100)                       ;; Which layer should the background scroll on?
      (image-top "arctis_top.jpg")       ;; Image at the top
      (image-bottom "arctis_bottom.jpg") ;; Image at the bottom
    )

    (spawnpoint                       ;; A spawning point for Tux. By default, he is
      (name "main")                   ;; spawned at spawnpoint named "main".
      (x 0)
      (y 0)
    )

    ;; THE FOLLOWING OBJECTS ARE OPTIONAL.
    (init-script "
// A Squirrel script
// See the scripting reference for more information.
")

    ;; Here you can add badguys of your choice.
    ;; Details on this can be read later in this chapter.

    ;; Particle systems
    ;; It is advisable only to use one particle system at a time.

    (particles-<type>                 ;; Valid values for <type> are rain, snow, comets, ghosts and clouds

      (layer 201)                     ;; -100 are background, 0 are interactive, 200 are foreground tiles.
                                      ;; Choose a number to put the rain between two layers. In this case,
                                      ;; the rain is in front of the foreground tiles. (see also
                                      ;; src/video/drawing_context.hpp)
    )

    (leveltime

      (time 300)                      ;; The player must complete this level
                                      ;; within 300 seconds.
    )
  ) ;; End of sector

  ;; You can add other sectors here.
)
;; End of level

Badguys

This section describes the various badguys and their parameters.

The next few sections describe the extra parameters for the other badguys.

Common parameters

(<badguy-name>
  (x 270)                 ;; The badguy's X coordinate.
  (y 126)                 ;; The badguy's Y coordinate. (Note that the origin is in the top-left corner!)
  (dead-script "
// A squirrel script that is executed once the Yeti dies. Optional.
")
  (direction "auto")      ;; Direction in which the badguy will move after spawning. "left", "right" or "auto".
                          ;; Optional (except with some badguys).
)

Angry Stones, Bouncing Snowballs, Fish, Flying Snowballs, Ghost Trees, Igels, Jumpies, Moles, Mr Bombs, Mr Iceblocks, Mr Rockets, Mr Trees, Plants, Poison Ivies, Skullyhops, Snails, Snowballs, Spider Mites, Spikies, Sleeping Spikies, Stalactites, Stumpies, Toads, Totems, Yeti Stalactites, Walking Leaves, Yetis and Zeeklings only require this list of parameters. Simply substitute <badguy-name> with one of the following:

  • angrystone
  • bouncingsnowball
  • fish
  • flyingsnowball
  • ghosttree
  • igel
  • jumpy
  • mole
  • mrbomb
  • mriceblock
  • mrrocket
  • mrtree
  • plant
  • poisonivy
  • skullyhop
  • snail
  • snowball
  • spidermite
  • spiky
  • sspiky
  • stalactite
  • stumpy
  • toad
  • totem
  • yeti
  • yeti_stalactite
  • walkingleaf
  • zeekling

Dart trap

(darttrap
  (initial-delay 3)       ;; How long to wait after being activated before starting to shoot?
  (fire-delay 3)          ;; How long to wait between shots?
  (ammo -1)               ;; How many shots do we have? (-1 is infinity)
  (direction "left")      ;; This common parameter is NOT optional with the dart trap.
)

Dispenser

(dispenser
  (cycle 3)               ;; How often should a badguy be dispensed?
  
  (badguy random)         ;; Valid values are "snowball", "bouncingsnowball", "mrbomb",
                          ;; "mriceblock", "mrrocket", "poisonivy", "skullyhop", "snail", or "random".
)

Flame

(flame
  (radius 3)              ;; How big should the radius of the circle be that the flame
                          ;; follows?
  
  (speed 10)              ;; How fast should the flame be?
)

Lightning orb

The lightning orb (kugelblitz) ignores the y coordinate, spawning above the visible screen.

Mr. Rocket

direction is not optional.

Spike

Don't mistake this badguy for Spiky! Spiky is the snowball-like creature with spikes, whilst a spike is an object serving the same purpose like the stalactite.

(spike
  (direction 2)           ;; 0: north, 1: south, 2: west, 3: east
)

Will-o-Wisp

(willowisp
  (sector "main")         ;; Sector to teleport player into when touched
  (spawnpoint "willo1")   ;; Spawnpoint to teleport player to
  (name "wisp1")          ;; Name for scripting control
  (flyspeed 3)            ;; Speed at which wisp flies towards player
  (track-range 30)        ;; How near must the player be to be followed?
  (vanish-range 60)       ;; How far must the player be for the wisp to vanish?
  (running #f)            ;; Follow a preset path
  (path
    ;; Path to follow if running is true. See the path in camera-config for the syntax.
  )
)