The TWIGZ Engine & SDK

Tutorial:
Note: all examples in this tutorial use Adobe Photoshop for image editing and Microsoft Notepad for text editing

Tools Needed:
- an MS-DOS text editor, windows "Notepad" works fine
- an image editor that can save in ".gif" format (should be able to manipulate the 256 color palette) Adobe Photoshop is recommended, but very expensive.
- the TWIGZ Engine & SDK

Procedure:

Step 1: Creating Costumes
Step 2: Draw the Room Graphics
Step 3: Create Room Masks
Step 4: Create the Level File
: Load the Images and Draw the Polygons
Step 5: Creating the Level File: Create the Matrix and Select the Midpoints
Step 6: Creating the Level File: Loading and Placing Objects
Step 7: Creating the Level File: Color Rotations
Step 8: Saving the Level File


The Room Editor in action

Step 1: Create your main character (the Ego)
- Open up photoshop and begin drawing, using the "Pencil" tool to draw pixel by pixel. It helps to use multiple layers for the head and the body as they will ultimately be saves separately.
- You must draw at least the number of images in the first four sets as listed in the table below (the fifth set is optional):

Set 1: Walking with Head
Number of Images
Description
4 Walking Right
4 Walking Left
4 Walking Front
4 Walking Back
  
Set 2: Standing (Headless)
Number of Images
Description
1 Standing Right
1 Standing Left
1 Standing Front
1 Standing Back
  
Set 3: Head Talking
Number of Images
Description
4 Talking Right
4 Talking Left
4 Talking Front
4 Talking Back
  
Set 4: Head (Standing & Blinking)
Number of Images
Description
2 Regular Right / Blink Right
2 Regular Left / Blink Left
2 Regular Front / Blink Front
2 Regular Down / Blink Down
  
Set 5: Full Animations
Number of Images
Description
# Special Event 1
# Special Event 2
# Special Event 3
# Special Event 4
# Etc.

Once all these images are drawn, they are to be placed in a neat layout on a 320 x 200 picture and saved as a photoshop ".psd" file for now.
WARNING: You may only use 63 colors (the 64th, color number 255, is used for transparency) TOTAL to draw the Ego, any Actors that may appear in your game, and ALL inventory items.

Below is an example of the minimum pictures necessary for the Ego, all compiled onto one picture:

Since the Ego is the only actor with the ability to walk, walking animations are not necessary for any other actors. All other actors need sets 2 - 4 completed (minimum). The Ego's sprites along with all other actors' for the room you are working on need to be able to fit on two of the 320 x 200 ".gif"s like the above example. Keep in mind they must all adhere to the 63 colors maximum!

- Before you can save these sprite sheets as ".gif" files I recommend saving them as photoshop (.psd) files. Now you must do some palette manipulation (This is a little annoying, but this is the only time you have to do this!)

Step 1
Go to File -- Save As, choose GIF from the "Format" drop-down menu. Enter a file name and click "Save"
Step 2
If asked to Flatten All Layers, select Yes
Step 3

When the indexed color dialogue box appears, select "Custom" from the "Palette" drop-down menu. With the above picture I saw the following dialogue box:

Step 4
Since the first color is the transparent color, I want to change it to the last color. Since the TWIGZ Engine allows for a total of 64 constant colors, the first four rows of this palette should be filled. So click on the FIRST LITTLE BOX IN THE FIFTH ROW! Click on the transparent color somewhere in your image and the box should change to that color. Now I know what you're thinking, "That's 65 colors!" We will fix this in a second.
Step 5
Click "Save" and save these 65 colors as "Constants.act" then click "CANCEL" in the Color Table box after saving.
Step 6
Go to Window -- Swatches and the Swatches window should appear. Click on the bluish "Right Arrow" in the upper right corner and select "Replace Swatches." Change the "File Type" drop-down menu to "Color Table (*.act)" and load your "Constants.act" file.
Step 7
Here's where we get rid of that 65th color. Right-click on the upper-left color (or where ever your transparent appears, besides the last color) and select "Delete Swatch" and viola your 64 constant colors are set (any colors that are unused should be black, and you can set these colors at your leisure). Now click on that bluish "Right Arrow" and select "Save Swatches" and call it something along the lines of "Final Constants.aco"
Step 8

