# The Level File Format.

Each level of the game is defined by a 'level' file. The level files are stored in the 'data' directory and are named 'levelN.dat' where 'N' is the level number.

Levels must be consecutively numbered without gaps starting at zero. Level zero is the 'training' level, so the game normally starts for real at level 1.

There is one special level file called "the_end.dat" that is loaded in place of any missing level and is supposed to be the end of the game.

The 'level' files are ASCII text with each line of text being a record. Records that start with '#' are comments and will be ignored.

Some lines in the file will change the behaviour of the game, others will cause 3D objects to be loaded into the scene.

## Coordinates.

Coordinates are in the same units as the models, which is nominally one meter per unit. That's only an abstract idea of a unit since this would make Tux be about the same size as a normal human (which is definitely on the large side for a Penguin).

In many cases, the 'level' file only requires you to input an X and Y coordinate - in those cases, the Z coordinate (height) is determined from the highest point in the scenery loaded by that point.

This makes it important to keep the lines in the level files in the right order. If you want a golden herring on top of a box, you must list the 3D model containing the box BEFORE the herring, and the herring will be placed on top of the box.

## Behaviour Records.

      CAMERA ,,,

This sets the initial camera position relative to Tux. pan and elevation are in degrees, range is in the same units as the rest of the database with is in units that are about half the height of Tux. The 'follow' flag is '1' if the camera should follow Tux, '0' if it should not.

      SKY ,,

Sets the sky colour - each colour component is in the range 0..1.

      OCEAN
      ICE
      LAVA
      BLACKHOLE

Puts in a layer of water, ice or lava at zero altitude throughout the scene. The BLACKHOLE setting puts a black surface 20 units below zero altitude - and arranges that Tux will die if he falls that far.

      MESSAGE ,,,

This causes a message to pop up whenever you get within the specified radius of the specified coordinate. The altitude of the test point is set at the height of the terrain at the point. The text of the (two-line) message is set in line1 and line2. Replace spaces in the message with underscores. eg: `MESSAGE 10,20,5,Tux_the_Penguin A_Quest_for_Herring` Messages have to be fairly short in order to fit into the limited space available on-screen.

      LIFE ,

Puts an extra 'life' for Tux at the specified coordinate at an altitude measured from the highest point on the terrain.

      YHERRING ,
      GHERRING ,
      SHERRING ,
      RHERRING ,,

Places a yellow (Gold), green, silver or red herring at the specified coordinate. The 'type' field could be applied to any colour of herring - but conventionally is only applied to Red herrings.

Type is one of:

      SUPERTUX -- Turn Tux into 'Super Tux'
      ROCKET   -- Give Tux a rocket pack.
      GUN      -- Give Tux a rocket pack with a laser gun.
      PARTYHAT -- Give Tux a Party-Hat
      BOWTIE   -- Give Tux a BowTie
      SHADES   -- Give Tux a cool pair of shades.

Other types will be added over time.

      TELEPORTER ,

Places a teleporter at the specified coordinates. Each teleporter sends Tux to the next one in the level file - and the last one sends him back to the first.

      WHALE ,,

Places 'Freeware Willy' - the killer whale at the specified coordinate - just below zero height - pointing in the direction specified by 'heading'. This had better be in some nice deep water!

      TUX ,,
      TUX ,,,,,

Places Tux at the specified location - facing towards the specified heading.

      RACE ,

This is for 'race' levels. To win the race, you have to reach the finish line before 'time_limit' is reached. If you succeed then is turned OFF (which removes the glass case around the gold-herring prize).

      EXIT ,,

Creates an exit building (models/folly.ac) at the specified location. 'where' is either the number of another level, or 9999 to take you back to the start room. The 'magic' value -1 is reserved for the start room and has a very special meaning associated with that room. The game ends if Tux hits an exit to a level that does not exist. Please use '9998' for that 'game over' level.

      HEAT

Sets the rate at which Tux heats up just by being in this level. Most levels will be zero (which is the default), the hottest level so far is set to 0.04 degrees C per frame.

      SPACE_HELMET

Tux appears wearing a space helmet.

      NO_AIR

Indicates that this level has no breathable atmosphere. (eg Underwater or Outerspace)

      SQUISH_PAIN

Sets the amount of pain Tux suffers when he is squashed flat. The default is three units. This is used to make Tux die when squished in the Frogger level.

      MUSIC "mods/.mod"

Selects the music to play during this level. If no music is selected then whatever music was playing before will continue to play.

      "filename" ,,,,,
      "filename" ,,
      "filename" ,

Places the 3D object specified by 'filename' (which should be placed into the 'models' directory) at the specified position and optional orientation.