Skip to content
Justin Espedal edited this page Jul 10, 2018 · 2 revisions

All scene data is in [workspace]/games/[your game]/scenes

One master xml file tracks all the scenes in the game.

scenes.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<scenes>
    <scene .../>
	<scene .../>
	<scene .../>
</scenes>

<scene> attributes:

id="0" (is unique for each scene)
desc=""
format="3.3.0"
name="Scene Name" (all Stencyl resources should have a unique name)

Each scene is additionally represented by 4 files, each with the scene's ID as the filename.

0.scn

  • This is a binary representation of the tiles in each layer.
For each tile layer:
  4 bytes - number of bytes in layer (see below)
For each tile layer:
  4 bytes - layer ID
  4 bytes - layer z order
  For each runlength:
	2 bytes, index of desired autotile image (0 if not an autotile)
	2 bytes, tilesetID (-1 for null tile)
	2 bytes, tileID (-1 for null tile)
    2 bytes, # of tiles in runlength
  (Length of each layer is 8 bytes + 8 bytes * number of runlengths)
1 byte - unused

A runlength is a continuous sequence of the same tile (same tileset ID, same tile ID, same autotile graphic) from left to right. Runlengths don't break on the edge of the map. If the same tile is in the last column of one row, and the first column of the next, they're in the same runlength.


0.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<scene ...>
    <layers>
        <color-bg blue="255" green="255" red="255"/>
        <layer .../>
        <layer .../>
        <layer .../>
    </layers>
    <joints/>
    <regions/>
    <terrainRegions/>
    <actors/>
    <snippets/>
    <terrain/>
    <atlases members="" retainAtlases="true"/>
</scene>

<scene> attributes:

id="[scene id]" (would be 0 for 0.xml)
name="[scene name]"
desc=""
format="3.3.0"
eventsnippetid="-1" (use -1 so new events are created when the scene is first opened)
depth="1" (number of tile layers, equal to the number of <layer> elements inside <layers>)
width="640" (width in pixels)
height="480" (height in pixels)
tilew="32" (width of a tile in pixels)
tileh="32" (height of a tile in pixels)
tiled="1"
gravx="0.0" (horizontal gravity)
gravy="0.0" (vertical gravity)
revision=""
savecount="0"
type="standard"

<layer> attributes:

id="[layer id]"
name="[layer name]"
order="[z order, 0 is at the top]"
blendMode="normal"
opacity="100"
scrollFactorX="1.0"
scrollFactorY="1.0"
visible="true"
locked="false"
color="100,168,234" (r,g,b of the color assigned to the layer in the layers pane)
Clone this wiki locally