BigTruck's Fan Page

BOD Scripting

Creating a basic level - by SlayerDDD

In this LED tutorial, for clarity I will use the menus -
but most functions also have an icon that can be clicked if you like.

PREPARATION
You will need to have Blade installed,
with the Gladiator 0.91 Mod (by Josh Dahlby) installed and working.

CREATING THE FILE STRUCTURE
I have created a basic file setup for editing, testmap.zip

Please use these files during this tutorial and it will be easy to rename them or create
your own after learning the basics.

Create a new directory in your C:\ BoD\Maps (or similar) directory and call it 'testmap',
ie. C:\ BoD\Maps\testmap

NOTE: The drive and path may be different on your computer,
\BoD\ = the Blade of Darkness program directory.

Use Winzip or a similar utility to extract 'testmap.zip' into the \BoD\Maps\testmap dir.

When finished, you should have the following structure:

\BoD\Maps\testmap

testmap.lvl
testmap.glad
sol.py
shoot.bmp
testmap_compile.bat

\BoD\Maps\testmap\DATs

barb.DAT
blank.DAT
btomb.DAT
casa.DAT
chaos.DAT
defile.DAT
desert.DAT
dwarf.DAT
ice.DAT
island.DAT
Labyr.DAT
mine.DAT
orcst.DAT
palace.DAT
ragnar.DAT
ruins.DAT
tomb.DAT
tower.DAT
volcano.DAT


USING THE TEXTURE EDITOR (BaB.exe) TO SELECT A TEXTURE SET
Open Bab.exe

Close the console window, for the moment we won't need it.

goto menu- Archivo(File)/Abrir(Open)

in the file requester, move to the \BoD\Maps\Dwarf_M3 directory
and open the file "dwarf.mmp"

You will see a list of texture names on the left; double-click (or highlight and press Return)
on one of these and a texture pic will appear on the right.

Have a look through these textures and make a note of a few that you would like to
use in your level.

TIP: some common texture names: muro=wall, suelo=floor, techo=ceiling, arco=arch

You can leave Bab open if you like, so you can refer to it while using LED.

STARTING LED AND ADJUSTING THE VIEW
Open LED

TIP: If necessary, arrange the windows and toolbars by dragging them to the edges
of the LED window.

goto menu- View/ Center at...

This centers the view in the edit window. (very handy if you lose the map by zooming, etc)

In the requester that appears make sure that X = 0, Y = 0 (the center ;) and click OK.

Find the Info toolbar.(there are some co-ordinates X,Y,dX,dY and a setting for Zoom)

Type 10 into the Zoom setting and press the Return key to enter the value.

This should cause the edit window to refresh, and show a red X
(marking the players start position in the map)

You should also see the grid lines in light blue.

Adjust the grid by changing the drop-downs in the Grid toolbar to read:

Lineas 1.00

Also check on the Tools menu that Show Grid and Activate Grid are highlighted

SETTING UP THE TEXTURE NAMES
goto menu- File/Import Textures...

in the file requester, move to the \BoD\Maps\testmap\DATs directory containing the .DAT files,
(you might have to enter *.* into the filename box, and hit return- this will force the .dat
files to show up in the list) - and open the file 'dwarf.DAT'

then goto menu View/Palette of Textures...

and you will see all of the textures available to use from the
\Bod\Maps\Dwarf_M3\dwarf.mmp texture set.

NOTE: there will be no previews (skull in pic box), but the textures still work in the game
and in OpenGL mode.

(To see what a texture looks like, use Bab to preview the .mmp as mentioned earlier)

CREATING A SECTOR
goto menu- Tools/ New Vertex

the pointer will be a crosshair. create a vertex by left-clicking in the edit window,
and continue adding points to make a 4-sided rectangular 'sector',
size- approx 20 x 20 units.
(to close the shape, finish at the start point - the edges will change to red lines)

NOTE: This shape represents a SPACE approx 20 x 20 units, with the height being controlled
by the 'floor height' and 'ceiling height' settings in View/Properties.

goto menu- Tools/ Select Sectors

the pointer will change to an arrow with 3 dots around it.

click inside the sector you just created, and it will become crosshatched to indicate that
it is now selected.

goto menu- View/Properties...

the Properties window will appear. This window changes to reflect the type of object that
is selected.

goto the General tab, and enter the following values:

Floor Height = 0
Ceiling Height = 10

NOTE: You MUST press the Return key at the end of every changed line for the new settings
to apply. if in doubt, switch to another tab and back again to check the settings.

goto menu- File/Save As...

and save the map as 'testmap.mp' in the \BoD\Maps\testmap directory (just for luck;)

CREATING AN ATMOSPHERE
goto menu- View/Atmospheres

a window will appear, click in this window to activate it, and then press the INSERT key to create a new atmosphere.

a requester will pop up with settings for Name, Density, and Color.

give your atmosphere a Name, something like 'outside',

enter 0.01 for the Density setting,

and for Color choose a medium grey, and then click OK.

You will see your new atmosphere appear in the list, to edit an existing atmosphere, double-click on its name in the list.

Close the Atmosphere window for now.

SECTOR SETTINGS
OK, back in the editing window,

goto menu- Tools/Select Sectors...

select the sector you created before, and

goto menu- View/Properties to open the Properties window again.

this time, go to the Floor tab and you will see the following settings:

Height (this should = 0 from our changes earlier)

Spheric
Elliptic
Flat (make sure Flat is ticked for now)

A preview pic (probably with skull)

