WDFUSE Tutorial - Advanced Geometry III
Advanced Geometry and Texturing
Now that you've experienced making changes to the editor you are probably wondering if there was a way to automatically make the commits without always hitting the commit button (F3). Go ahead and bring up the Options menu with F9.
Switch to the Confirmations Tab and select the "Automatically Commit Changes" checkbox in the top right corner .
Now, every time you make a change it will be auto-committed and the 3D renderer will also be updated at once. Do note, this does not work on multiple map components at once as it is a dangerous operation.
Now lets jump to Room 5 . It is the with many textures and looks like this.
Here you will learn how texturing works in Dark Forces. Lets start by looking at the wall with 3 shelves that have gray and gold flat textures.
Top / Middle / Bottom
You may have noticed that in the Wall Editor there are four texture types. Top, Middle, Bottom and Sign. These describe which section of the Wall should be updated with a texture. In the vast majority of cases you would only need to update the Middle section. However, if the wall is adjoined to another wall then you may need to update the Top or the Bottom sections. Lets look below.
Lets number each texture column in front of us from 1 to 8. Notice that columns 1, 2 4, 6 and 8 all have the grate texture. Because they are not adjoined to the small shelves (holes) with the fan texture the only texture you are looking at is in the Middle section.
It is important to understand the the adjoined wall to the shelf sector always consumes the middle texture section. What would that mean for us?
In column 3, the shelf is at the bottom. The shelf consumes the middle section because it is the adjoin. So the texture you are seeing above the adjoined section is the Top and is colored Grey. You can see in the image above that we do not see the IPSEC1.BM texture because it is consumed by the adjoin. We only see the top texture ZPGRYFIL.BM (GRAY)
In column 5 the shelf is in the middle of the wall and consumes the middle adjoin section. Because we can see below the shelf we are looking at the Bottom section and it is colored Gold. We can also see above the middle shelf consuming the adjoin. So anything above is the Top section and the texture there is Grey. You can see in the image above that we do not see the IPSEC1.BM texture because it is consumed by the middle adjoin. We only see the top texture ZPGRYFIL.BM (GRAY) and the bottom texture ZPYFILL.BM (GOLD)
In column 7, the shelf is at the top. The shelf consumes the middle section because it is the adjoin. So the texture you are seeing below the adjoined section is the Bottom and is colored Gold. You can see in the image above that we do not see the IPSEC1.BM texture because it is consumed by the adjoin. We only see the bottom texture ZPYFILL.BM (GOLD)
Feel free to play around with the textures in here to make sure you understand the concept.
You may be wondering, What happens if a sector is adjoined to more than two shelves, which texture section do you assign? The answer is NONE! Dark Forces engine (JEDI) does not support room over room rendering. This feature is in Outlaws (JEDI v2.0).
Now lets look at the southern wall with the red sign.
Signs are a special overlay texture for you wall. They always start at the bottom left corner of the wall and you move them around until they are in the place you want them to be. Signs in Nar Shaddaa mission are done this way as well as switches (More on this later).
You can change the X/Y positions of the sign from the Wall Editor. However, it is much faster to do it if you click on the Sign offsets in the Wall Editor and, while holding the Shift button, use the Arrow keys.
If you press Up while holding Shift the texture will go up and Down otherwise. The same for Left and Right arrow keys.
Go ahead and give it a try. It's a lot faster than typing the offsets with your keyboard.
It is important to note. Signs always start calculating distance from the bottom left corner of the middle texture.
This means that if you have an X or Y offset for the texture then the sign will ALSO get that offset. Long story short, if you cannot find your sign, set your Middle Texture to X=0 and Y=0.
Floors and Ceilings
Now lets look at the top and bottom of this sector. You may notice that the textures are not aligned.
Lets make them even! Switch to Sector Mode and click on the Floor Texture X and Z Offsets.
Now, just like with the sign, use the Shift + Arrow Keys to align the floor textures so they are even.
The ceiling also looks a bit off!
Now click on the X/Z offsets for the ceiling and align the ceiling texture just like you did the floor.
Now they both look good.
One important thing to remember with floor and ceiling textures is that they must be square and of size 8x8 (or 64x64 pixels). If you use any other texture they may look distorted! (The special cases where this limit does not apply are sky textures, but that's a different thing entirely.)
Now lets look at the north wall of this sector. It is a mess. I am sure you are not excited to align all those sections.
Fortunately, there is a tool called Stich that will automatically attempt to match the textures to the LEFT or RIGHT texture depending on what option you choose. Go ahead and switch to Wall Editor and Multiselect (with SHIFT) all the wall from left to right.
It should look like this in your editor.
Then right click on the wall and in the pop-up menu choose Stitch (Hotkey Shift+F5). This will automatically align all the texture and save you lots of time.
You can also reverse stitch from the right corner texture by choosing Reverse Stich option (or Shift+F6).
Pop quiz before you go - go ahead and align the texture over the passageway. Which Wall section should you update? Top, Middle or Bottom?
In Room 4 you will see a small square-shaped sector in the middle that is completely enclosed by the room's sector.
Sectors that are completely enclosed by another sector are called SubSectors. For example, the Detention Center's diamond-shaped moving platform is a subsector that is completely enclosed by the cliff sector, as well as most control consoles on the floor, podiums, etc.
With subsectors you can change the height to make either a pit or a platform. In this case you see a red platform.
Select the Sector Editor and click on the subsector. Lets make it a pit instead! Change the Floor Altitude to -4.
Now the SubSector is a pit. Now lets delete the subsector and see what happens.
As you can see the subsector is gone and now all you see are walls. Deleting subsectors is a great way to make pillars in your rooms.
Now lets practice making subsectors. Go to Room 6 and select it. Go ahead and right click on this sector to bring up the pop-up menu.
You can see that there is an option to Create or Delete subsectors . Go ahead and choose "Subsector with 6-sides".
As you can see the tool created a hexagon. Go ahead and play with the subsector tool by giving it different floor and ceiling heights. You can always undo using CTRL+Z hotkey.
Before we go to the next room you may notice that the next section is greyed out (Or you may not see it at all).
That's because these sectors belongs on a different layer. Go ahead and change to Layer 1 by clicking on the Layer arrow in the main menu or by holding Shift and using the MouseWheel. If you click on the actual number you will get a grey outline of other layers. To see only the current layer ensure that the layer color is black, not red. Keep in mind that the layers are not here only to make editing more convenient ― they are also read and interpreted by the Dark Forces engine.
Now lets continue with Room 7 where you will learn about the various flag properties and how they affect the game.
For this part of the tutorial, GOB your mission and start it in Dark Forces. Walk to the room and look at the here you will learn about the various flag properties and how they affect the game. When you work with flags you can turn more than one at a time.
Lets start with the north side of the room where the floor is marble-textured. Go ahead an walk on it.
You will notice that it is a slippery floor, just like in the Robotics Facility mission.
This is done with the Sector Editor's flag settings. Go ahead and open up Flag 1 section for this sector.
Notice that Flag 16 is turned on. This makes the sector an ice sector and this is why you slide when you walk on it.
Now lets look at the sector to the left of it. You will notice it is purple (when not selected) on the mission. It means it is a Secret sector.
When you enter this sector the game will set your secrets value to 100% in the PDA menu.
Now enter the room to the left with the force field floor texture.
You will take damage in this room. You can use the health packs to get it back to 100.
You will see that in the sector editor it is using flag 2048 Low Damage . This is why you take damage when you fall into the Research Facility irradiated water.
The room to the left has white walls. Try shooting them and you will see that the shots bounce off just like in Detention Center.
This is done with the sector editor's flag 4 "Shot Reflection"
Note that this is a Sector Editor flag, not a Wall Editor flag. If you want walls to reflect, it has to be done for the entire sector.
Now lets take a look at wall flag settings.
Go to the room with the forcefield texture at the end.
When you touch this wall you will take damage.
It's done with the Wall Flag editor 8192 "Wall Damages Player" .
On the left you will see a room with a stormtrooper.
Notice that he keeps shooting you but cannot his shots don't go through the wall. Your shots as well are blocked. He also cannot exit the room he is stuck in. This is by modifying the adjoin flags - Flag 3 section instead of Flag 1 that deal with wall properties.
This time both flags 4 (Fence) and 8 (Cannot Fire Through Wall) are turned on. They are added to 12 and are set as the value for Flag 3.
This next concept is important - pay attention!
The room with the stormtrooper connects to the central sector as Wall 0 and the big sector above connects to the stormtrooper with Wall 18.
If we select the stormtrooper room Wall 0 (you can tell by the orientation of the normal line pointing down) you can see that the Fence (4) lock is enabled.
When you select Wall 18 you will see that the Fence flag is not enabled - only cannot fire.
So what is happening? The stormtrooper is affected first by the adjoined Wall 0 facing him. He won't get affected by the wall (Wall 18) from the central sector unless he tries to re-enter his room. That is why the Fence (Flag 4) is on the inner side of the room. If you remove that flag and put it on Wall 18 he will be able to leave (but not able to re-enter).
The point is to always consider the adjoined wall facing the objects in the sector. Because this is the wall that will affect the object. Because the flag "Cannot Walk Through Wall" (2) is not enabled you can traverse the adjoin at will. You will be able to enter the sector and shoot the stormtrooper and then leave.
Go to the room next to it with the crate textures. Have you ever wondered how the holes in crates are done?
If you look at the Wall settings you will notice that Adjoining Mid Tx is turned on (Flag 1). This tells Dark Forces to display the texture even if it is adjoined.
How do you tell a texture which colors it should show and which it should not? This is done with a concept called Alpha where you choose a single color (Ex: Black ) and make that color transparent.
If you double click on the Mid Texture of the wall (IDMGDCRT.BM) and open the Texture Resource Editor you see that there is a large black hole in the middle.
The flag for the texture is as Transparent and that by default, the Black pixels are transparent. If you choose a different non-transparent solid texture (ex: IPRMCRT1.BM ) you will be able to walk through the wall.
Finally, the last room to the left of the crates is unique. You will notice you cannot enter it.
This is because the Flag 3 section is set as Cannot Walk Through Wall (2).
You can use this feature to put up invisible walls so the player accidentally does not fall off a cliff for example.
You may also notice that the wall at the bottom is not visible on the map when you play.
That's because the wall flag at the bottom is set to Hide On Map. This is useful for secrets or when you want to hide sectors with logic (more on that later).
Now you have a better concept of Sector and Wall flags. Remember - you can combine flags - to create different effects.
Feel free to experiment and then lets jump to the Object tutorial.
- WDFUSE Tutorial - Configuration
- WDFUSE Tutorial - Basic Geometry
- WDFUSE Tutorial - Basic Geometry II
- WDFUSE Tutorial - 3D Renderer
- WDFUSE Tutorial - Advanced Geometry
- WDFUSE Tutorial - Advanced Geometry II
- WDFUSE Tutorial - Advanced Geometry III
- WDFUSE Tutorial - Objects
- WDFUSE Tutorial - Scripting
- WDFUSE Tutorial - Scripting II
- WDFUSE Tutorial - Scripting III