Thrust -- Level description
Thrust -- Level description
This text describes how to construct a new level and what changes
needs to be made in the source code to include it in thrust. I hope
it is sufficient and clear, please mail and ask if it is not. All
referenses to files are relative to where you have installed the source
of thrust.
Changes to the source code
- A level is defined in a file named /datasrc/level*.def, where * is a
number of your choise.
- With this file in place, the Makefile should be updated to include
the new level. Include the name level*.o (with * substituted with
whatever number you choosed above) in the variable 'DATAOBJS'. This
variable is defined at line 35-40 (approximate) in the top Makefile
(i.e /Makefile).
- Futhermore, /src/thrust.h includes a define that states how many
levels there are. This file also declares the level variables as
extern and this needs to be done for new levels as well. Look at lines
20-30 (approximate) in this file.
- As a last step the static variable 'levels' in the function game() in
the file /src/thrust.c should include the level variable. The last
time I looked this was at line 230.
How to build the file 'level*.def'
A level is made up of blocks (8 by 8 pixels) and these blocks are
drawn in a textfile. Since some sections of a level are the same for
all levels these sections aren't drawn by hand for each
level. Instead these sections are characterized by their size.
The level definition begins with 8 numbers. These numbers describes
how large the level and it's different sections will be. They also
defines the color of the bedrock. There are four sections in a
level. The uppermost section is filled with stars and the section just
below this section is empty space (black). The section at the bottom
will be filled with blocks forming the bottom of the bedrock. This
leaves us with one section where the cave can be drawn.
------------------
| |
| Stars |
| |
| |
|------------------|
| Empty space |
|------------------|
| |
| Cave |
| |
| |
|------------------|
| Bedrock |
| |
------------------
The eight numbers mentioned above are
- <width>
- <total height>
- <height of 'Stars'>
- <height of 'Space'>
- <height of 'Bedrock'>
- <red>
- <green>
- <blue>
There can be only one number per line. The order is important
and there can be a comment after the number itself but not before.
- <width> should be a multiple of 41 and at least 82.
- <total height> has the limitation that <total height>*<width>
should be less than 11316 (12 screens 41*23*12).
- The sum of <height of 'Stars'>, <height of 'Space'> and <height
of 'Bedrock'> should be less than <total height>. One can note that the
Bedrock section should be at least 20 blocks high or the level will not look
right.
- <red>, <green> and <blue> defines the color of the ground.
These numbers should be in the interval [0, 255].
The difference between the above sum (point 3) and the total height (point 2)
defines how many rows the definition of the cave is. Each row of the
cave-definition should be at least <width> characters long. Only the
first <width> characters are used; any characters to the left of these
will be discarded.
The definition of the actual cave is drawn after these 8 numbers. Each line
in the file will translate inte one row of blocks and should therefore
be at least <width> characters long. Empty spaces at the end of the
line are NOT implicit and must be included to get a well defined behaviour.
You can draw an invisible barrier in a cave by inserting the character
'#'. This is done in order the make stages withing the
level. It's nice with some stages so that the whole level doesn't have
to be completed without a crash. Typically these barriers should be
drawn so that it's impossible to pass the barrier without passing at
least one of the '#':s. When the ship passes such a barrier, the ship
will restart at the closest '*' when/if there is a crash. Take care
when positioning the '*' so that it works for a lone ship as well as
for a ship connected to the green blob. Also take care so that it
works for reversed gravity. The risk is to position the restart
point in a way that makes the ship crash immediatly when put in that
position. Look at the 2nd restart point in level 4
(/datasrc/level4.def) to see how much space is needed above and below
the restart point to make it 'safe'.
A think that all levels should have at least one restart point and one
barrier that has to be passed in order to pick ut the blob. If this is
true you don't have to pick up the blob more than once.
There is a maximum of 512 barrier-'#' and 16 restart-'*'. Tell me if
you need more (or look in '/src/thrust.h').
Below is a short description of the different building blocks for the
cave. If you have trouble, you can always look at the included levels
or you can send me an email.
An example is also available.
And don't forget to send me a copy if you have created a nice level.
The things in the cave
The objects in the cave can be separated into two groups. Things you
can shoot at and other things.
Things you can shoot at in the cave
(maximum 32, tell me if you need more)
Fuel
`a
bc
The fuel is a four block structure.
Power plant
def
ghi
jkl
The power plant is a 9 block structure.
There should be exactly one of these in a level.
Buttons
xL
M
The 'x' can be exchanged for any character. All buttons
with the same 'x' are connected and have the same effect when
hit by a bullet. The 'x' will be replaced with a 'p' (solid
ground).
xN
O
The 'x' can be exchanged for any character. All buttons
with the same 'x' are connected and have the same effect when
hit by a bullet. The 'x' will be replaced with a space.
Guns
PQR
S
UVW
T
[
XYZ
\
]^_
Other things in the cave
The green blob
m
There should be exactly one of these in each level.
Sliders
(Maximum 16, tell me if you need more)
Sliders are triggered by shooting at the closest button (or one
equivalent to it, see the description of the buttons) and there can be
any number of p:s in between the to endpoints.
FpppppH
When triggered, the cave opens from F to H.
HpppppG
When triggered, the cave opens from G to H.
I
p When triggered, the cave opens from I to K.
K
K
p When triggered, the cave opens from J to K.
J
Building blocks for the ground in the cave
p
q
r
s
t
u
v
w
x
y
z
{
}
|
~