  Arts for miscreants: making levels
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. PRE-REQUISITES

If you want to make a level (or convert a Liero level, for that matter), you
will need the Weapon Construction Kit. If you are making a new one, get some
Liero map editor, since the files are compatible.

It's highly recommended to have read the MKWPN.TXT file. Have a nice 550 lines
of text! (Just kidding, you'll need only the Chapter 6 which is at the very
end of the file, unless you make trigger maps)

2. CONVERTING LIERO '.LEV' FILES

Well, you don't actually convert them, you only package them. Change extensions
of all '.LEV' files to '.VLV'. Create a '.VLT' file with friendly description
for each map (the '.VLT' file has to end with a [Enter] and is named just like
the level).

Create a '.VLF' listfile (I told you to read the MKWPN.TXT, Chapter 6; it's in
the Hint) and build it with LAC. This way you can package multiple '.LEV' files
into one '.VPK' file.

3. MAKING TRIGGER MAPS

Read the whole MKWPN.TXT file. When you are done, come back.

You can place any number of programs and projectiles and sprites and sounds and
even weapons (though I don't actually know what for) inside the map package. It
is actually your ordinary '.VPK' package. But, there is one special program: it
is named exactly like the '.VLV'. This one gets executed when the game is open.

You can create projectiles there, maybe some that will call some program every
frame to check for some triggers, it's up to you (have a look at the WINDOWS
BOX weapon sources, there is a WINBXL projectile that's invisible and serves
only as a timer; I think of something like this).

4. MAKING TRIGGER MAPS SIMPLIFIED

Use the LTk, Level Toolkit. There are three objects in LTk 1.1, namely doors,
elevators and scaffolding. The elevator can be placed with the following
commands:

  SetSrc <X>,<Y1>
  Create Projectile[ELEV],<Y2>,<T>

The elevator will be placed at <X>,<Y1>. When some worm steps on it, it will
start moving up to <Y2>. Then it will stop for <T> 1/36ths of second and move
down. The elevator is 29 pixels wide. Going down on it is a moderately nice
experience (you can't jump and shooting is harder).

You can add doors. There are four kinds of doors. One (projectile DOOR) will
open only when damaged. The other will sense approaching worms. The DOORL opens
when a worm comes from the left, DOORR - from the right, and DOORLR - from any
side. You can dig through them, but it's really slow. They can be created with:

  SetSrc <X>,<Y1>
  Create Projectile[DOOR<D>],<Y2>,<T>

Door will be resting at <X>,<Y1>. When activated, it will start moving up to
<Y2> and stop there for <T> 1/36ths of second. Next they will close. They are
4 pixels wide and 24 pixels tall. <D> is the door kind.

The scaffolding is not a projectile, but merely a generated terrain part, so it
is created in another way. The memory cell 0 has to hold the X position, the
cell 1 - Y position, the cell 2 - number of segments (each segment is 8 pixels
wide, plus 1 pixels on each end of scaffolding). The scaffolding is 8 pixels
high. Example:

  Let 0,10 ; position X
  Let 1,10 ; position Y
  Let 2,5  ; segment count
  Call Program[SCAFF]

This code snippet will create a scaffolding that is 8 pixels high and 42 pixels
wide (yeah, 42). You can't create scaffolding with less than 1 segment (sorry).

Note that LTk is written entirely in the scripting language.

5. CAPTURE THE FLAG

All that is needed for a Capture the Flag game is a short program that will
give the flag coordinates, so that flags will be placed in a predictable
manner. I think it could be:

  IfNE Mem[2],1 @No1
  Let 0,<BlueX>
  Let 1,<BlueY>
No1:
  IfNE Mem[2],2 @No2
  Let 0,<GreenX>
  Let 1,<GreenY>
No2:

Name it somehow (NOT like the map!) with extension '.VPS'. Create a program,
named just like the map, also with extension '.VPS'. Write:

  Create Projectile[CTF],Program[<PlaceProggy>]

Instead of <PlaceProggy>, you should use the name you gave to the placing code
(without '.VPS'). This will do.

6. TERRAIN GENERATORS

You must know how to make menus (MKWPN.TXT, Chapter 5). Also, of course, how to
program scripts.

Now you will create a new great file type, terrain generator '.VTG'. This must
contain only two lines:

  Name=<N>
  Menu=<M>

The name <N> is the name displayed in the level list. I suggest that you mark
somehow that the terrain is generated. The <M> field contains the menu to be
invoked when the user selects your terrain generator.

Now, create the menu. You may place whatever parameters you deem useful for
your generator, and one button: Generate (this is the only button you should
ever use). Of course, you may name it as you see fit, but you should follow
the below scheme:

  Button=Generate
   Event=SelTerrain
   Value=$THECODE

where THECODE is your generator program. The 'SelTerrain' special event, well,
it selects terrain, and the $ means it should call your generator. You may ask,
why don't I use:

  Button=Generate
   Event=THECODE

which seems to have the same effect. Well, try it with network mode... hahaha.

Remember that all options not counting this one should be made 'Transferable'.
Also, make the first instruction in your level generator be 'TerrainSeed'. If
not, the generated terrains will most probably differ between machines on the
network (and desync is something you want to avoid).

If you want your level to have triggers, use the 'SetLaunch' script mnemonic.
It will take one program as parameter and spawn it when the game begins.

7. NAMING CONVENTION

It's recommended that you use some highly distinctive names for your creations.
If you don't, they might crash upon loading, or at least be ill-behaved. I'd
propose a convention: every map should be named with:

 * one letter of your name,
 * four letters of your surname,
 * two digits of your own map number.

This should prevent most crashes, unless you are John Smith or Jan Kowalski (a
rough Polish equivalent ;-). For instance, my maps are named SSKOW**.

This information is above your security clearance. Would you please shoot
yourself now? Thank you very much for your cooperation.

Stanislaw Skowronek, thesis@elementy.pl
