When
you launch Sketchup, you're presented with a new, empty model. However,
depending on how your Preferences are set, the one you get may not be
set up the most convenient way for MarathUp. So close the default
document window and open the Preferences window. (It's under the SketchUp application menu on MacOSX; I'm not sure exactly where it is on Windows.)
Set
the Template to "Inches (Woodworking)-3D". Now close the Preferences
window and use File>New to create a new document. You should get
something that looks like this:
We won't be using the set square, so click on it so that a highlighted box appears around it and press the Delete key.
MarathUp assumes that the model is drawn to a
scale of 1 inch to 1 world unit, so the next thing we need to do is
check that the units are set up correctly. Choose the Windows>Model
Info command. You should get a dialog like this:
Make
sure the Format is set to Architectural and Inches. For now, turn on
length snapping and set it to 1 inch. This will make it easy to build
structures in multiples of world units, which we'll want to do in the
early stages of constructing our level. We can change it later when we
come to add fine details. When you're done, close the Model Info window.
Importing Textures
Although
the textures applied to the model in Sketchup don't have to be the same
as those used by Aleph One at playing time, it's helpful if they're at
least similar so that you can see how the level will look. The easiest
way to do this is to extract the textures from the Shapes file using
ShapeFusion or otherwise, and import the resulting image files into
Sketchup as textures.
MarathUp includes a script which will
import a collection of textures and set them up in the right way for
the exporter to use. It assumes that the image files for each texture
set are in a folder named Walls<n> where <n>
is a number from 1 to 5. Within the folder, the image files need to be
named so that they appear in the right order when sorted
alphabetically. Applying ShapeFusion's Export Bitmaps command to a wall texture set will produce a suitable set of files.
The MarathUp distribution comes with one set of wall textures to use as an example, in the Shapes/Walls1 folder. To import these, choose Plugins>Marathon>Import Textures and select one of the .bmp
files in that folder. (You're really specifying the whole folder, but
Sketchup doesn't currently provide a way of letting you choose a
folder.)
To see the textures, choose Windows>Materials to open the Colors window:
If
they're not already selected, click on the "brick" icon at the top, and
choose Colors in Model from the drop-down menu. You should see the
imported wall textures.
To see how the wall textures have been
set up, double-click on one of them to open up a further pane at the
bottom of the window:
You'll
see that the name of this texture has been set to "17-0". That's
because the "Walls 1" texture set is collection number 17 in the Shapes
file, and it's the first texture in that collection. This is how the
export script knows which texture it corresponds to.
Also, the
Width and Height of the texture have been set to 1", or 1 world unit.
This is not required by the export script, but it ensures that the
texture will appear the correct size when you place it in the model.
The
Width has been made negative to mirror the texture, so that it will
appear the right way around when applied to the back of a face. Due to
the way MarathUp models are constructed, you'll be texturing the back
sides of faces almost all the time.
Important: When you've finished looking at the lower pane, click the Close button down the bottom to close it! If you don't, you run the risk of accidentally modifying the texture later.
Creating a Texture Library
Rather
than importing all the textures into every level you create, it's
handier to put them in a texture library. To do this, make sure you
have "Colors in Model" selected, drop down the List menu at the bottom of the Colors window and choose Duplicate. Give the new list a suitable name, such as "M2 Walls 1", and save it.
Now
you have a copy of the Walls 1 textures stored away where you can
easily use them in any Sketchup model. Once you've done that, you can
delete them from the model itself. To do this, switch back to "Colors
in Model" (the "Home" button at the top is a shortcut for that), and
from the List menu choose Purge Unused.
The
advantage of doing this last step is that only the textures you
actually use in the level will be stored in the Sketchup file. Since
Sketchup stores its textures totally uncompressed, this can make a big
difference to the size of the file.
Before leaving the Colors
window, switch to the "M2 Walls 1" texture collection that you just
created (or whatever you called it), so you'll be ready to use them in
what follows.
Creating a Floor
Now we can start building a level. Choose the Rectangle tool
from near the top of the tool palette. Move the mouse over the model
window until it's near the origin, where the three coordinate axes
intersect. It should "snap" to the origin and a yellow dot appear.
Click and drag a short distance so that a rectangle appears,
aligned with the horizontal plane (red and green axes). The Dimensions
box at the bottom right corner of the window shows you the size of the
rectangle as you're dragging it out, but it doesn't matter what the
size is -- we'll fix it in a moment.
Now, before doing anything else, type 3,2 on the keyboard and press Enter. The rectangle will change to the new size (in inches) that you have specified.
(Note:
If you've done something else in the meantime, you may have lost the
chance to type in the dimensions. If that happens, Undo until the
rectangle goes away and start again.)
If it looks as
though the rectangle has disappeared, that's because we're zoomed too
far out to see it easily. To fix that, click on the Zoom Extents tool
near the bottom of the tool palette. This re-sizes the view to fit the
model. You should now have something like this:
The
face we've just created is going to become the floor of a Marathon
polygon. We will need to build upwards from it, so use the Pan tool to drag the view downwards so the rectangle is near the bottom of the window.
It's
probably a good idea to save the Sketchup file at this point, under
some suitable name such as "Example1". You may also want to save after
successfully completing each of the steps below, in case of accidents.
Adding Walls and a Ceiling
Now switch to the Push-Pull tool ,
click in the middle of the rectangle and drag upwards. This extrudes
the 2D face out into a 3D structure. You'll need to drag almost all the
way to the top of the window before anything happens, and then it will
snap out to a height of 1 inch (because that's the snapping distance we
set in the Model Info window).
We
now have six faces making up a rectangular block. When we export the
model as a Marathon level, these will be translated into a single
Marathon polygon. The top and bottom faces will become its ceiling and
floor, and the side faces will become walls.
Before we can usefully export it, though, we need to apply some textures.
Adding Textures
A small problem we face here is that the textures need to be applied to the inside
surfaces of the faces we've created, because that's where the player
will see them from. To do that, we need to temporarily hide at least
one face so we can get at the interior.
Using the Selection tool ,
click on the top face of the block (the ceiling) to select it. The face
is displayed with a dotted pattern to indicate that it is selected. Now
choose Edit>Hide. The ceiling becomes temporarily hidden, resulting in a view like this:
To get a better view, switch to the Orbit tool , click in the window and drag downwards to rotate the view a little until you get something like this:
You'll notice that the inside surfaces are displayed in purple. Each face in Sketchup has a front and a back
surface, and the default colour scheme displays the front surfaces in
white and the back ones in purple. This is important, because the
export script assumes that the back surfaces of floors, ceilings and
exterior walls face towards the inside of their respective Marathon
polygons. The fact that all the inside surfaces of our block are purple
is good, because it means the faces are the right way around.
(If
you ever find you have faces that are the wrong way round, you can fix
them by selecting the faces, control-clicking to bring up a contextual
menu, and choosing Reverse Faces.)
Now we're ready to apply some textures. If the Colors window is not already open, bring it up using the Windows>Materials
menu command. (It's a bit confusing -- the menu command is called
"Materials" but the window is titled "Colors".) Make sure that you don't
still have the lower pane of the Colors window open. If you do, click
the Close button at the bottom. Also, if you don't have the texture
library that you created earlier in view, select it from the menu at
the top.
Now
pick a texture that you'd like to apply to the walls and click on it.
This will automatically switch you to the Paint Bucket tool . Click on the insides of the walls to apply the texture to them.
Now use the Orbit and Pan tools
again to rotate and position the view until you can see the insides of
the other two walls. Just for variety, let's choose a different texture
to apply to them.
While we're at it, we'll also apply a texture to the floor.
Finally, we need to texture the ceiling, but we'll need to make it visible again first. Choose Edit>Unhide>All, then rotate the view upwards () so you can see the bottom of the block, select () the floor, and choose Edit>Hide. You should be able to see the underside of the untextured ceiling now:
Choose a likely-looking texture for the ceiling and apply it:
Setting the Start Position
There's
one more thing we need to do before exporting -- we need to add a
Player object to the level, so that the starting position is specified.
Objects
such as players, monsters and items are represented in the Sketchup
model by placeholder objects. It doesn't matter what the placeholder
looks like, but it's a good idea to use something with mnemonic value.
The MarathUp distribution includes a Sketchup file called Objects.skp containing predefined objects representing a few of the available Marathon objects (more will be added in a later version).
Before
adding a player, we need to get access to the floor again. Unhide
everything, rotate the view back down until you're looking down at a
fairly steep angle, and hide the ceiling again. You should be getting
fairly good at this sort of thing now, so I won't go into step-by-step
details. You're after a view like this:
Open up Objects.skp now. It should look like this:
Here
we've got a Player, four kinds of Pfhor fighter, and a clip of pistol
ammo. (There are also some other objects in there that we'll come to
later.) Select the Player (a blue box should appear around it) and Copy it. Then switch back to your example model window and Paste.
The cursor changes to the Move tool , waiting for you to position the
pasted-in object. Click somewhere on the floor away from the walls. If
all goes well, you should see something like this:
The newly-pasted object is selected and the Move tool
is still active, in case you want to reposition it. In this case it's
fine where it is, so we can just deselect it by switching back to the
Selection tool and clicking somewhere on the background. You
may want to rotate the view to a shallower angle to get a better idea
of how the player is positioned vertically. His feet should be just
touching the floor.
Exporting the Map
Now we're ready to export. Go to the Plugins menu and choose Marathon>ExportMap. If all goes well, you should get a confirmation like this:
If
you've followed the tutorial steps exactly, there shouldn't be any
problem, but it's possible for there to be errors in the model that
prevent a Marathon level from being constructed from it. If that
happens, you'll get an error message, and you'll need to correct the
problem -- more on that later.
If nothing appears to happen at
all, it's possible that the Ruby script has crashed. This would
indicate a bug in the script, in which case I'd like you to tell me
about it. See Troubleshooting for how to get diagnostic information to send me.
Assuming
the export is successful, there should now be a file in the same folder
as your Sketchup file with the same name except for a .sceA extension. This is a map file that Aleph One should be able to open and play.
Testing the Map
To
test your map, you need to set up an Aleph One installation containing
appropriate files. Create a new folder and copy the
following things into it:
The Aleph One application.
A
set of valid Shapes, Images and Sounds files from another working
Marathon 2, Marathon Infinity or Aleph One based game. For this
example, the ones from Marathon 2 itself should be fine.
The Scripts folder from the Tutorial folder in the MarathUp distribution.
This contains a text file called Files that tells Aleph One which map
file to use. It's set up assuming the map file is called Example1.sceA; if you've called your map something else, you will
need to either rename the map file or open the Files file with a text editor and
modify it to suit.
Now
launch Aleph One and hit Begin New Game. You should end up in a room that
looks a lot like what you just made in Sketchup. Spin around and take a
look at the scenery.
You may find some odd things happening if
you try to move around, though. This is because Aleph One can't handle
maps consisting of just a single polygon properly. Things will get
better when we add some more polygons in Exercise 2.