WDFUSE Tutorial - Advanced Geometry

## Advanced Geometry - Component Overview

Now that you've learned the basics switch to the Geometry tutorial by starting a New project (you can click the **New** button in the main menu or press **CTRL-N**) and choosing the **Geometry** tutorial and press **Ok.**

You will be greeted by many Sectors with rooms connected via corridors. Each room will teach you something new about Dark Forces editing. All these lessons are quite important so make sure you understand and practice the concepts being taught. Please do this tutorial **in order** since each room's objective is based on completion of previous lessons.

Remember, if you make a mistake you can simply undo by using **CTRL-Z.** Also, you can always restart this tutorial by making a new project.

One more thing. WDFUSE has many hotkeys for you to learn. It is impossible to memorize them all on the first try. You can press **F12** to see all the bindings if you forget what combination of keys does what you wanted it to do.

### Testing your Map in Dark Forces

We are now at a point where we can start testing our mission. Once the tutorial is loaded press **GOB** in the top left corner or press **CTRL-G.** This process will take all the assets in your project directory, put them into a GOB called ***<PROJECT\_NAME>.GOB*** and tell Dark Forces to launch it.

**Note:** This assumes you have already configured your Dark Forces Launcher (Steam / GOG / Origin / Custom) and Engine (**JEDI** / **The Force Engine)**. If not, then press **F9** to set it in the **Options** screen.
If you made any changes you may get prompted to Save your project. Say "**YES**" if that happens.

The game will launch and you will find yourself in the tutorial mission. There isn't much to do yet. You can run around between the two rooms connected by the corridor.

Once you confirm that the Dark Forces launches successfully, exit the game and go back to the WDFUSE editor.

Press **F9** and switch to the tab "**Backup & Launch**" . Here you can see various settings that deal with launching the game.

Notice that the editor makes a backup every time you save your project. They are stored in a **BACKUP** folder inside your project folder. You also have a LOG file you can look at for any issues. You can always bring up the current logfile by pressing **F5 .**

It is recommended you make two changes when you are working on your map.

1. Enable **Automatic Saving** - this gets annoying very quickly and will stop prompting you every time you try to GOB the mission.
2. Enable **Skip Cutscenes and Briefing** - this will allow you to instantly load into your mission without constantly showing your the cutscenes and the mission briefing (believe me - they get old quick!).

Once you have those two items checked, press **OK** to exit the options menu. Every time you make settings changes like this they get stored in a file called **WDFUSE.INI** inside your WDFUSE folder. If you ever want to wipe your setting and start form scratch simply delete that file.

Before we continue we must go over each map component in detail. Starting with the Sector.

### Sector Editor

We had a brief overview of Sectors before but now it is time to get into the details. When you select a room in the **Sector Mode** you will see a window popup that lists all the parameters of the Sector.

Go ahead and select the top-left most Sector where you start the tutorial.

You will see the details of the selected Sector that says ***SC 0*** at the top. The **0** is the numerical ID of the Sector. Dark Forces starts counting map components from 0. So if you have 10 Sectors (or Walls, Vertices or Objects) in total they will be assigned numbers 0 through 9.

While all the Sectors must have a number assigned to them, not all of them have a name. In this case this Sector is called **STARTROOM.** Sector names make it easier to reference them when you start scripting and also is a helpful way to identify the Sector's function.

Lets go over all the Sector components.

1. **Name** - Name of the Sector. This is Optional and can be left blank.
2. **Ambient Light** - how bright a Sector is. The number must be between 0 and 31 where 0 is total darkness and 31 is the brightest.
3. **Flag 1** - Grouping of flags that modify a Sector's properties such as floor causing damage, no ceiling rendered, etc. This will be explained in detail later in the tutorial.
4. **Flag** **2** - Unused. (**Ignore** for now)
5. **Flag 3** - Sets up custom lighting for the Talay Mission (Ignore for now).
6. **Floor Altitude** - At what vertical position if the floor located at. The floor must always be below the ceiling!
7. **Floor Texture** - Brings up the Texture Editor for the floor.
8. **Floor TX X Off** - Configures the X-horizontal offset for the floor texture.
9. **Floor TX Z Off** - Configures the Z-horizontal offset for the floor texture.
10. **Floor Tx #** - Unused (**Ignore** for now)
11. **Ceiling Alt** - At what vertical altitude if the ceiling located at. The ceiling must always be above the floor!
12. **Ceiling TX X Off** - Configures the X-horizontal offset for the ceiling texture.
13. **Ceiling TX Z Off** - Configures the Z-horizontal offset for the ceiling texture.
14. **Ceiling Tx #** - Unused (**Ignore** for now)
15. **Second Alt** - Dark Forces supports one additional altitude on which you can walk. This is optional, and in *relative height* to the Floor Altitude, not absolute.
16. **Layer** - What map layer this Sector belongs to.

