Monday, November 7, 2011

XML Guide

I use the in-game editor plus a text file to make maps, so I end up messing around with the XML a lot. I thought I'd make a post explaining it. Updated March 2012.

Here's the code for the following map:


<C>
  <P F="0" />
  <Z>
    <S>
      <S H="40" Y="380" P="0,0,0.3,0.2,0,0,0,0" T="6" L="400" X="400" />
    </S>

    <D>
      <T X="300" Y="360" />
      <F X="400" Y="200" />
      <P C="888888" T="19" Y="360" X="500" P="0,0" />
    </D>

    <O>
      <O C="7" Y="350" X="400" P="0" />
    </O>

  </Z>
</C>

I added color and indentation to make the different parts stand out. Let's examine them one by one.


Map settings

<P F="0" />
  • Background: If you want a background instead of the normal blue add one of the following options:
    • F="0" - Daylight
    • F="1" - Dawn
    • F="2" - Twilight
    • F="3" - Full Moon
    • F="4" - Halloween (1600 long)
    • F="5" - Christmas
    • F="6" - Valentine (4800 long)
  • Collision: Add C=""
  • Soulmate: Add A=""
  • Nightmode: Add N=""
  • Gravity and wind: Add G="10,0" where the first number is gravity (negative values pull you to the sky) and the second number is the wind (positive values mean it blows from left to right; negative values mean it blows in the opposite direction).
  • Scrolling maps: Add L="1600" for a map of total length 1600 (the maximum allowed). Values lower than 800 will do weird things...


Grounds

<S> 
  <S H="40" Y="380" P="0,0,0.3,0.2,0,0,0,0" T="6" L="400" X="400" />
</S>
  • Explanation of values:
    • H - height
    • Y - y-coordinate of the center
    • P - explained below
    • T - ground type
    • L - length
    • X - x-coordinate of the center
  • For static grounds, the only non-zero options of P are the third, fourth and fifth ones.
    • 3rd - friction
    • 4th - restitution
    • 5th - rotation (positive is clockwise)
  • Here are the different types of grounds and their default friction and restitution values:
    •  T Type   Fric  Rest
    •  
    •  0 Wood    0.3   0.2
    •  1 Ice     0     0.2
    •  2 Tramp   0     1.2
    •  3 Lava    0    20
    •  4 Choc   20     0.2
    •  5 Earth   0.3   0.2
    •  
    •  6 Grass   0.3   0.2
    •  7 Sand    0.1   0.2
    •  8 Cloud   0.3   0.2
    •  9 Water
    • 10 Stone   0.3   0
    •  
    • 11 Snow    0.05  0.1
    • 12 Rect    0.3   0.2
    • 13 Circle  0.3   0.2

  • Circle radius is the L value (H can be anything)
  • Rectangles and circles have an added option for the color, o="324650" is the default blue-green
  • For dynamic grounds, the first option is set to 1 (for example, P="1,0,0.3,0.2,0,0,0,0"). The rest correspond to:
    • 2nd - mass (0 is default, means it's calculated by mass = AREA/30)
    • 6th - fixed rotation (set to 1 and the block won't rotate)
    • 7th - linear damping (set to 30 and the block won't move unless a mouse pushes it)
    • 8th - angular damping (set to 10 and the block won't rotate unless a mouse pushes it)
  • Foreground: Add N=""
  • Collision options:
    • c="1" or omitted - collides with mice and grounds/objects
    • c="2" - collides only with grounds/objects
    • c="3" - collides only with mice
    • c="4" - doesn't collide with anything


Mice Stuff

<D>
  <T X="300" Y="360" />
  <F X="400" Y="200" />
  <P C="888888" T="19" Y="360" X="500" P="0,0" />
</D>
  • The X and Y values tell where the object is (they usually align on the bottom)
  • There are four special items:
    • T - hole
    • F - cheese
    • MS - mouse spawn (if omitted, mice will spawn at the first hole)
    • MC - shaman spawn (if omitted, the shaman will spawn where the mice do)
  • All other items use P and are distinguished by their T value. Here is the list of items with their values:


  • The starred items use the C="..." option because their colors can be altered--the rest omit it. Here are the default colors for those items:
    • T="14" C="95311e,bde8f3,faf1b3" (curtains, sky, sun)
    • T="15" C="8a311b"
    • T="18" C="57703e,e7c3d6" (vase, flowers)
    • T="19" C="8a311b"
    • T="20" C="48230c"
    • T="24" C="46788e"
    • T="34" C="719b9f"
    • T="56" C="ce4505,fcc304" (sash, bow)
    • T="60" C="c54000"
    • T="65" C=",fcc304" (blank, bow)
  • Foreground: Use P="1,0"
  • Reverse: Use P="0,1" (and both foreground and reverse would be P="1,1")


Shaman Objects

<O>
  <O C="7" Y="350" X="400" P="0" />
</O>
  • The X and Y values are the center of the object.
  • The C value distinguishes between items. Here's the list:


  • Rotation: The value in P="0" tells how much the object is rotated (positive means clockwise).
  • Ghost objects: Use P="0,1" where the first number is the rotation, as above.


That's all for the XML. I might combine this with the Mapmaking Numbers post at some point.

13 comments:

  1. Nice guide! It'll sure help me out :3

    ReplyDelete
  2. Add P="" to the map settings part, but I think you can change it in the editor too. I'll update the guide at some point.

    ReplyDelete
  3. Sorry.. im still a little confused on how to get valintines map?
    and also can you make a simpler way to get the xml of a map?
    like put it under the map description
    thanks :D

    ReplyDelete
  4. Temple , your instruction more complete than CFM. I wanted to use Night Mode on my map :)

    ReplyDelete
  5. Wow,you're like more advanced than the admins for map making O.o really nice tutorial^^

    ReplyDelete
  6. Now , by you I can do the maps for playground, thx , and Gj :>

    Polishjulia<<< tfm

    ReplyDelete
  7. Where would I put 'F=6' at (Using the valentine's map background) when I'm using a defilante map code/setting?

    ReplyDelete
  8. oyes. I wish I understood this x)

    ReplyDelete