FANDOM


A level's Extensible Markup Language (more commonly known as LevelXML, XML or Level Data) makes it possible to copy codes and paste them in Level Editor. Every object has his own complex structure of code. All codes usually start and end with "<levelXML>", the data will not work without it. The tools in the Level Editor have there own codes when the tool is used, such as "<shapes>(Shapes), <specials> (Special Items), "<joints> (Pin Joint), and "</triggers> (Trigger Tool). Although, text does not have a similar code look like the others, the text's code reads "<![CDATA[HERE'S SOME TEXT]]>" when it's inserted. The only things that don't have there own codes are Characters (Not NPC's), and toggle options. Level editors usually share their level data on pastebin.com for anyone who needs to make a new level. Note that some expected data can not be found because the setting was not present when the XML was generated. To fix this, simply load and re-save the XML.

Screen Shot 2013-03-16 at 9.28.12 AM

The import level data box.

Here's an example of data for a black, fixed rectangle shape:

<shapes>

    <sh t="0" p0="450" p1="5489" p2="900" p3="200" p4="0" p5="t" p6="f" p7="1" p8="0" p9="-1" p10="100" p11="1"/>

Data Explanations

Level Options/Main Character Settings

  • (info v) is the version of Happy Wheels the level was made in.
  • (x) is the x-coordinate of the main character.
  • (y) is the y-coordinate of the main character.
  • (c) determines what the main character will be.
  • (f) determines if the main character is forced (t = true, f = false).
  • (h) determines if the vehicle the character rides is hidden (t = true, f = false).
  • (bg) is the level backdrop (0 = blank, 1 = green hills, 2 = city.) If a value other than these values is used, then when you test the level, the background will be the default blue and the editor will still be visible and usable, which can have some interesting consequences, such as being able to have multiple test runs active at the same time. This does not affect the level if it is published, however.
  • (bgc) is the background color (The value is RGB decimal). If the background is set to no color (bgc = -1), the default blue background is used. If bgc < -1, then the color used is the negative of what the color would be if the (value given plus 1) were positive (e.g. if you set bgc = -16711681, then you get cyan, because a bgc of 16711680 is red). If bgc > 16777215 = 16^6 - 1, the editor will just use the last 6 digits of the number if it were in base 16 (e.g. bgc = 33488896 = 1FF0000 in base 16 gives red, because bgc = 16711680 = FF0000 in base 16 is red.)
  • (e) is a check to ensure that the XML has not been stolen (ie through hacking the TJF site). If e <= 0 or e = NaN, the importer gives an error message. If e > 0, the editor resets e = 1, so in essence, this value can never be changed.

All Items

  • (p0) is the x coordinates of the object.
  • (p1) is the y coordinates of the object. Both coordinates will truncate values to 2 decimal places and will automatically adjust such that imported shapes are not out of range.

Shapes, Polygons, and Art

  • (sh t) determines the type of shape. (Rectangle = 0, Circle = 1, Triangle = 2, Polygon = 3, Art = 4) Setting this to a value out of range will result in this shape not being imported. Changing an art shape with concave parts into a polygon will result in the polygon having improper collision for the concave parts.
  • (i) determines whether the shape is interactive. This will only appear for i = f (i.e. if the shape is set to non-interactive or if it is art), so if the shape is interactive or a polygon, this parameter will not appear.
  • (p2) is the width of the object.
  • (p3) is the height of the object. Both width and height for shapes automatically truncate such that the values are integers, and automatically adjust to be in the range [5, 5000] for rectangles and circles; [5, 1500] for triangle width and [15, 4500] for triangle height; or [1/10 * original scale, 10 * original scale] for polygons and art (which can lead to these having values as low as 0 or larger than the size of the editor). Setting either to NaN will result in the shape disappearing and having 0 width/height.
  • (p4) is the rotation of the shape. The editor will accept values of any decimal precision, and will automatically adjust values to be between [-180, 180]. Setting this to NaN will cause the rotation to be set to 0, and the shape collision to disappear.
  • (p5) will determine if the item is fixed (t = true and f = false).
  • (p6) determines if the item is sleeping (t = true and f = false).
  • (p7) is the density of the shape. This will automatically adjust to be in the range [0.1, 100], but will accept any decimal precision. If set to NaN, this causes the Black Hole glitch.
  • (p8) is the fill color of the shape.
  • (p9) is the outline color of the shape. (-1 meaning there is no outline color). Setting the colors to values outside the normal RGB range will result in the same scenario as with the background colors, except that negative values will always render as no color.
  • (p10) is the opacity of the shape. This will automatically adjust to be in the range [0, 100], and will round to the nearest integer. Setting this to NaN will cause the shape to disappear.
  • (p11) is the collision type. This will automatically adjust to be in the range [1, 7], and will automatically truncate decimals and default to 1 if set to NaN.
  • (p12) is the cutout amount (circles only). This will automatically adjust to be in the range [0, 100], and will truncate to be an integer.

Polygons and Art

  • (v f) determines if all of the vertices of the polygon connect. (t = true and f = false). This value is useless because the polygon vertices will always connect.
  • (id) determines if the polygon was made first, second, third, and so on. Deleted polygons are still affected (0 = 1st). This can be set to integers in the range [-2,147,483,648, 2,147,483,647], which is the range of int32. If the value is set outside that range, it will adjust such that adjusted value = min value +(input value - max value - 1). The ID will change if you edit any of the vertices. Polygons/art with the same ID will be given the same vertices as the first instance of that type of shape with that particular ID.
  • (n) is the amount of vertices that the polygon has. Polygons and art without Bezier curves must have 3 or more vertices, but art with Bezier curves must have at least 2 vertices. The upper limit of n is currently unknown, but is greater than 10,000.
  • (v#="x_y") , or (v#="x_y_dx0_dy0_dx1_dy1") for Bezier curves, is the distance from the center to that specific vertex at the original scale.The "x" determines the horizontal distance, while the "y" determines the vertical distance. For Bezier curves, dx0 and dy0 are the coordinates of the first Bezier handle with respect to the center, while dx1 and dy1 are the coordinates of the second handle. The # always starts with 0, and the vertices must be in ascending order. If the vertices are in ascending order, but at least one is missing (based on the specified n), the editor will automatically place set the missing vertices as 0_NaN. If there are more vertices given than the value for n, then only the vertices up to (n - 1) will be used. If the vertices are not in ascending order, the level will not import. The coordinate values can have any decimal precision, and do not seem to have a limited range. Note: The _ as a delimiter was a dot (.) in previous versions of the game. Reloading the XML in the editor converts it to the new format.

Joints

  • (j t) will determine the type of joint. (0 = pin joint and 1 = sliding joint). Values outside the range will cause the joint to not be imported.
  • (x) is the x coordinates of the joint.
  • (y) is the y coordinates of the joint.
  • (b1) is the layer ID of the first object that's connected to the joint.
  • (b2) is the layer ID of the second object that's connected to the joint. For both of these, a layer ID of -1 is the background, while the layer IDs of shapes is a positive integer, with values ranging up to the total number of shapes in the level. Special items have their own layer IDs starting with s0. If a value outside of this range is used, the joint will automatically attach to the background, unless both values are out of range, in which case the joint will just sit there meaninglessly. If you happen to attach the joint to something that isn't supposed to be joined (like an art shape or fixed object), the level will crash upon testing. By default, if something is joined to the background, the background is usually set in b2.
  • (a) is the axis angle (sliding joints only). Values are clamped at [-180, 180], with values truncated to the nearest integer.
  • (l) determines if the joint has "limit rotation" (pin) or "limit range" (sliding) is enabled.
    • (ua) is the upper angle (pin).
    • (la) is the lower angle (pin). Values are clamped at [-180, 0] for lower and [0, 180] for upper, with decimals truncated to the nearest integer.
    • (ul) is the upper limit (sliding).
    • (ll) is the lower limit (sliding). Values are clamped at [-8000, 0] for lower and [0, 8000] for upper, with decimals truncated to the nearest integer. For both pin and sliding joints, if you give a positive value for the lower limit, it automatically converts it to its negative value.
  • (m) will determine if the motor is enabled. (t = true, f = false)
    • (tq) is the motor torque (pin). Values are clamped at [-infinity, 100000], with any decimal precision. Negative torque will cause the first jointed object to spin counterclockwise with a speed based on the magnitude of the negative torque, regardless of the value of sp. Setting this to NaN will cause the jointed object to disappear while testing.
    • (fo) is the motor force (sliding). Values are clamped at [-infinity, 100000], with any decimal precision. Negative force will cause the first jointed object to move in the positive axis direction with a speed based on the magnitude of the negative torque, regardless of the value of sp. Setting this to NaN will also cause the jointed object to disappear while testing.
    • (sp) is the motor speed. Values are clamped at [-20, 20] (pin) or [-50, 50] (sliding), with any decimal precision. Setting this value to NaN causes the joint to move infinitely fast, assuming the torque value is high.
  • (c) determines if "collide connected" is enabled. (t = true, f = false)

Special Items

  • (sp t) determines the type of special item.

Building Blocks

I-Beam (3)
  • (p2) and (p3) are the width and height, clamped to [200, 1600] and [32, 64], respectively, with decimals rounded to the nearest integer.
  • (p4) is the rotation, with usual values and precision.
  • (p5) and (p6) control whether the I-Beam is fixed and sleeping, respectively.
Log (4)
  • (p2) and (p3) are the width and height, clamped to [36, 54] and [200, 600], respectively, with decimals rounded to the nearest integer.
  • (p4) is the rotation, with usual values and precision.
  • (p5) and (p6) control whether the Log is fixed and sleeping, respectively.
Rail (27)
  • (p2) and (p3) are the width and height, clamped to [100, 2000] and 18, respectively, with decimals rounded to the nearest integer. p3 is not necessary because the height is always set to 18.
  • (p4) is the rotation, with usual values and precision.

Hazards

Arrow Gun, Harpoon Gun, Landmine, Spike Set
  • (p2) is the rotation, with usual values and precision.
Arrow Gun (29)
  • (p3) determines if the gun is fixed.
  • (p4) is the rate of fire. The values are unclamped, so they can be any value in the range of int32. 0 and negative values cause the firing rate to become slower as the magnitude of the negative number increases, while positive values cause the firing rate to become faster as the value increases.
  • (p5) determines if arrow gun can only target non-player characters. (t = true, f = false)
Harpoon Gun (15)
  • (p3) determines if the harpoon has an anchor wire. (t = true, f= false)
  • (p4) determines whether to fire at a fixed angle.
  • (p5) is the firing angle (if enabled). The values are unclamped integers, though obviously that effectively only means values between [-180, 180] due to being an angle.
  • (p6) determines whether to limit firing to being trigger activated.
  • (p7) determines whether the harpoon starts deactivated.
Homing Mine (25)
  • (p2) is the movement speed, an integer clamped to [1, 10].
  • (p3) is the delay before exploding, an integer clamped to [0, 5].
Landmine (2)
Spike Set (6)
  • (p3) determines whether the spikes are fixed.
  • (p4) is the number of spikes, an integer clamped to [20, 150].
  • (p5) determines whether the spikes start asleep.
Wrecking Ball (7)
  • (p2) is the rope length, an integer clamped to [200, 1000].

Movement Items

Cannon, Boost, Fan, Jet, Spring Platform, and Paddle Platform
  • (p2) is the rotation, with usual values and precision.
Cannon (33)
  • (p3) is the starting rotation, an integer clamped to [-90, 90]
  • (p4) is the firing rotation, an integer clamped to [-90, 90].
  • (p5) is the cannon type (1 = circus, 2 = gray).
  • (p6) determines the delay before firing or starting to rotate to the firing rotation, an integer clamped to [1, 10].
  • (p7) is the muzzle scale, an integer clamped to [1, 10].
  • (p8) determines how much power the cannon will use to fire, an integer clamped to [1, 10].
Boost (12)
  • (p3) is the amount of panels the boost will have, an integer clamped to [1, 6].
  • (p4) is the power of the boost, an integer clamped to [10, 100].
Fan (8)
Jet (28)
  • (p3) determines if the jet is sleeping. (t = true, f = false)
  • (p4) is the size/power of the jet, an integer clamped to [1, 10].
  • (p5) is the firing time before the jet shuts off, an integer clamped to [0, 50].
  • (p6) is the acceleration time to full power, an integer clamped to [0, 5].
  • (p7) determines if "fixed angle" is enabled.
Spring Platform (5)
  • (p3) is the delay before the platform reacts after collision, a float clamped to [0, 2] with any precision (though the timer only shows values to the nearest 0.03 seconds.)
Paddle Platform (35)
  • (p3) is the delay before the platform reacts after collision, with the same values and precision as the spring platform.
  • (p4) determines if "reverse" is checked. (If false, the paddle flings objects to the right.)
  • (p5) is the max angle setting, a float clamped to [15, 90] with any precision.
  • (p6) is the speed setting, a float clamped to [1, 10] with any precision.

Non-Player Characters (17)

  • (p2) is the rotation of the character
  • (p3) is the character type, clamped to [1, 16] (the current number of player types).
  • (p4) determines if the character is sleeping. (t = true, f = false)
  • (p5) determines if "reversed" is checked. (t = true, f = false)
  • (p6) determines if the character will hold its pose. (t = true, f = false)
  • (p7) determines if the character is interactive.  (t = true, f = false)
  • (p8) is the neck angle, an integer clamped to [-20, 20].
  • (p9) is arm 1's angle.
  • (p10) is arm 2's angle. Both arm angles are integers clamped to [-180, 60].
  • (p11) is elbow 1's angle.
  • (p12) is elbow 2's angle. Both elbow angles are integers clamped to [-160, 0].
  • (p13) is leg 1's angle.
  • (p14) is leg 2's angle. Both leg angles are integers clamped to [-150, 10].
  • (p15) is knee 1's angle.
  • (p16) is knee 2's angle. Both knee angles are integers clamped to [0, 150].
  • (p17) determines if the character will release any joints when it dies. (t = true, f = false)

Buildings (13 = brick and 14 = modern)

  • (p2) is the floor width, an integer clamped to [1, 10].
  • (p3) is the amount of floors, an integer clamped to [3, 50].

Miscelleneous

Blade Weapon (34)
  • (p2) is the rotation, with usual values and precision.
  • (p3) determines if it is reversed (t = true, f = false).
  • (p4) determines if it is sleeping (t = true, f = false).
  • (p5) determines if it is interactive (t = true, f = false).
  • (p6) determines the blade weapon type (from 1 to 12).
Food Item (32)
  • (p2) is the rotation, with usual values and precision.
  • (p3) determines if it is sleeping (t = true, f = false).
  • (p4) determines if it is interactive (t = true, f = false).
  • (p5) determines the food type (from 1 to 3). If you use a value out of range, the editor will crash when you test.
Chain (30)
  • (p2) is the rotation, with usual values and precision.
  • (p3) determines if it is sleeping (t = true, f = false).
  • (p4) determines if it is interactive (t = true, f = false).
  • (p5) is the link count of the chain, an integer clamped to [2, 40]. Setting this to NaN causes the item to disappear.
  • (p6) is the link scale, a float clamped to [1, 10] with any precision. Setting this to NaN causes the item to disappear.
  • (p7) is the chain curve, a float clamped to [-10, 10] with any precision. Setting this to NaN causes the chain to fold in on itself, and it disappears when you test.
Glass Panel (18)
  • (p2) is the width of the panel, an integer clamped to [5, 50].
  • (p3) is the height of the panel, an integer clamped to [50, 500].
  • (p4) is the rotation, with usual values and precision.
  • (p5) determines whether the item is sleeping (t = true, f = false).
  • (p6) determines how strong the glass panel is, an integer clamped to [1, 10].
  • (p7) determines if broken glass can stab characters with enough force (t = true, f = false).
Meteor (11)
  • (p2) is the width of the item. This value is redundant.
  • (p3) is the height of the item. This controls the width, and is an integer clamped to [200, 600].
  • (p4) determines if it is fixed (t = true, f = false).
  • (p5) determines if it is sleeping (t = true, f = false).
Dinner Table (1)
  • (p2) is the rotation, with usual values and precision.
  • (p3) determines if it is sleeping (t = true, f = false).
  • (p4) determines if it is interactive (t = true, f = false).
Chair (19)
  • (p2) is the rotation, with usual values and precision.
  • (p3) determines if it is reversed (t = true, f = false).
  • (p4) determines if it is sleeping (t = true, f = false).
  • (p5) determines if it is interactive  (t = true, f = false).
Bottle (20)
  • (p2) is the rotation, with usual values and precision.
  • (p3) is the bottle type (1 to 4).
  • (p4) determines if the item is sleeping (t = true, f = false).
  • (p5) determines if the item is interactive (t = true, f = false).
Television (21)
  • (p2) is the rotation, with usual values and precision.
  • (p3) determines if it is sleeping (t = true, f = false).
  • (p4) determines if it is interactive (t = true, f = false).
Boombox (22)
  • (p2) is the rotation, with usual values and precision.
  • (p3) determines if it is sleeping (t = true, f = false).
  • (p4) determines if it is interactive (t = true, f = false).
Soccer Ball (10)
Van (0)
  • (p2) is the rotation, with usual values and precision.
  • (p3) determines if it is sleeping (t = true, f = false).
  • (p4) determines if it is interactive (t = true, f = false).
Sign (23)
  • (p2) is the rotation, with usual values and precision.
  • (p3) is the sign type (1 to 13).
  • (p4) determines if the sign post is shown (t = true, f = false).
Trash Can (26)
  • (p2) is the rotation, with usual values and precision.
  • (p3) determines if it is sleeping (t = true, f = false).
  • (p4) determines if it is interactive (t = true, f = false).
  • (p5) determines if the trash can contains trash (t = true, f = false).
Toilet (24)
  • (p2) is the rotation, with usual values and precision.
  • (p3) determines if the item is reversed (t = true, f = false)
  • (p4) determines if it is sleeping (t = true, f = false).
  • (p5) determines if it is interactive (t = true, f = false).

Token (31)

  • (p2) is the token type (1 to 6).

Finish Line (9)

Text

  • Treated as special item (sp t = 16)
  • (p2) is the rotation, with usual values and precision.
  • (p3) is the text color, with usual values.
  • (p4) is the font
  • (p5) is the font size
  • (p6) is the alignment
  • (p8) is the opacity
  • (p7) is the content of the text, written as <p7><![CDATA[HERE'S SOME TEXT]]></p7> , and is always written after the other parameters. Special characters allowed include `~!@#$%^&*()-_=+[{]};:"',<.>?/\|†™€‡•‰ along with numbers and letters from the Roman alphabet.

Groups

  • (x) and (y) are the coordinates of the group, representing the point that the group rotates around.
  • (r) is the rotation, with usual values and precision.
  • (ox) and (oy) are the coordinates for the origin of the group's local coordinates with respect to the group's center point. The objects within the group are located with respect to the coordinates of this point.
  • (s) determines whether the group starts asleep.
  • (f) determines whether the group is set to foreground.
  • (o) is the opacity of the group, with usual values and precision.
  • (im) determines whether the group is set to fixed.
  • (fr) determines whether the group is set to have a fixed angle.
  • You can't add triggers or any objects that can't be put into groups.

Triggers

  • (x) is the x-coordinate of the trigger.
  • (y) is the y-coordinate of the trigger.
  • (w) is the width of the trigger.
  • (h) is the height of the trigger. Along with the width, it is an integer clamped to [5, 5000]. Setting either to NaN will cause the trigger to disappear, but it will still have a location and can target objects, but can only be activated by other triggers.
  • (a) is the rotation, with usual values and precision.
  • (b) determines the object(s) that will trigger the action (1 to 6).
  • (t) is the trigger action (1 to 3).
  • (r) is the repeat type (1 to 4).
  • (sd) determines whether the trigger starts disabled.
  • (i) is the repeat interval (repeat type 3 and 4 only), a float clamped to [0.1, 30] with any precision. If this is set to NaN, the interval time becomes essentially 0, which may be useful for applying smooth impulses.
  • (d) is the delay, a float clamped to [0, 30] with any precision.

Sound Effects Only

  • (s) is the sound ID (0 to 325, currently). Sound IDs are numbered in the order they were added to the game. If a value is given that is outside this range, the trigger dialogue box doesn't display in the editor, and the game will freeze rendering when the trigger is activated. Interestingly, if the trigger is repeat type 3, the game will unfreeze once the triggering object leaves the trigger area.
  • (l) is the sound location (1 = global, 2 = local).
  • (p) is the panning (for sound location 1 only), a float clamped to [-1, 1] with any precision. NaN makes the panning act infinitely to the left, meaning no sound can be heard.
  • (v) is the sound effect volume, a float clamped to [0, 1] with any precision. NaN makes the volume 0.

Objects With Toggles Activated By The Trigger

  • The first item determines the layer ID of the target object type (sh = shape, j = joint, etc). If you target an invalid object, the editor will crash on testing.
  • (a) is the trigger action, starting with 0 up to the total number of possible trigger actions for that object minus 1.
  • (p0) through (p#) determines the setting for the each toggle. Generally these values are unclamped floats of any precision, with NaN values allowed, which can either be useful, useless, or dangerous.
Change Opacity
  • (p0) is the new opacity. NaN causes the opacity to instantly change to 0 (since it's trying to transition to negative infinity), while other negative values cause the opacity to transition to 0 faster. Anything over 100 causes the opacity to transition to 100 faster.
  • (p1) is the transition duration. NaN causes the object to go to opacity 0 instantly (regardless of what you set in p0), while a negative values cause the opacity to change in the opposite direction (i.e. if the object is set to increase opacity, a negative opacity causes the object to transition to opacity 0). Positive values cause the transition to occur normally (although it seems that transitions max out at around 10 seconds.)
Apply Impulse
  • (p0) is the X impulse. NaN causes the object to instantly move to the left edge, and will cause a Black Hole if the object is attached to a pin joint, or cause the Melt glitch if the object is attached to a sliding joint.
  • (p1) is the Y impulse. NaN causes the object to move to the top edge, and will cause a Black Hole if the object is attached to a pin joint, or cause the Melt glitch if the object is attached to a sliding joint.
  • (p2) is the spin. NaN causes infinite rotation, which behaves like 0 rotation.
Change Collision
  • (p0) is the new collision. NaN and values out of range [1, 7] cause the object to have collision 1, otherwise the collision truncates to the nearest integer when you test.
Change Motor Speed
  • (p0) is the new speed. NaN is infinite speed, though the object may not actually be able to reach it if the motor torque is set too low.
  • (p1) is the transition duration. NaN causes the joint to accelerate to infinite speed (if torque is high enough), while a negative value means the speed transitions to the negative of the new speed.
Change Limits (Joints)
  • (p0) is the new upper limit.
  • (p1) is the new lower limit. For both limits, NaN causes the limit to have infinite extents. Problems may arise if the upper limit is less than the lower limit (with the jointed object flickering around), but no real problems are caused by the upper limit being negative or the lower limit being positive. For pin joints, setting the new limits with greater magnitude than 180 allows you to limit the object's number of revolutions (e.g. an upper limit of 540 means that the object is limited to 1.5 revolutions in the positive rotation direction.)
Slide (Text)
  • (p0) is the transition duration. NaN causes the text to disappear. Negative values cause the text to move away from the target location indefinitely.
  • (p1) is the new X location.
  • (p2) is the new Y location. For both coordinates, the text will go offscreen if given values outside of the map. NaN values will cause the text to instantly go to either the left (X) or top (Y) edge of the map, but not offscreen, even if the duration value is negative.
Other Interesting Trigger Uses that Can Only Be Done in XML
  • You can set the target of a trigger to be itself. This is useful for repeat type 2, since you can have the trigger disable itself after it fires. Additionally, if for some reason you want the trigger to behave like repeat type 4 but be able to reactivate every time the triggering object enters the trigger, you can have the trigger activate itself after it fires.
  • You can create a looping chain of triggers such that the last trigger in the chain targets the first trigger. This essentially works the same as the above case of a trigger targeting itself, except that now the whole event chain can auto-disable or reactivate upon resolution. The only issue is that triggers in the chain are now unable to target other triggers in the editor, so if you use this, build your complete chain first before looping in the XML.

Trivia

  • The level data does not detect entered lines in text boxes, so if you are going to import level data with entered lines, the level data would not detect it and the text would be one long line.
  • If any random character or incomplete data is entered into the leveldata box and you attempt to load it, a message that says, "Invalid data" will pop up and the "XML data" will not be imported.