Lets go over the icons at the top.

* Whenever you make changes to the Sector (or any other Map Component like Walls) your changes must be saved. To do that click the Green Checkmark icon at the top or by pressing **F3.**
* You can cancel your changes by clicking the red circle next to it.
* The INF exclamation icon opens up the Scripting Editor - we will go over this in a later tutorial.
* You will also see a "**Stay on Top**" checkbox. If it is selected, this window will not be hidden when overlaid by the Map Editor. It's recommended to keep it checked.
* Finally, the question mark icon will bring up WDFUSE help.

The information bar at the bottom lists additional information about the Sector.

You can see the number of **Vertices** and number of **Walls** the Sector has (those numbers are always the same). It also includes the **height** of the Sector. Finally, it has the **Class** and **Slave** which deals with INF scripting that will be covered later.

#### Flags

Lets quickly explore the Flag Editor.

While having **STARTSector** selected, try double-clicking on the **Flag 1** option. This will bring up the Flag Edit menu.

Flags are various options assigned to the Sector. In this particular case, the only option selected is the Exterior. This is because when you look outside you will see the sky. If that flag wasn't checked you will just see a flat texture as your ceiling. Exit out of this menu by pressing the **X** in the top right corner.

Just like flags, you can change a texture by double clicking on the texture parameter (Either Floor or Ceiling for a Sector). We will talk about that later in this tutorial.

#### Finding Sectors

To help you navigate , you can find a Sector either by name or by numerical ID by pressing the **F** key. The search menu will popup allowing you to quickly find your Sector.

### Wall Editor

Now lets go over the Wall Component details. A grouping of Walls makes up a Sector. You must have **at least 3 Walls** to have a valid Sector. Walls connections called **adjoins** are how you connect one Sector to the next. Switch to the **Wall Mode** and select the left Wall of the first Sector.

The top menu bar of the Wall Editor is similar to the Sector Editor. You can see that you can commit changes by hitting the green checkbox (or **F3**) or roll them back by hitting the red circle. Just like Sectors you have a "**Stay on Top**" checkbox and the **INF** Scripting button (more on that later).

Les go over all Wall Editor components.

1. **Adjoin** - This tells the editor which other Sector this Wall is adjoined to. (More on Adjoins later)
2. **Mirror** - This tells the editor which other Sector's Wall
3. **Walk** - Same as adjoin (**Ignore** this for now)
4. **Light** - The Wall's light variable
5. **Flag1** - Flags that handle Wall's properties
6. **Flag2** - Unused (**Ignore** for now)
7. **Flag3** - Flags that deal with the Wall's adjoin traversal properties (ex: movement)
8. **Mid Tx Name** - Middle Texture's Name
9. **Mid Tx X Off** - Middle Texture's X Offset
10. **Mid Tx Y Off** - Middle Texture's Y Offset
11. **Mid Tx #** - Unused (**Ignore** for now)
12. **Top Tx Name** - Top Texture's Name
13. **Top Tx X Off** - Top Texture's X Offset
14. **Top Tx Y Off** - Top Texture's Y Offset
15. **Top Tx #** - Unused (**Ignore** for now)
16. **Bot Tx Name** - Bottom Texture's Name
17. **Bot Tx X Off** - Bottom Texture's X Offset
18. **Bot Tx Y Off** - Bottom Texture's Y Offset
19. **Bot Tx #** - Unused (**Ignore** for now)
20. **Sign Tx Name** - Sign Texture's Name
21. **Sign Tx X Off** - Sign Texture's X Offset
22. **Sign Tx Y Off** - Sign Texture's Y Offset
23. **Length** - Length of the Wall

At the bottom you will see the Wall panel properties.

Here you can see the **Sector Name** and the altitudes of **Floor** and **Ceiling** along with the **height** and **length** of the Wall. It also lists the numerical vertex identifiers. The **L** stands for Left Vertex of the Wall and the **R** is the Right Vertex of the Wall. In this case, Vertex 0 is on the Left and Vertex 1 is on the Right of this Wall. Finally, the **class** and **trigger** are INF scripting components that will be covered later.

#### Flags

When you double click on **Flag 1** option you will see the various Wall options. Just like Sectors, you can multi select the options that you are interested in. So if you want to flip the wall's texture you would select value 4. When you are done editing, simply press the green checkmark at the top.

When you double click on the **Flag 3** option you will see flags that deal with wall traversal when it is adjoined to another sector's wall. Basically, you can make it so the enemies cannot get past this wall or you can make it so you could not pass it yourself or shoot a blaster bolt through. Once again, when you are done editing the flags you can click the green checkmark to save your settings.

#### Normals and Lengths

Every time you select a Wall you will also see a perpendicular line that always points to the center of the Sector. This is called a **normal** line.