It is important to note one thing here, if you plan on using the Default TWIGZ GUI (Graphical User Interface) and Fonts then the following colors must be set constant.


Note: Color 255 must be your Transparent color, and is the LAST color in the palette.

Color 244 should be set to the color you want your fonts to be.

Color 245 is the color you want the verbs to be (such as Give and Pick Up etc.) and is also the color for the exit arrows and the active mouse cursor.

Color 246 is the background color seen on the verb squares (shown as a slightly darker blue) this is also the color for the inactive mouse cursor)

Color 247 is the color for the lines that make up the GUI (shown as a dark, dark blue)

Color 252 is the border that surrounds the Dialogue Fonts, shown as a Red color (This should be set to Black, unless you want a different look)

These can all be set from within the TWIGZ Room Editor so you're in luck.

Step 9

REPEAT STEPS 1 - 3, except this time click on the every color in the first row and set them to 16 DEFAULT DIALOGUE COLORS (I recommend the ones below).

Save this as "Dialogue.act" and then click "CANCEL"

Step 10

REPEAT STEPS 1 - 3, except this click "Load" and load "Dialogue.act" then click on the first color box in the second row and drag your mouse, while holding down the mouse button, to the last color box of the fifth row from the bottom (leaving four rows of unselected boxes below it). Set all of these colors to black.

Save this as "Dialogue Black.act" and then click "CANCEL"

Step 11
Finally, go back to the Swatches window and click "Replace Swatches" again, this time load "Dialogue Black.act." Then click on "Load Swatches" from the same menu and load "Final Constants.aco" and you have yourself a final color palette for all your costumes, inventory items, and actors.
Step 12

Once this is all set up your Swatches window should look like this:

Click on that bluish arrow again and click on "Save Swatches" save this file as "Final Palette.aco"

- When you are finished with all your drawing and you have your final two sprite sheets like those below you are ready to save your ".gif" files. Complete Steps 1 - 3 from the above table, this time click "Load" and load "Final Palette.aco" (you will have to choose "Swatches (*.ACO)" from the "File Type" drop-down menu). Click Okay and save the pictures in your "TWIGZ SDK\Images" folder.

.......

- Open your "TWIGZ SDK\Images" and drag all ".gif" files, on at a time, onto "BS2Make.exe" (special thanks to Vohaul Enterprises for creating this program) which will create files of the same name except with extension ".bs2"

- Next, run "RoomEdit.exe" (found in your TWIGZ SDK folder).

- Simply click on the "Edit Costumes" button and when prompted, simply enter the file names for your sprite sheets (i.e."mypics" and "mypics2") and press enter.

- Select images in the exact order (from top to bottom) they appear in the table above. So the first picture selected would be the first frame of the character (with head) walking right, the second image would be the second frame of the character (with head) walking right, and so on. After the first 16 (4 for each direction) images are selected. The next images selected should be the character facing right without a head, then the character facing left without a head, and so on. EVERY CHARACTER NEEDS A MINIMUM OF 44 IMAGES SELECTED (however, since the Ego is the only character that can walk, you may select 16 random areas for any other characters first 16 images).

- Below is a listing of the Costume Editor's Buttons:

Button
Action
Left Mouse Button
Start Drawing Selected Area
Right Mouse Button
End Drawing Selected Area
P or p
Save Presets
L or l
Load Presets
Space
Next Page
U or u
Undo Selection
S or s
Save Costume File
Escape
Quit

- When you have completed selecting all images for all actors in the appropriate order, you may save the costume file by pressing "S" and following the on-screen prompts.