X = 0 (this is the x offset of the texture in pixels)
Y = 0 (this is the y offset of the texture in pixels)
Zoom = 10 (change this to 10, this is texture scale)
Angle = (this is texture rotation, many game textures need to be rotated by 90')

And a drop-down with a list of texture names.

select 'suelo' from this list to assign that texture to the floor of this sector.

NOTE: remember to press Return after every change to the settings in the Properties window.

next, go to the Ceiling tab and enter these settings...

Height = 10
Flat
X = 0
Y = 0
Zoom = 10
Angle = 0

Texture = 'techo'

go to the Lights tab...

Ambient (this is the light that is everywhere)
Flat (this is a single light source for the sector that doesnt cast shadows)
Exterior (this is the light color for NULL areas - the world)

NOTE: the Ambient and Flat settings have a gradient color box, Exterior is solid.
also Flat and Exterior have a coordinate setting for light placement.
you should leave these at 0,0,0 for now.

Click on the Ambient setting (the gradient),

and the requester that appears will have two color selectors;
change them BOTH to the same color, a medium-dark grey (80,80,80)

(for the moment, ignore the other settings next to the gradient, they contain placement
info that we are not using yet)

Do the same thing for the Flat setting,
except change BOTH colors to black, effectively turning the Flat lighting off.

Leave Exterior as it is for the moment (should be a light grey color)

go to the Atmospheres tab...

and select the atmoshere you created earlier from the drop-down list.

NOTE: the settings cannot be changed from here, that must be done in the
Atmospheres window.

OK- to finish off, just check all of the tabs to make sure your new settings have stuck.

Leave the Properties window open.

Make sure the sector is still selected, and this time right-click inside the boundaries of the sector. This will bring up a menu.

At the bottom of this menu, go to Select> Edges.

The Edges (Walls) of the sector will be highlighted, and the Properties window should say:

"Propiedades de lado. (4 seleccionados)" and the settings will contain a *

Enter the following settings:

X = 0
Y = 0
Zoom = 20
Angle = 90 (the muro texture needs to be rotated +90')

Texture = 'muro'

This will change the settings for all 4 walls at once.

NOTE: changing settings by multiple selection of the same object types works throughout
the program and also on walls from multiple sectors)

Just to check that the settings have been changed, goto menu- Tools/Select Walls, select just one wall at a time and View/Properties.

Close the Properties window.

This might be a good time to save the level (testmap.mp)

ADDING A LIGHT
goto menu- Tools/New Light...

You are now in Create Light mode.

click in the center of the sector, and a small lightbulb should appear there.

goto menu- Tools/Select Spots...

Click on the lightbulb you just created,
and it will become highlighted (looks like it has raised edges)

goto menu- View/Properties to open the Properties window again.

For Lights, this window has 2 tabs- Position and Light.

Position:

X coordinate = 0
Y coordinate = 0 (these will be different if your light is off-center)
Height = (change this to 7)

There is also info about which sector it is in, and an index number.

Light:

Intensity = (change this to 40)
Radius = 4
Color = (change to white)
Precision = (leave this at 0.031250 or whatever is in there already)
Visible = (unchecked)
Shadows = (checked)

NOTE: you will notice the lightbulb in the sector has changed color to
show the new color setting.

Check the new settings have stuck by switching tabs and back,

and then Save the map one last time.

COMPILING THE MAP WITH BC.exe

For easy compiling, we will use a batchfile to run BC.exe:

Use Notepad or a text editor to open \BoD\Maps\testmap\testmap_compile.bat for editing.

It should look like this:

F:\ BladED\Compilers\Maps\Bc.exe F:\ Bod\Maps\testmap\testmap.MP F:\ Bod\Maps\testmap\testmap.bw

IMPORTANT: you will need to change the drive and directories to point to YOUR copy of
BC.exe, and also to the testmap directory as it is on your computer.

when finished, save this file as \BoD\Maps\testmap\testmap_compile.bat

NOTE: DOS does not like spaces in a command line, so make sure there are no spaces in the path to BC.exe or the map file.


Now you can double-click the .bat file to compile the 'testmap' level.

A DOS window should pop up, as well as 2 windows from BC.exe:

"Ventana Mensajes" is to report any errors.

NOTE: You may possibly get an error message, something like:
Error al abrir película.Error al reproducir película.Error al abrir película.Error al reproducir película.
I'm not sure what this means but it has not been a problem for me, the level works as expected.

"Compilador Blade" has a area with info on the compilation, and a button "Aceptar"

click this button to continue, and then close the DOS window.

Check the \BoD\Maps\testmap directory for 2 new files:

testmap.bw (the compiled map)
DefCh.txt (error messages log)



Thats it!

You can now run Blade and Gladiator, and you can choose your new level from the map select screen.

Good Luck and Have Fun!

EXTRA NOTES:
To make a window, create another sector outside of the main room,
but touching the edge of the sector; some example settings:

Floor Height = 2
Ceiling Height = 5

give the floor/ceiling and edges the 'muro' texture,
then select the OUTSIDE edge/wall of this window sector,
and assign it the 'NULL' texture (to see through to the external "world").

To select just one wall or vertex when they are overlapped, double-click on that item and select the sector it belongs to from the requester that pops up.

OpenGL Mode enables texture manipulation with real-time visual feedback, more about that later.

Remember that you are creating spaces in a solid block and it will all make sense.

I have commented the .lvl and .glad files to help you understand them.

Use Debug mode to find spawn points for monsters. (see LED Notes for info)

There are many other features and possibilities with LED, but this should get you started :)