You can enable or disable Wall normals by typing **ALT-L .** The Wall you have currently selected will always show the normal.

One other useful thing you can display in the Map Editor is the **length** of the Wall. Simply press **L** and all the Walls will show their lengths.

### Vertex Editor

Now lets go over the Vertex editor. The Vertices are the end-points of the Wall. The number always matches the number of the Walls you have in your Sector. Each vertex connects two Walls together.

Go ahead and click on one of the starting Sector's Vertices .

You will notice the the Vertex is a lot simpler than the Wall or the Sector.

1. **X** - This is the X position on the map of the Vertex
2. **Z** - This is the Z position on the map of the Vertex

At the top, as before you can **commit** or **rollback** your changes as well as keep the window **on top .**

Below you will see the **Name** of the sector, the **Floor** and **Ceiling** altitudes and the numerical IDs of the **Left** and **Right Walls** of this Vertex.

Vertexes are a nice way to easily align your sectors when you join them together with other sectors.

Be Careful! You **cannot** have one vertex be on top of another vertex for the same sector. This will cause a bug prevent the player from moving inside the sector. Be sure to delete one of them before testing your map.

### Texture Editor

When you double click on a texture parameter in a Sector or Wall editor the Texture Resource Picker window will appear.

On the left you will see a list of textures. These are files that end in **.BM** and loaded from **TEXTURES.GOB .** When you pick the texture you like, the texture will be rendered in the window on the right. You will also have texture details explained in the top right corner such as the location, size and dimensions of the asset.

Notice that at the top you can also change the texture **Brightness** and the texture's **Zoom** level. So if the texture is too dark or too small you can always play with those settings to make it easier to view.

When you are done selecting your texture simply click the green checkmark at the top and your texture will be applied.

#### Filtering Textures

In the top left menu you can will see a **Source** option. **Project Dir** means that the textures are loaded from your WDFUSE project directory. Any BM file you put in that folder will appear in this list. **User List** means that the texture is loaded from **TEXTURES.GOB** .

You will also see a pull down called **Available Pick Lists** . These are nice groupings of textures to help you find the ones you need. You can search for a grouping of **Walls**, **Ceilings** or from an existing mission such as **NARSHADA** or **IMPCITY**

Clicking on the above will instantly filter the list at the bottom.

Another way to easily find a texture you want is to use the filter bar above the texture list. While having "**Full TEXTURES.GOB**" selected in the Available Pick List try to find all the switches by typing "**swi**" . The textures will immediately show all the ones that contain that phrase.

#### Palettes

A palette is a grouping of colors in Dark Forces. Because of the limits of the 1990s computer memory the game could only use a maximum of 256 colors per mission. A mission like Gromas Mines required a lot of red color gradients so it would use a special palette that has an emphasis on the color red. While a mission like Talay has an emphasis on moody purple colors. The palettes for each of those missions would be stored in **GROMAS.PAL** and **TALAY.PAL** files.

When you choose a different palette from the pulldown menu the texture on the right will instantly be rendered with the colors. Here is what **CESUNSET.BM l**ooks like when rendered with **ROBOTICS.PAL**

And this is what it looks like when using **TALAY.PAL** . It's a world of difference!

By default your mission will use the PAL from Secret Base but you can always change it in the level header editor. To access it, go back to the main editor window and go to **View** --> **Editors** --> **LVL**

Here you can change SECBASE.PAL to another one.

Remember, you can only have **ONE** palette per mission!

#### Automatic Texture Selection

In the top left corner you will see a number of checkboxes. The ones shown will differ depending if you open the texture from the Sector Editor or from a Wall Editor. Here is what the Wall Texture checkboxes look like.

Here is the function of each one.

1. **Auto Pick Lists** will automatically switch to a Floor or a Ceiling (or Sky) texture if you try to load the texture from the Sector Editor.
2. **Sort Textures by Height** will sort all the textures from smallest to largest. This will only work on non-switch uncompressed textures .
3. **Map Texture Heights** (This option is only available for Walls) will try to map the texture height to the height of the Wall so it would fit perfectly.

Now that you've finished learned about Sector, Wall and Vertex components you are ready to start joining the Sectors together to make a mission! Continue to **Advanced Geometry II** .

**WDFUSE Tutorials**

1. Introduction
2. WDFUSE Tutorial - Configuration
3. WDFUSE Tutorial - Basic Geometry
4. WDFUSE Tutorial - Basic Geometry II
5. WDFUSE Tutorial - 3D Renderer
6. **WDFUSE Tutorial - Advanced Geometry**
7. WDFUSE Tutorial - Advanced Geometry II
8. WDFUSE Tutorial - Advanced Geometry III
9. WDFUSE Tutorial - Objects
10. WDFUSE Tutorial - Scripting
11. WDFUSE Tutorial - Scripting II
12. WDFUSE Tutorial - Scripting III