-What are presets? Presets allow you to easily re-select images, so that you don't have to re-select all of the ego's images for each new room. Once you have all of the selected areas you wish to keep, just simply press the "P" key and enter a filename without and extension. Keep in mind, the presets remember not only the box coordinates but also the page number they are on. So if your sprite sheet is on page 1 when you save the presets, it should be on page 1 when you load the presets. Preset files can be found in your "TWIGZ SDK\Costumes\Presets" folder.

Back To Top

Step 2: Draw the Room Graphics
- Open Adobe Photoshop and create a new image with a height of 144 pixels and a minimum of 320 pixels wide (960 pixels maximum).

- The tricky part is deciding where to draw certain objects. Objects that you would like the Ego to interact with (i.e."Look At") but not physically interact with can be drawn directly onto the room image itself. For example, a door that can never be opened (so the door's image will never change) can still be looked at and etc. however no separate images are needed for this process. However, a door that can be interacted with and opened and closed needs extra images.

- Based on what will work best for your situation you must decide how to design these physically interactive objects. If you decide you would like the door to start by being closed, then you can draw it closed on the actual room image. Then you can make another image of the door in an open position and when the Ego opens the door, this image will be drawn.

- Once you have all those details figured out, you should have two separate images like those shown below:

- As you can see, the sign off to the right is shown WITH the shovel in the room image, however on the object sheet it is shown WITHOUT the shovel (since the shovel can be picked up).

IMPORTANT

If you plan on creating an object with more than 1 image, all subsequent image must be the same size as the first. When an object is placed on the room image the "HOT" area for that object starts at the X,Y coordinates that the object image was placed and the "HOT" area's width and height are the same size as the object image's. If subsequent images were to change size then the engine would still place them at the X,Y coordinates but their difference in size would result in a shifting of the animation. If it is necessary just make the extra space transparent, this will solve any problems.



- Before you go on, we must discuss Palette Rotation. Palette Rotation is a way to achieve animation without animation. For an example, the EYES in the TWIGZ Demo glow and change color, yet they are not animated. The TWIGZ Engine supports 5 separate palette rotation colors. If you plan to use palette rotation in your room then you must do the following:

Set aside one color that will not be used ANYWHERE ELSE in your image except in places you wish a rotation to occur. This will be your first rotation color. Let's say this is used to show a glowing button. Draw the button in this special color on the room image.

You can do this for as many as 5 special colors.

Feel free to get creative with this, some uses for palette rotation in the actual Monkey Island series were the glow of a fire, water rippling effects, dimming of characters in the distance, etc.


- Once again, a little palette manipulation, I promise this wont be so bad.

Step 1
Save your Object image and your Room image as a Photoshop (.psd) file. For example: "Objects.psd" and "RoomFull.psd"
Step 2
Go to File -- Save As, choose GIF from the "Format" drop-down menu. Enter a file name and click "Save"
Step 3
If asked to Flatten All Layers, select Yes
Step 4

When the indexed color dialogue box appears, select "Custom" from the "Palette" drop-down menu. With the above picture I saw the following dialogue box:

All but 5 rows can be filled with colors, if more than that are filled you must SKIP to step 4a.

In my case, I'm okay so all I have to do is fill up the rest of that last row, which I will by simply clicking on the last box in that row and setting them all to black.

Before you do that, if you used some palette rotation colors they need to be set up now. In the EYES example, I used two colors for palette rotation purposes (one for each set of eyes). So I need to set this up in my palette. I simply click on a blank palette box somewhere in the first 11 rows of the "Color Table" window and then click on the "eyes" (in my example). This will set the color box to the purple color of the first set of eyes. I do this same thing for the second set of eyes. If you do not have enough free blank boxes in the first 11 rows then skip this step and go to step 4a.

Now I can click "Save" and save this as "Room.act" Click "CANCEL"

Step 4a

Skip this step if you did not have the problem above.

Click "CANCEL" and re-do steps 1 - 3 and then select "Local (Selective)" from the "Palette:" drop-down menu. Type in the number of colors as 176.

If you used some palette rotation colors they need to be set up now. In the EYES example, I used two colors for palette rotation purposes (one for each set of eyes). So I need to set this up in my palette. I simply click on "Forced" drop down menu and select "Custom." Now I clicked on the first blank box and then clicked on the first set of eyes in my room image. This set the color box to the purple color of the first set of eyes. I do this same thing for the second set of eyes.

Then choose "Custom" from the "Palette:" drop down menu.

Click "Save" and save this as "Room.act" Click "CANCEL"

Step 5

Go to Window -- Swatches and the Swatches window should appear. Click on the bluish "Right Arrow" in the upper right corner and select "Replace Swatches." Change the "File Type" drop-down menu to "Color Table (*.act)" and load your "Dialogue.act" file. Then click "Load Swatches" and load your "Room.act" file. Then click "Load Swatches" and load your "Final Constants.aco" file. You should now have a complete palette. Click "Save Swatches" and save this as "Room Palette Final.aco" You swatches window should look similar to this:

- Save the object sheet as a ".gif" file loading the "Room Palette Final.aco" as the "Custom" palette each time you save. Split the large room image file into as many 320 x 144 sections possible and save them separately as ".gif" files in your "TWIGZ SDK\Images" folder. For example, if your room is 784 pixels wide, you will have to save three images, the first two are 320 x 144 pixels and the last is 144 x 144 pixels. I recommend naming them with numbers so you can keep track of which file is which (All should be saved with the new palette).

Back To Top

Step 3: Create Room Masks
- A room mask adds the ability to create a 3-D feel in a 2-D environment. Below is an example of a room file and it's mask:

- To create a mask, open your photoshop file (".psd") for the room and create a new layer. On this layer you will draw over any areas that will cover the actor as he walks across it. You can have 49 different levels of 3-D. These 49 different indices are called Z-Indices. Notice in the above picture the BLUE areas are the 1st Z-Index and are therefore colored with Color Index 1. Any non covering area MUST BE COLORED WITH COLOR 50 (Shown as an extremely light shade of blue in the above mask picture)!!!!!

- If you want your character to walk behind 2 or more layers just color each subsequent layer with its appropriate layer color. Below is an example of this (Note: Light Green is Color 2, Light Blue is Color 3, and Dark Green (in this case) is Color 50):

How do the Ego know when to go behind these masks? Good question, when you set up the walkable areas in the room editor, you assign each walkable area a Z-Index. This means that whenever the Ego is in a walkable area with a Z-Index of 1 he will be covered by all mask areas of Color Index 1.

Back To Top

Step 4: Creating the Level File: Load the Images and Draw the Polygons
- By this point you are ready to start creating your level. Go to your "TWIGZ SDK" folder and double-click on "RoomEdit.exe"

- In order to create a room you must first load the room images. Click on "Load Images" and follow the on-screen instructions. If the room has no masks then you may type "N" to chose not to load room masks. Below is an explanation of the prompts you will see:

Masks Also Type either "y" or "n" to choose whether or not to load room image masks also
Total Image Files Number of files that make up the one room's image (do NOT include Mask Images in this total)
Width in Pixels Pixel Width of entire room image (width of all image files combined)
File name # Type the file name (Maximum 8 characters) to load. Do not enter file extension.
Mask File Name # Type the mask file name (Maximum 8 characters) to load. Do not enter file extension.

Note:
If you choose to load masks then for each room image you will be asked to load a mask image

Note: You must know the exact room width in pixels in order to achieve desired results. For the example above, the 784 pixel room, I would have to load 3 images which I named "room1", "room2", and "room3". Also I would need to load the room masks which I named "room1m", "room2m", and "room3m".

- Now that your room is ready for setup, I suggest you draw the rooms walkable areas next. You can do this by clicking on the "Draw Boxes" button. When you do this you will be prompted to draw the vertices in CLOCKWISE ORDER, this is VERY IMPORTANT! Before you begin, listed below you can find the buttons used for drawing walking boxes:

Button
Action
U
Undo, or delete a the previous walking box
C
Connect to first vertex, use after three vertices are drawn to create a CLOSED polygon, also used in creating a walkable line.
Left Click
Draw a vertex
Right Click
Remove a vertex
Esc
You will be prompted on whether you want to end drawing boxes or not, type "Y" or "N" here.

- When drawing walkable areas draw the vertices in a clockwise order, after the 3rd vertex is drawn simply press "C" to connect the final line. The next box should be drawn next to the previous one with one edge overlapping an edge of the previous polygon. Note ALL polygons MUST BE CONVEX and there must be a way to get from ANY ONE POLYGON TO ANY OTHER POLYGON.

- How do I draw a line? In order to draw a walkable area that is in the shape of a line, simply click on a point, then click on the second vertex. Keep your mouse there and press "C", then click again in the same spot. Press "C" a final time an viola, this will draw a line.
Note: If your room contains these LINE polygons, then I recommend drawing a quick diagram of the room and numbering the polygons as you draw them, this will come in handy later!

- After a polygon is drawn you will be asked THREE questions, below is a table with the questions and what they mean.

Question
Explanation
Start Scale Index In the TWIGZ Engine, a character is scaled only in the Y Direction. As the actor approaches the top of the screen he can get smaller. So the Start Scale Index (value from 0 to 1) determines how big he will be when he is at the lower Y position of the walking box. This is used for joining several walking boxes together and keeping the scaling factors in synch.

Note:
0 = No Scaling, .15 is the smallest he can be, and 1 is normal size. 0 should be used if there is no scaling on the current polygon, 1 should really only be used if you want your character to start out small and get to normal size at the top. 0 process quicker as it causes a skip of the Scale Function.
End Scale Index Same as the Start Scale Index except determines the character's size at the top Y position of the polygon.
Z Index Number from 0 to 49 that tells the engine what z-index color in the mask image the actor should hide behind. If the actor is in the current polygon and that polygon's z-index is 1, then while inside the polygon he will be covered by all pixels of color 1 in the image mask.

- When you are done drawing your boxes simply press "Escape" and you will be asked if you want to end drawing boxes, enter "Y" or "N" here.

Back To Top

Step 5: Creating the Level File: Create the Matrix and Select the Midpoints

STOP
If your level contains any LINE Polygons, then you must SKIP the following step when selecting the LINE Polygon as another polygon's neighbor. Read Step 5a for this situation.

- Now that you have created all of your drawing boxes, you are ready to set up the connectivity matrix. Start by clicking on the "Create Matrix" button. All of the polygons you have drawn will appear (the first box will be of color 1, the second of color 2, etc.) You will be prompted to "Click all of the Polygons Touching Polygon 1." Simply click inside any polygons touching polygon 1, they should change color when clicked on. When you have clicked ALL polygons touching polygon 1 click with the RIGHT MOUSE BUTTON. You will then be prompted to do the same for polygon 2. Continue in this fashion until all polygons are completed. When you are finished you will prompted with "Matrix Calculated" simply press any key to continue creating your level.

- Step 5a: Since the TWIGZ Engine deals with CONVEX polygons only, it has trouble detecting LINE Polygons. So you may not be able to accurately click on the line polygon to choose it as another polygon's neighbor. Instead, here's where your diagram you drew of the polygons in your room should come in handy.

Instead of clicking on the LINE Polygon, press the "L" key instead. When prompted with "Which Polygon Number" simply type in the polygon number corresponding with the LINE Polygon and press enter. Continue selecting polygons with the left mouse button and use the right mouse button to advance polygons.

- How do I scroll the room image to draw my boxes? The ARROW KEYS, left and right, can be used to scroll the room image.

- When you have finished creating the connectivity matrix, you are ready to select the mid points, this is the final step in creating a fully functioning walkable room. Start by clicking on the "Select Midpoints" button. You will be prompted to select a midpoint. Click the middle of any SHARED EDGE of two polygons. Next you will be asked to "Select Polygon 1." Simply click inside one of the two polygon's who share the edge (If the polygon that shared this edge happens to be a LINE Polygon, then follow the directions in Step 5a once again). Do the same to "Select Polygon 2." Repeat this for all shared edges.

NO POINT SHOULD BE THE MIDPOINT FOR MORE THAN TWO POLGONS!

In other words, you can't select a midpoint and use it to join polygons 1 and 2, and then select that same point and use it to joint polygons 1 and 3.

- When you are finished selecting all midpoints (a midpoint or a shared edge need only be selected once) RIGHT CLICK to end selecting midpoints.

Back To Top

Step 6: Loading and Placing Objects

- Now you are ready to load and place your previously drawn objects. Click on the "Load Objects" button to start.

- You will be prompted with "S - Sheet, I - Individual, B - Blank". Below is a breakdown of what this means:

Option
Explanation
Sheet
In step 2 we created an object sheet, this is the most common way to load objects into a room. Choose this by typing "S" and pressing enter.
Individual
If, for some reason, you wanted to save each object image as an individual file and load it in separately, you can use this by typing in "I" and pressing enter.
Blank
This is used to select "HOT" areas on the room image that are part of the room image itself. For example, a door that cannot be opened or modified, but can still be looked at should be drawn on the room image itself. Choose this option by typing "B" and pressing enter.

- Loading an object from a sheet:
When prompted for the sheet name, type the file name for the sheet without the ".bs2" extension. Press Enter. When the sheet appears on the screen, Left-click on the top left corner of the object image you wish to load. Move your mouse to the bottom right corner of the image, and Right-Click this will create a cursor the size of the selected image. If there are any subsequent images needed for that object you can select them at this time by moving the box over the image and clicking with the Left Mouse button. When you are done selecting all the necessary images for that object you can end the process by pressing "Esc"

You will now be prompted for the "Object Name." Enter the text you wish to appear when the mouse cursor hovers over the object, then press enter. I recommend you write down each object you load and what number it was, starting with number 1. This will come in handy when placing the objects on the room image.

You will then be prompted for three more things. Below is a table explaining each:

Prompt
Description
Input Bin Variable

A Bin Variable (Also called a "BinVar") is short for Binary Variable. The purpose of these BinVars is simple. They represent GLOBAL Variables that you can use to manipulate your game. There can be up to 1000 of these and they are all stored in XMS Memory. You can use these BinVars for anything, but you MUST MANAGE THEM and keep track of their uses.

ALL OBJECTS MUST BE ASSIGNED A BINVAR UNLESS THEY ARE BLANK OBJECTS (see the above table).

This prompt asks which BinVar you wish to assign to the current object. The purpose of this is simple. Lets say we drew an closed door as part of our room image. We have a separate object image (object image 1) of the door in an open state. We have another image (object image 2) of the door in a broken state.

Which image is displayed is dependant on the status of the selected BinVar for that object (see below).

Input Initial Bin Var Status

This prompt asks you for the initial status of the BinVar when the level is loaded (this is initialized before the Enter Script is loaded, so you can change the value from the Enter Script if needed).

The value of the BinVar determines how the object is displayed:

-1 = Don't show picture but still create "hot-spot" (used to show an interactive closed door, from the above example)

0 = No picture or "hot-spot" (the closed door will still be shown but you cannot interact with it)

1 = Show 1st picture (will show the door in its open position)

2 = Show 2nd picture (will show the broken door)

# = Show #th picture

Input Exit Type

Asks for an INTEGER representing the exit type for an object, you can type 0 or just press enter if the object cannot be used to exit a level. This is mainly used for doors and paths.

By entering a number, the cursor will change to an arrow and based on your dialogue file, a script can be run that will load a new level. Below is a listing of the acceptable values:

0 = None, 1 = N, 2 = NE, 3 = E, 4 = SE, 5 = S, 6 = SW, 7 = W, 8 = NW

Repeat this process for ALL objects you want to load from a sheet.

- Loading a BLANK object:
You will be prompted to draw a box and press the spacebar when finished. Start by clicking the top left corner of the "HOT" area you wish to select and then finish by clicking the lower left corner. If you are not satisfied with your selection, simply click again to start over. When you are satisfied press the "Spacebar."

You will be prompted to enter the "Object Name" just like above.

Prompt
Description
Input Bin Variable

A Bin Variable (Also called a "BinVar") is short for Binary Variable. The purpose of these BinVars is simple. They represent GLOBAL Variables that you can use to manipulate your game. There can be up to 1000 of these and they are all stored in XMS Memory. You can use these BinVars for anything, but you MUST MANAGE THEM and keep track of their uses.

ALL OBJECTS MUST BE ASSIGNED A BINVAR UNLESS THEY ARE BLANK OBJECTS (see the above table).

This prompt asks which BinVar you wish to assign to the current object. The purpose of this is simple. Lets say we drew an closed door as part of our room image. We have a separate object image (object image 1) of the door in an open state. We have another image (object image 2) of the door in a broken state.

Which image is displayed is dependant on the status of the selected BinVar for that object (see below).

Input Initial Bin Var Status

This prompt asks you for the initial status of the BinVar when the level is loaded (this is initialized before the Enter Script is loaded, so you can change the value from the Enter Script if needed).

The value of the BinVar determines how the object is displayed:

-1 = Don't show picture but still create "hot-spot" (used to show an interactive closed door, from the above example)

0 = No picture or "hot-spot" (the closed door will still be shown but you cannot interact with it)

1 = Show 1st picture (will show the door in its open position)

2 = Show 2nd picture (will show the broken door)

# = Show #th picture

Input Exit Type

Asks for an INTEGER representing the exit type for an object, you can type 0 or just press enter if the object cannot be used to exit a level. This is mainly used for doors and paths.

By entering a number, the cursor will change to an arrow and based on your dialogue file, a script can be run that will load a new level. Below is a listing of the acceptable values:

0 = None, 1 = N, 2 = NE, 3 = E, 4 = SE, 5 = S, 6 = SW, 7 = W, 8 = NW

Next you will be prompted to choose the "Walk-To Coordinates" Click a place on the room image that you wish the Ego to walk to when the player chooses to interact with the current object. The reason for this is so the Ego will ALWAYS walk to the same spot when interacting with that object thus making the drawing of animations much easier for you. I recommend you write down each object you load and what number it was, starting with number 1. This will come in handy when placing the objects on the room image.

Repeat this process for ALL blank objects.

- Loading and Individual Object:
When prompted type the image file name to load (do NOT include the ".bs2" extension). Then you will be prompted for the "Object Name" just as in the above two examples.

Prompt
Description
Input Bin Variable

A Bin Variable (Also called a "BinVar") is short for Binary Variable. The purpose of these BinVars is simple. They represent GLOBAL Variables that you can use to manipulate your game. There can be up to 1000 of these and they are all stored in XMS Memory. You can use these BinVars for anything, but you MUST MANAGE THEM and keep track of their uses.

ALL OBJECTS MUST BE ASSIGNED A BINVAR UNLESS THEY ARE BLANK OBJECTS (see the above table).

This prompt asks which BinVar you wish to assign to the current object. The purpose of this is simple. Lets say we drew an closed door as part of our room image. We have a separate object image (object image 1) of the door in an open state. We have another image (object image 2) of the door in a broken state.

Which image is displayed is dependant on the status of the selected BinVar for that object (see below).

Input Initial Bin Var Status

This prompt asks you for the initial status of the BinVar when the level is loaded (this is initialized before the Enter Script is loaded, so you can change the value from the Enter Script if needed).

The value of the BinVar determines how the object is displayed:

-1 = Don't show picture but still create "hot-spot" (used to show an interactive closed door, from the above example)

0 = No picture or "hot-spot" (the closed door will still be shown but you cannot interact with it)

1 = Show 1st picture (will show the door in its open position)

2 = Show 2nd picture (will show the broken door)

# = Show #th picture

Input Exit Type

Asks for an INTEGER representing the exit type for an object, you can type 0 or just press enter if the object cannot be used to exit a level. This is mainly used for doors and paths.

By entering a number, the cursor will change to an arrow and based on your dialogue file, a script can be run that will load a new level. Below is a listing of the acceptable values:

0 = None, 1 = N, 2 = NE, 3 = E, 4 = SE, 5 = S, 6 = SW, 7 = W, 8 = NW

I recommend you write down each object you load and what number it was, starting with number 1. This will come in handy when placing the objects on the room image.

Repeat this process for ALL objects you want to load individually.


Now you are ready to place your objects, click on the "Place Object" button to begin. You will be prompted for the "Object ID Number" this is where the information you wrote down will come in handy. Type the object number you wish to place and the mouse cursor will change into the object image. Click anywhere on the room image to place the object there. You will then be prompted to choose the "Walk-To Coordinates" which can be done by simply clicking anywhere on the room image where you want the Ego to walk to when interacting with that object. Repeat this for all object images.

To end placing objects, enter 0 for the Object ID Number.

Back To Top

Step 7: Creating the Level File: Color Rotations

- If you have created your room image with some rotational palette colors, they must be set up now. I'll admit this part of the editor is a bit weird but it gets the job done. To begin click on the "Color Rot." button.

- You will be prompted to select a color "1 - 5" just press the number key, 1 - 5, to set up that color. Next, Hover your mouse over the special color you had setup in the palette previously. Using the "R", "G", and "B" keys (to increase color values) along with the "r", "g", "b" keys (to decrease color values) you can increase and decrease the amount of Red Green or Blue that will be in the color. When you have the initial color that you want the rotation to start with click on it with your left mouse button.

- To select the final color hover over ANY color and adjust the color attributes until you get the desired color for the end of a rotation cycle. Click on the color and you will be prompted to set a time. The time is the amount of time (in seconds) that it takes for one rotation to be completed.

- Repeat this process for any other rotation colors.

Back To Top

Step 8: Saving the Level File

You have now successfully completed the first half of the TWIGZ SDK Tutorial. You may now save your room by clicking on the "Save Room" button. You will be prompted with the following questions, below is a table with their explanations:

Level Name Enter the file name for the level, should be the same as the level number. Starting with the first level as level 0.

DO NOT INCLUDE THE ".lvl" EXTENSION
Level Number The level number, should be the same as above.
Total Actors, Not Including Hero Number of other actors on the level, NOT INCLUDING THE EGO.
  • Non - Hero # ID
The ID Number for the first (or whichever number) non-hero actor.

ALL ACTOR'S ID NUMBERS SHOULD START FROM 3001 ON EACH ROOM. So the first non-hero actor in EACH room should be given an ID of 3001. The second 3002 and so on.
  • Non-Hero # Name
The Name for the first (or whichever number) non-hero actor. This will appear when the mouse hovers over the actor.
  • Headless (Y-N)

This may be a bit confusing. First off, type "Y" if the actor is headless, or "N" (or any other key) if not.

"Headless" means the actor doesn't have separate heads, and is instead animated as a whole. With a regular actor, when he is not being animated by a script, the Engine places a headless body at an X,Y coordinate, and then places the appropriate directional head on top of the body (occasionally replacing it with a blinking head).

If you choose to make your actor "Headless" then he will be placed at the exact X,Y coordinates (without leaving room for his head). As you saw above, SET 2 of all costumes is for standing actors. So the engine will draw your "Headless" actor from SET 2 (in the appropriate direction) on the level.

I really only recommend this feature if you have animals on the screen that will always be animated by a script. Like a bird flying at the top of the screen or something along those lines.

When you are finished with this your level will be saved in the "TWIGZ SDK\Levels" folder. You may now exit the Room Editor and precede on to Part 2 of this tutorial.

Back To Top

© 2004 Shattered Realm Productions