Using DEdit to Create Worlds

Lithtech Jupiter engine

Post Reply
User avatar
Spawn
Admin
Admin
Posts: 1310
Joined: Sun Jul 25, 2004 12:50 am
Location: Norway
Contact:

Using DEdit to Create Worlds

Post by Spawn » Thu Mar 24, 2022 2:29 am

Using DEdit to Create Worlds
Source: Nolf2 Docs
nolf2begin1.png

Welcome to the DEdit overview and tutorial. DEdit is the tool created by the LithTech team that enabled the NOLF2 Level Designers and Artists to create the geometry and gameplay you experienced in No One Lives Forever 2 (NOLF2). DEdit allows you to build the ground, sky, walls, ceilings and shapes for your levels. You will then apply textures, props, prefabs, lights and sounds to give them a realistic appearance. No One Lives Forever 2 was created using literally thousands of these assets, which you may appropriate to create the base for your own level. You may also add your own assets where applicable. Finally, you’ll add the game objects that allow other players to interact with your world.

Creating levels is an extremely complex and time-consuming process, and the following is merely the starting point for those who want to learn the basics of building worlds for the LithTech Jupiter engine. If you’ve done game design before on a 3D or near-3D game, you’ve probably worked with tools like DEdit. A separate document will cover ModelEdit, the companion to DEdit, which allows you to create characters and models for your world.



Basic Terms
These terms are relevant to a discussion of DEdit.



Project — A project in DEdit represents the sum of all the resources in the game: all the code, all the textures, all the sounds, all the worlds, and so on. Unlike other world geometry editors, DEdit first opens the project, rather than a world file.



World — When your players walk around in your game, it is a world that they’re standing in. Worlds divide your game up into sections where different parts of the game take place. In other games, these are sometimes referred to as maps, levels, scenes, or episodes. World editing is the primary focus of DEdit and each world is stored in a separate file on the hard drive.



Objects — Simply put, anything a player interacts with that moves, lights up, shoots, growls, or goes into the player’s inventory is an object. DEdit allows you to place any kind of object that your game’s code or the engine’s code can create.



World Geometry — Parts of the world that act as walls, floors and sky are generally made of world geometry. Such geometry is solid, immovable, and generally never changes.



Brush — The basic unit of world geometry. A brush is made up of planes that define its faces, lines that define its edges, and vertices that define its corners. You can manipulate either an entire brush at once or any of the vertices, lines, or planes in the brush.



Polygon — A closed plane figure bounded by straight sides. Most of the geometry created in DEdit and used for the LithTech Jupiter engine is one sided. As a result most of the creation process involves working with polygons instead of entire brushes.



Primitive — A simple shape that you can add to the world as the foundation of a more complex shape. Typical primitives are things such as cubes, pyramids, and cylinders.



Prefab — A prefab is like a primitive, but more complex. If you build a street lamp complete with textures and a light source that gives off just the right shade of light, you can select the lamp and its associated source (or any group of objects and brushes inside DEdit) and save it as a prefab. Thereafter, you can copy and paste that streetlamp into your world without having to rebuild the whole object.



Unit — The basis of measurement in DEdit and the LithTech Jupiter engine. Units don’t equate directly to real-world values. Instead, the game designers can select a scale of game units to real-world measurements. As an example, in No One Lives Forever 2 the following values are used: railings are 56 units tall, a chest-high box would be 64 units, and a typical doorway would be 128 units high.



Mode — DEdit has several different modes that allow you to change certain elements of your world (i.e. just brushes or just objects) without accidentally affecting others. They’re designed to simplify interacting with your world while editing, so it’s important to choose the right mode for your task.



Processing — When you process your world, DEdit creates a second version of the world with some information removed (parts only you need to know about), and other information added (parts only the game engine needs). Processing is a necessary step you’ll take in getting your world up and running in the game, and is often the first place where you will discover problems with your level.



Texture — In DEdit, textures are used like wallpaper, paint, or plaster to cover the raw plywood of your walls, floors, ceilings, doors and so forth. Without a texture, your brush will appear flat-shaded in the game, almost always with unpleasant results. Just as you wouldn’t want a house with raw plywood walls, you always want to apply textures to the brushes in your level.





LithTech Resource Types

Before starting, you should learn a little more about the structure of the resources that DEdit and LithTech can use in a game. The LithTech Jupiter engine can access and use a wide variety of file types and other resources. The list below is arranged by resource type, and each resource type includes a list of the sorts of files LithTech can use in that type, as well as a description of those files.



Project — As mentioned before, the project is the total of your whole game and all its resources. A .DEP (DEdit Project) file at the top of your tree of game resource directories serves as a guide to DEdit. The .DEP file is a pointer to the rest of the resources for DEdit and includes some of the information about your game resources. The rest of your game’s files exist in subdirectories of the directory where your .DEP file resides.



Directories — The subdirectories that contain your other game resources are a type of resource in themselves. The structure of these directories defines the tree views you see in many of the tabs in DEdit’s Project window. If you find a game’s .DEP file and look at the subdirectories in the same folder with it, you’ll see names such as TEXTURES, WORLDS, SOUNDS, and MODELS. These folders contain whatever resource they’re named for, so if you want to add new textures to a game or copy a world from one game to another, you should look in the directories named Textures and Worlds , respectively.



Worlds — Worlds come in two forms: .LTA files and .DAT files*. If you think of worlds as programs, the .lta file is the source code: Editable and understandable by the user and DEdit, but not executable. The .DAT file is like an actual program: it can be run in the game, but since it’s been “compiled” ( processed , in this case), the user can no longer modify it. The .lta files are what you change and save changes to inside of DEdit, and the .DAT file is the output of Processor.exe, which prepares your world to run in the game and optimizes its performance.



*.LTA files can also be saved as .LTC and .TBW files. .LTC files simply .LTA files that have been compressed. .TBW files are a binary representation of the .LTA file. .TBW files load and process faster than .LTAs or .LTCs, so you’ll probably want to save your worlds as .TBW files in most cases.



Textures — LithTech uses its own form of texture, the .DTX file. Textures can be up to 32-bit images, although you can obviously choose to make lower-color textures. The .DTX files also contain flags for additional information used by the engine and the game. You can convert .PCX and .TGA files into .DTX files by importing them inside of DEdit.



Sprites — Sprites (.SPR files) consist of a series of .DTX files linked together as an animation with a set frame rate. They’re commonly used for animations and special effects such as smoke, bullet holes, and liquid droplets.



Sounds — LithTech supports standard .WAV files directly with no custom modifications.



Models — Models in LithTech are in a custom format, the .LTB file. This contains the mesh/geometry for the model and other information used by the game engine. You create these files in an external editor such as Maya or 3D Studio Max, then save them in the .LTB file format using a plug-in. Use ModelEdit , to modify files in the .ltc format once they’ve been created.



Objects — Also known as Entities , these are objects that programmers construct using code. Some of this code exists in the engine and doesn’t appear in the project directories. However, many objects are created in code written for the specific game. These objects are called game objects (to distinguish them from the engine objects inside the engine code) and are stored in a file called OBJECT.LTO in the same directory as the project’s .DEP file.



Prefabs — A prefab is a collection of objects, both brushes and code objects that are stored in their own .ltc files (just like a regular game world) in a separate set of directories. Anything you make in a level can be exported as a prefab to make it easier to re-use later. Examples are benches, camera systems, hallways, doorways, and statues. Prefabs can be useful if your group needs a way to distribute standard-looking objects to its members.





Setting up the Editor
Before you can begin creating levels, you must first load the Nolf 2 project file. To do this, just follow these steps:


1. From the File menu, select Open Project.
2. Browse to the Game subfolder of your Nolf 2 installation folder (i.e. C:\Program Files\Fox\No One Lives Forever 2)
3. Select the TO2.dep file.
4. Click on Open.


If the Game subfolder or the To2.dep file do not exist, run the unrez.bat file located in the Tools\Bin folder to unpack the Nolf 2 resources.



Next, you should make sure that the project paths are set correctly so that you can run your levels directly from the editor. To view the current settings:


1. From the Edit menu, select Options. This will bring up the DEdit options menu.
2. Click on the Run Tab.


The default values are as follows:



Executable: LithTech.exe

Working Directory: ..

Program arguments: -rez engine.rez -rez Game +runworld "%WorldName%"



The default values should be left alone in most cases. However, if you wish to have access to the console when running your levels through DEdit, change your Executable to LithTechDev.exe. Note that this executable has been provided for development use only and can only be used in single-player mode to avoid possible exploits in multiplayer games. Also note that selecting the executable with the browse button will copy it’s entire path to the field. This is normal, but not necessary as the working folder field also determines where the file can be found.



If you have installed any previous version of Dedit on your machine, it’s likely that the old values are still contained in the registry. In this case, you must change the paths before attempting to run your level through the editor. Also, after changing these values you should always exit Dedit and restart to ensure that the changes have taken effect.





Setting up Preferences

Once you have DEdit working with the game you can adjust the preferences to suite your needs. These are also located in the DEdit options menu, which can be found by selecting Edit/Options from the top of the editor. The editor works fine as is, and changes are only recommended if you are having performance problems, or for advanced users who want to adjust their settings.



For better performance you can lower the Number of Undos stored, which can be found under the miscellaneous tab.

Lowering the Default far Z setting under the Viewport tab also has performance benefits. This is the distance the editor sees in the 3D window, the value is in units. This is best left alone if you aren’t working on a large and complex level.



Most of the other settings in the Dedit options menu are for preference.



There is also a list of key bindings with options to change them. This can be found by selecting Edit/Edit Key Configuration from the top of the editor.


The DEdit User Interface
nolf2begin2.png
The callouts in this screenshot illustrate the various sections of DEdit’s UI. Use the buttons in the Toolbars to make new worlds, switch modes, and run your world. You can learn an individual button’s function by hovering your mouse over it to get a Tool Tip.

In the Project Window , DEdit gives you access to all of the resources in the game. Most tabs represent a resource you can add to the game. There are two special ones ( Properties and Nodes ) that relate to objects inside your maps. We’ll discuss all of these in a later section and they’re documented in the DEdit Toolbars chapter as well.

There are four viewports that provide windows onto the world you’re building. Each one presents a different view of the world. The upper left window shows you a Perspective view shot from a movable camera point in the level. The other three views have a fixed-view camera that displays either Top, Front or Left view (going in clockwise order). You’ll spend a lot of time working with these views.

In the Status Bar , DEdit provides information about the level or about the view you’re currently in. We’ll get into the depths of the user interface in later chapters, although you’re welcome to stop and explore if you’d like. Use the Tool Tips and the Status Bar to learn more about what the controls do.



Building a Room

This will be a simple tutorial on building a basic room using the tools supplied with DEdit. Further detail and explanations of the elements can be found after the tutorial section.



Select the Worlds tab on the left side of the editor in the Project Window and highlight the Worlds folder. From the toolbar at the top of the editor press the New World button. Name the new world Test_1.



DEdit is divided by four viewports to work in. You can adjust the grid size in each view by holding the mouse cursor over it and pressing the + and – keys. The grid size is indicated on the bottom of the editor on the status bar. Keep the grid size at 64 units for now. Using the viewport on the top right of the editor. Move your mouse cursor to the top left corner of it and hit the spacebar once. This should have placed a point on the grid and left you with a line that is connected to the point and your cursor (Figure 1.). You can hit the backspace key at anytime in this process to remove the last point.
nolf2begin3.png
Figure 1.

Now move the mouse cursor to the top right corner of the viewport and hit the spacebar again. You should now have a straight line that draws across the top of the viewport with a point still connected to the cursor. Do this again in the bottom right corner, bottom left corner, and then over the first point you made to make a square. This should conclude your square and a new brush dialog window should pop up asking for a thickness value to make it a cube, 256 units is fine for now. You should now have a cube of some sort that is visible in all viewports (Figure 2.).
nolf2begin4.png
Figure 2.

Holding your cursor over the top right viewport, try holding the O or I key and move your cursor around. The O key will zoom your view in and out (your mouse wheel will also do this), while the I key moves your view along the plane. All three 2D viewports work like this. Move your cursor to the top left viewport, which is your 3D or perspective view. In this view hold down the O key and move your mouse around, this pivots the view from the point where your camera or view position is. If you hold down the O key and press the left or right mouse buttons it will zoom your view in and out. Holding down the I key in this view will allow the mouse to move along a plane, combined with pressing your right mouse button will move it vertically. The U key will deselect an object; you can simply click on the object with your mouse to select it again. With the brush selected you will notice it has handles on the corners, along the edges, and in the center in your 2D views. These are for sizing and positioning the brush. In the bottom right corner of the editor on the status bar there is a readout for the dimensions of the selected brush. By selecting the handles and stretching them in the different 2D views, make the brush measure 512x256x512. On the left portion of the editor in the project window there is a selection of tabs. Select the textures tab and pick a texture to place on the brush. Select the folder labeled Siberia and scroll down to the texture named SWSib030 and select it. The texture should now show up in a window just below the selection menu. With the texture and the brush selected, press the Apply Texture button on the top toolbar to add this texture to the brush. With the brush still selected hit the F key to flip the normals on the brush. This turns the brush inside out basically so that there is now an interior space.

With the brush still selected press the Marker to Selection button, and then the Center View on Marker button. This should position your view on the space you created. Right click in one of the viewports and select Add/Object, This will bring up a Select Object Type window. From the Class Types menu select GameStartPoint and then select ok, this adds the starting point from where you enter the level when in the game, this is an object.

There are three modes for selecting and working in DEdit: Brush Edit, Geometry Edit, and Object Edit. You will need to press the appropriate button on the top toolbar for which mode you need to be in if you deselect your object at this point. Notice that when adding new objects they appear in the middle of the marker (the big green crosshair looking thing). You can move the marker in the 2D views by holding the X key and moving your cursor, or if you have something selected and you can press the Marker to Selection button to center up on it. At this point if you select the Nodes tab in the project window, you will notice you have two items in your node tree now. You can select from this list no matter what mode you are in. The node tree is a means of organizing your level in a manor that will make it easier to work on, as it grows larger in size and complexity. With the GameStartPoint object selected, move your cursor to one of the bottom viewports and press your down arrow key once.

In your top view using the right arrow key move it two spaces to the right. This will move the selected object one grid space down, which should leave it 64 units (one grid space) above the floor. The arrow keys are an optional way to move items in the editor. With the marker still centered on the brush right click on one of the viewports again and select Add/Object again. This time select the WorldProperties object from the ClassTypes window. The level will now run, but needs a light object placed in it or it will too dark to see anything. With the marker still centered on the brush, right click any viewport and select Add/Object again. From the ClassTypes window select the light object to add a light. Using the up arrow key in one of the bottom viewports, move the light up one grid space. It should now be one grid space from the top. What you should now see is a new box above the old one that is surrounded by a large sphere. The sphere is the radius within the level that the light will fill. Go to the Properties tab in the project window and look at the properties of the light. In most cases and entity’s properties are the most important tool used to control its behavior. In the case of lights, this is where you can change their size, brightness and color. The light’s current size (set in the LightRadius property) is 300. That’s probably a little small, so change the value to 600. In the viewports you’ll see the size of the light radius increase as well. Now it’s large enough to make a good-sized pool of light around the player. Now is a good time to save your level by pressing the Save Project button on the top toolbar. It’s a good idea to save your progress often when working on levels. The level is now ready to process and run. Press the Process World button on the top toolbar, when the process window pops up select the Process button and press the Close button when it’s done. To run the world, press the Run World button on the top toolbar.

Adding a Second Room

This tutorial will guide you through the process of adding a second room to your level. This exercise requires that your grid size be set to 64 units in all your viewports.

Select your original brush you created in the editor either in the node tree or by left mouse clicking over it in one of the views while in Brush Edit Mode (found on the top toolbar). Select the Nodes tab in the project window, right click the top folder (Test_1) and select Add Container Node. This will create a new folder in the node tree. Name the new folder Room_1. You can name/rename a folder or item at any time by selecting it in the node tree and pressing F2 or right click the folder and select Rename. With your brush selected right click the new folder (Room_1) and select Move Tagged Nodes Here. This will move your brush into it’s own folder to make it easier to work with. Do the same with the light object you added to place it in the Room_1 folder.

Center the marker on the geometry that makes up the room. In the perspective you will need to position your view to the interior space of the brush. You will need to be in Brush Edit Mode (top toolbar) to work with the brush and the polygons that make up the brush. With the brush selected press Ctrl + J to disconnect the polygons that make up the brush. This should leave you with six individual polygons. In the 3D viewport select the wall on the right side of the room. If your not sure which one it is, keep selecting them until you see the line on the right side of your top right (top view) viewport highlighted with handles on it. With your wall (polygon) selected move to your cursor to the bottom left (side view) viewport. Move your cursor to the top of the polygon and one grid space left of center. Press the spacebar and it should create a point on the grid one space left of center. Move your cursor (making a straight line) to the bottom of the polygon and press the spacebar again. You should now have a straight line that follows one space left of center down your polygon. Press the S key to split the polygon. This is called a two-point split. You should now have a split down the left side of the polygon. In the 3D view select the polygon to the right (the right half of the wall you just split) of the split. With the polygon selected move the cursor back down to the bottom left (side view) viewport and make a split one grid space right of center (two spaces right of the first split) the same way you did the first one. This should leave your wall in three pieces (polygons). In your 3D view select the middle polygon of the wall and move your cursor back to the bottom left (side view) viewport. Your polygon should be two grid spaces wide and the full height of the wall. Grab the handle on the bottom center of the polygon by holding the left mouse button down on it and raise it up three grid spaces. There should now be an opening in the wall (Figure 3. shows 3D and side view).
nolf2begin5.png
Figure 3.


In your 3D view select all three of the polygons that make up the wall. You will need to hold down the Ctrl key while left mouse clicking each polygon. Holding down the Ctrl key while selecting allows you to select multiple items whether they are brushes, polygons, or objects. With all three polygons selected press Shift + J to connect or join them. You can now select anywhere on the wall and it will select the entire wall. With the entire wall selected move your cursor to the bottom left (side view) viewport and make a horizontal split across the entire wall that runs along the top of the opening you made (two grid spaces down from the top). You can do this the same way you made the vertical splits to create the opening. In your 3D view select all the polygons that make up the wall and join them again by pressing Shift + J. At this point the wall should be made up of five polygons that are joined (Figure 4.).
nolf2begin6.png
Figure 4.

In the 3D view select the wall again, the whole wall should select with one click since the polygons were joined. You will need to be in Geometry Edit mode for the next operation. With that wall selected press the Geometry Edit button on the top toolbar. Move the cursor to the bottom left (side view) viewport. The door opening is there but the geometry is incorrect. In Geometry Edit mode you will see at the corner of each polygon there is a little dot that highlights when you run the cursor past it, this is a vertex. For geometry to clean, a vertex should always meet up with another vertex or be on a corner. If it sits an edge instead of another vertex, it creates what is called a t-junction and while the level processes, it will try to fix these on its own. It is better to build clean and avoid making the processor make the decisions on how to cut up the geometry for you. You will also get better lighting results if you build clean. With the wall selected and in Geometry Edit mode, in the bottom left (side view) viewport move the cursor over the vertex that is not in a corner on the left side of the wall (you should see it highlight). Hold down the M key and the left mouse button and drag the vertex up to meet with the one in the top left corner. Now using the same technique grab the top left vertex that meets the ceiling above the door and move it to meet up with the one in the far left upper corner (Figure 5.).
nolf2begin7.png
Figure 5.

Do the same thing for the ones on the right side, dragging them to the top right corner. The geometry around the door is now clean. The floor isn’t, but we won’t worry about it for now. At this point you can select all the walls in the room and join them using Shift + J to keep things manageable. You will need to be in Brush Edit (top toolbar) mode to select and join them.

We will now add a hallway. In the project window select the Room_1 folder in the node tree from the Nodes tab to highlight the room and press the Marker to Selection button on the top toolbar. This should center the marker on your room. Using the top right (top view) viewport zoom the view out (using the O key or mouse wheel) enough so that you could fit two rooms in the view. Using the same technique you used to create the first brush (Room_1), create a brush on the right side of the existing room that meets up with its edge and is centered. Make the brush two grid spaces wide and four grid spaces long (128 x 256). When the editor prompts you for the thickness after you connect the points to make the brush, 256 will work for now. You should now have a new brush that is highlighted, but doesn’t sit flush with the door opening. With the brush still selected, move the cursor to the bottom left (side view) viewport and drag the handles so that the new brush is the same size as your door opening. The brush will already have a texture on it since you selected a texture for the first room. At this point move your view out in your 3D window so that you can see the entire room and the hall (Figure 6.).
nolf2begin8.png

Figure 6.

With the hall still selected, press the semicolon ( ; ) key. This should have hidden everything except for the new brush you created since it was selected. To unhide all just press the apostrophe ( ’ ) key, but keep the other stuff hidden for now. With the hallway still selected press the Center View button on the top toolbar to center up your view on the piece you’re working on. Now press the Geometry Edit button on the top toolbar to go into geometry edit mode. In the 3D view, position yourself at either end of the hallway and hold the cursor over the polygon. You should see the edges of it highlight red when doing this. When all the edges around the polygon are highlighted red, press the Page Down button to delete it (Figure 7.).
nolf2begin9.png
Figure 7.

You can hit Ctrl + Z at anytime to undo your last action, you can also select undo at the top of the editor with Edit/Undo. Delete the polygon at the other end of the hallway the same way. You will now need to go back into Brush Edit mode (top toolbar). Once back in Brush Edit mode, with the brush still selected press the F key to flip the normals (turn it inside out). You should now have a hallway that is open on both ends. Press the apostrophe ( ‘ )key to unhide the rest of the level. In your node tree make another container like you did for the room and name it Hallway. With the hallway selected right click on that folder and select Move Tagged Nodes Here to place the brush in that folder.

Select the hallway and press the Marker to Selection button (top toolbar) to center the marker on it. In the node tree select the entire Room_1 folder, this should select all the geometry and the light object that make up the room. With the entire room selected go to the top of the editor and select Edit/Copy and then Edit/Paste Alternate. This will create a duplicate of that room sitting in the same world space as the original, folder and all. With the entire new room still selected move the cursor to the top right (top view) viewport. While holding down the Ctrl key press the right arrow key four times to rotate the new room into position. When you rotate items, the editor uses the marker center as the rotation center point. With the marker centered on the hallway the new room should rotate around it and sit right into the correct position. If things aren’t set up so handy, you can always rotate off any given point and manually move it into position by dragging it with the mouse, or nudging it with the arrow keys. Now in the node tree rename the new folder to Room_2 by highlighting it and pressing F2, or by right clicking it and selecting to rename it. You should now have two rooms connected by a hallway. Save your work, process it, and run it.


Applying Textures

Applying the proper textures to there surfaces is a key element in making a level feel like an actual place. This tutorial will guide you through some of the texturing basics in DEdit using the level you just created. It will also cover some basics in brush properties.


Select the Room_1 folder from the node tree and press the semicolon ( ; )key to hide the rest of the level. In the 3D viewport, move you camera view inside the room. You will need to be in Brush Edit mode (top toolbar) to start out. Inside the room, select the polygon that makes up the floor. Under the properties tab in the project window there should be some basic properties for this polygon. Select the dropdown for the lighting field and change it to lightmap. On larger polygons such as floors and ceilings changing the lighting to lightmaps will look better, but at a cost. Lightmapping is a performance hit to the engine and should be used sparingly. Select the polygons that make up the ceiling and walls, and do the same thing. Now select all of the walls that make up the room. At the bottom of the editor you will see the room size is 512x256x512. This means that your wall height is 256 units, and the SWSib030 texture that was applied to the room is 256x256 so it fits nicely. Right click in any of the viewports and select Texture/Map Texture Coordinates. This will bring up a new window that allows you to manipulate the texture size and position. The top portion of the window is for adjusting offsets. The wall texture should already fit correctly but feel free to adjust the offsets to see what they do. Just select cancel when you’re done so that the texture remains as it was. Press the U key to deselect any geometry and go into Geometry Edit mode (top toolbar). In the Siberia texture folder under the Textures tab in the project window, select the texture SFSib002. In your 3D viewport highlight the floor by moving the cursor over it, you will see the edges turn red. Press Ctrl + T while the polygon (floor) is highlighted to change the texture to the new texture. Do the same thing for the ceiling using the SFSib001 texture. You can view all the textures in a set by right clicking on the list and selecting View Texture Palette.

Tip: In Geometry Edit mode you can highlight a texture on a surface by holding the cursor over it and press the K key to have the editor align it for you. You may have to press it a few times since it lines the texture per edge and may not pick the edge you want to use first try. You can also press Shift + C to have it fit the texture to a surface. Note that this will stretch the texture to fit and it may need to be manually adjusted in the Map Texture Coordinates window to adjust it to look proper.


Adding Prefabs

Prefabs are pre-assembled sets of geometry and sometimes include objects such as Lights or worldmodels. Prefabs are a quick way to bring a level to life if they are already made. They are a very efficient way to build for items that are going to be used more that once. Also, you can make changes to a prefab on it’s own, and it will update the changes across the level/levels globally for that prefab the next time the level is loaded in th4e editor.


Start with the existing Test_1 level. Select Room_1 from the node tree and hide everything else. Select the light object that you already added to the room from the node tree. Under the Properties tab in the project window, change the objects BrightScale field from 1.0, to 0.2. Since the prefab light prefabs you are about to add already have light objects in them, this will change this light objects value to make it dimmer. The Light objects are used primarily as fill or ambient light. Add a container node in the Room_1 folder and name it Prefabs. If you go to the node tree and highlight the new Prefabs folder and press F3, it will make this folder the parent folder. The prefabs you add will now automatically be placed in that folder. In Brush Edit mode select the polygon that makes up the ceiling and press the Marker to Selection button. Now go to the Prefabs tab in the project window and select the Siberia folder. Scroll down to Light_Flourescent_Basket_On_96x9x16 and double click on it from the list to add it to the level. You will need to be in Object Edit mode to select prefabs with the mouse in the editor. You can select anything from the node tree no matter what editing mode you are in. In your top view move the light two grid spaces with the down arrow key. Add another light prefab and move it two grid spaces with the up arrow key to give you two lights place appropriately on the ceiling. Now select the polygon that makes up the floor and select Marker to Selection to place the marker on it. Scroll and select a desk in the Siberia prefabs folder and double click on it to add it. In the top view viewport rotate the desk with Ctrl + right arrow key to make it facing the doorway. In the same viewport nudge it with the arrow keys to place it in the center of the room. Now add a chair from the Siberia prefabs folder and position it behind the desk. You should have a general idea how the prefabs are used and you can add whatever prefabs you choose to furnish the area at this point. Some prefabs have objects in them to allow the AI to interact with them in game. If you place these and don’t have AI volumes in yet you will get runtime errors in game, but the level will still run.

Tip: To learn more about how things are set up in the game you can right click on a prefab from the prefabs list and select to open it. With the prefab open, you can inspect values and how switches and such are set up. It is advised not to save any changes when you close the prefab or elements of the game may not work properly anymore.

We will now add a window to the room. You will need to select and explode (disconnect) the walls using Ctrl + J. With all the walls still highlighted hold down the Ctrl key and left mouse click on the wall to the rear of the desk (opposite of the doorway), this should deselect this polygon. Now press Shift + J to rejoin the remaining walls. Select your Prefabs folder you added to Room_1 in the node tree and the with the cursor over a viewport, press the Start Bracket ( [ ) key (the End Bracket ( ] ) key will unhide a selected item) to hide them for now and the U to deselect them. Hiding and unhiding your work makes it easier to see what you are doing when working in the viewports. Select your back wall where you are going to add your window to highlight it and select Marker to Selection to center the marker on it. Under the prefabs tab in the project window, select the Siberia folder and scroll down to the Window_02_104x56x8 prefab. Double mouse click the window prefab from the list to add it. You will need to move the window into position using you top and side view viewports. You will need to adjust your grid size in these viewports to get the selection on center and flush with the wall. In the top view there should be a 2 unit overhang on the interior side of the window. In the side view, position the window so that it is about centered with the door opening space. Using the techniques learned to add the doorway, cut up the wall behind the desk (using two point splits) to make a hole in the wall to place a window. You should be able to adjust your grid size, and simply make your splits by selecting the wall and following the outline of the window prefab (one edge at a time). Make your first split vertically down the left side of the window. Select the polygon on the right and make a split vertically down the right side of the window. The wall should now be made up of three polygons. Select all three by holding down the Ctrl key and mouse clicking on them in the 3D view. Now join them by pressing Shift + J. Make two more splits, one above and one bellow the window, again following the outline of the window. Select all the polygons that make up the wall and join them again using Shift + J. With the wall still selected go into Geometry Edit mode on the top toolbar. In the 3D view, hold the cursor over the polygon that covers the window to highlight it and press the Page Down key to delete it. At this point you may use the technique to clean up the t-junctions covered in the tutorial to make the doorway if you choose. You should now have a window in the wall that isn’t covered by a polygon.

Adding a Sky

This will be a simple tutorial on adding a skybox to your level. We will be using the Test_1 level for this exercise. Set the grid size to 64 in your 2D views.


Holding the cursor over any viewport press the apostrophe ( ’ ) key to unhide all of your work. You will need to be in Brush Edit mode for the next step. In your node tree, select the top folder and add a new container to it. Name this container Sky and press F3 with the new folder highlighted in the node tree to make it the active parent folder. In the top view viewport, using the spacebar make a box around the level that has a one unit space between it and the rooms all the way around. When you complete the box and it prompts you for a thickness, 256 units will work for now. Position and size your brush so that there is a one-unit space between it and the rooms in your side view viewport (Figure 8.). You will now need to flip the normals on the brush by pressing the F key while it is selected to change it into an interior space. Your rooms should now be sitting inside of the new brush. With the new brush selected go to the textures tab in the project window. Highlight the main texture folder and select the Sky texture, press the Apply Texture button on the top toolbar to give your brush the new texture. Now you will need to go to the Properties tab in the project window and change the brush Type from Normal to SkyPortal using the dropdown. This flags the selected item to use the information from a Skybox that we are about to add.
nolf2begin10.png

Figure 8.

In the top view viewport zoom your view out a bit using the O key or the mouse wheel. Move your marker using the X key so that it is positioned outside of your level (the rooms). From the Prefabs tab in the project window, select the Siberia folder and scroll to select and add the Sky_Night prefab. After you add it, if it’s not outside the walls of your level, just move it so it is (Figure 8.). If you process and run the level now you should be able to see the night sky through the window, this particular sky doesn’t have any clouds in it. Feel free to try other skies out of different prefab folders to see what they look like.


Outdoor Environments and Effects

This tutorial will guide you through the basics of creating an outdoor area and run you through some of the effects used in these areas.

Select the Worlds tab on the left side of the editor and highlight the Worlds folder. From the toolbar at the top of the level press the New World button. Name the world Test_2.

In your top view, right click and select Add/Box. For the Thickness field select 1024. This should have created a large box that will be used as an outdoor area. Zoom out in all of your 2D views so that the entire box is visible in each of them. In Brush Edit mode with the cursor over any viewport press the F key to flip the normals and create an interior space. Under the Textures tab in the project window select the Sky texture from the main folder and with the Apply Texture button on the top toolbar apply this texture to the new brush. In the Properties tab with the brush selected change the Type field to SkyPortal with the dropdown menu. Under the Prefabs tab in the project window, select the global folder and add the Sky02 prefab to the level. In your top right (top view) viewport move the prefab outside of the room by grabbing the handle in the middle and dragging the selection.

Right click any viewport and select Add/Object, choose and add the WorldProperties object from the Class Types window. Add a GameStartPoint object using the same technique and lower it a couple grid spaces so it isn’t in the same space as the last object added. Now add a StaticSunlight object the same way. Raise your StaticSunlight object near the top of the ceiling, and press the Marker to Selection button on the top toolbar to center the marker on it. Press the Center View button on the top toolbar with the StaticSunlight object selected to center the view on it. In the bottom left (side view) viewport zoom your view out a little so that you can see the whole StaticSunlight object. Rotate the object by holding down the Ctrl key and pressing the left arrow key so that the blue vector (the blue line on the object) is pointing down. This will make the sunlight shine straight down.

In the 3D view select the brush and explode it using Ctrl + J, holding the Ctrl key, left mouse click the floor to deselect it and rejoin the remaining polygons by using Shift + J. Select the polygon that makes up the floor and go to the properties tab and change it’s Type to normal and it’s Lightning field to Lightmap. Under the Textures tab select the TFJp009 texture from the Japan folder and apply it to the floor polygon using the Apply Texture button on the top toolbar. You should now have an outdoor level that is ready to run. You may process it and run it to take a look at this point if you wish. Note that the sky won’t mate up with the ground due to the bottom polygon of the skybox prefab not having a texture on it. Most of the skyboxes are made this way for performance benefits, since there is usually a fence, mountain or building to break the ground plane and you would never see the bottom of it anyway.

To add an effect such as grass you need to place a scatter volume. In one of the viewports right mouse click and select Add/Object. From the Class Types menu open the VolumeEffect folder and add the ScatterVolume object from that folder. Although it may look like a brush in the editor, you will need to be in Object Edit mode to scale the object’s proportions. It is advised to move these manually with the mouse and the object’s handles, and not to try to rotate them. The volume now needs a texture to specify what it is. With the volume selected, go to the Properties tab in the project window. In the TextureName field select the browse button to add a texture. Browse to the TexFX/Grass folder and select the grass2.dtx for the texture to use. Now move the volume down to rest on the ground plane and move it near a corner. The volume will put grass on any texture it touches unless you specify the only texture you want it on in the PlacementTexture field under the Properties tab. The level is ready to process and run to see the grass that’s been added. Don’t try to add grass for hiding or cover, it is a volume effect and these can be turned off in game.

Snow is added to a level by placing a snow volume. In one of the viewports right mouse click and select Add/Object. From the Class Types menu open the VolumeEffect and add the SnowVolume object. Although it may look like a brush in the editor, you will need to be in Object Edit mode to scale the object’s proportions. It is advised to move these manually with the mouse and the object’s handles, and not to try to rotate them. The volume now needs a texture to specify what it is. With the volume selected, go to the properties tab on the left side of the editor. In the TextureName field select the browse button to add a texture. Browse to the TexFX/Snow and selcect to use Snowflake1.dtx. Now stretch the volume so that it meets the ground and is about 512 units tall or so. The level is now ready to process and run to see the snow you just added. Snow can be blocked from entering interior spaces such as buildings by adding a polygon with the Type field set to ParticleBlocker sitting where you want the snow to stop. A quick way to do this is to just copy the roof and set the new roof with the brush Type set to ParticleBlocker.

Lighting Basics


Working With Light Colors

A property you may want to modify is the light’s color. To change the colors, click on the color sample button next to the property name. Start by clicking the white button (LightColor). The dialog that comes up is a standard color picker dialog, and it allows you to pick from a standard palette or create your own custom colors. Choose one of the very light blue colors for something similar to a fluorescent light. You can use the slider on the far right to lighten or darken the color to your taste. When you’re done, close the dialog and you’ll see your new color in place on the LightColor button. Lastly, you can set the brightness of the light using the BrightScale property. At its default setting of 1.0, the light appears at a normal brightness. If you change the value of BrightScale to 0.5, the light’s brightness is halved. However, the radius stays the same. Thus, you can create a very large light that doesn’t overwhelm the area closest to its center. Likewise, if you want an intensely bright light, you can increase the BrightScale value to 2.0, which will make the light much brighter. For now, leave BrightScale as it is.

There is another useful type of light with very different behavior from the regular one: The DirLight. While a normal light throws light in a sphere all the way around it, a DirLight acts like a spotlight: It throws light in a cone, the diameter of which you can control.



The Dirlight

A DirLight is a directional or spotlight. You can aim a Dirlight using the object’s Rotation property. Click the button next to the property’s name and you’ll see a dialog appear. Within this dialog, you can control every aspect of the object’s facing. Each of the three aspects has a range between 0 and 359. Yaw controls the horizontal facing of the object, and is aligned identically to the Top viewport like a compass needle. You can use the preview display at the top of the dialog to see how the results will appear. A setting of 0 points the object straight “north,” towards the top edge of the Top viewport. A setting of 90 would aim “east,” a setting of 135 would point “southeast” towards the lower right corner of the viewport and so on. For now, set the yaw to 180 to spin the Dirlight around so it’s facing the opposite direction.

Pitch controls the vertical angle of the object. The Pitch preview display shows the result of your changes. Since the Dirlight is pointed at the proper angle already, there’s no need to change this.

The Roll control controls the spin of the object. This is useful mainly for props or cameras, where you want the object to bank or its viewpoint to sway. You would change a motorcycle’s Roll, for example, if you wanted it to lean as it turned a sharp corner. Again, there’s no need to change this value in the case of a Dirlight.

You should also increase the LightRadius of the light to 600 to extend the reach of the light a little further.


World Ambient Light

You can add an overall ambient light value to your entire level. In the editor press Ctrl + W to bring up your World Info window. Enter AmbientLight R G B in the field with the R G B being light values for Red, Blue, and Green. An example for this would be AmbientLight 12 12 12. This would give the level a dim overall lighting with white light since the RGB values are all equal. It isn’t recommended to light the entire level like this without using the light objects. The world ambient lighting does not cast shadows and will give the level a flat overall look when used on it’s own.

Lighting Properties on Brushes

With a brush or polygon selected, you can change the way it is effected by lights in two ways. In the Lighting field generally Lightmap or Gouraud will be used for the basic lighting style. Gouraud lighting takes the light sample from the vertices to light the brush. This is the preferred method to light the majority of your world. On larger brushes or where a vertex meets an edge the results may not look very good. Keep in mind where your vertices are when placing lights in your level, and try to place the light source near them. Lightmapping creates better looking results on larger planes, but at a cost to perfomance. When a polygons is set to Lightmap you can optionally change the lightmap grid size. This can be found in the LightControl field. By selecting it, it will open a new dialog with a field in it named LMGridSize. The default value for the field is 20 and the shadows become more defined as the variable is decreased. Note that halving the value makes a quadruple hit to the performance. It is recommended only to decrease the value in isolated instances. Generally a value between 6 and 10 will give you a pretty defined shadow where you feel it may be necessary.


Glass

To create glass, simply bind a brush with a glass texture to a WorldModel object and adjust a few fields under the Properties tab in the Project Window. Set the DebrisType to Window, the SurfaceOverrride to Glass, and the BlendMode to Translucent. The Alpha field dictates the opacity of your glass, with 1.0 being opaque, decreasing the value makes the glass more transparent. Generally the Alpha on glass is set to about 0.5.



Occlusion

An occluder is a plane with the brush Type set to Occluder. Occluders are most effective when they are axis aligned (not set at an angle), it is not recommended to place them otherwise. Occluders are placed to block the engine from drawing geometry that is not visible to the player, thus reducing the number of triangles draw by the engine. The geometry of a level is divided into renderblocks, with each renderblock contains 2,000 triangles. Any geometry that is associated with a worldmodel will draw it’s own renderblock regardless of the number of triangles within it. If a renderblock cannot be seen by the engine from the players perspective the geometry contained will not be drawn by the engine. When possible it is best to run them a good distance through the geometry if they lead to an area where the player couldn’t see in game anyways. This will assure they cover as many renderblocks as possible. Occluders do eat up resources at runtime, so the should be used sparingly and efficiently. Small occluders are not very effective since the majority of renderblocks are rather large and would not be hidden behind them. There are two types of occluders, dynamic and static.



Static Occluders - Static occluders are always on and occluding the geometry behind them. They are best suited placed in walls, ceilings, and other larger pieces of geometry which the player could not see through anyway. If a static occluder has bad placement it is most likely you will see geometry popping in and out when running the game.





Dynamic Occluders - Dynamic occluders are set-up to work in conjunction with a volume. When a player is in the volume the occluder is active, it becomes inactive when the player leaves the volume. The dynamic occluder is valuable to hide large sections of geometry when the player is in an area where the geometry is not visible anyway. To make a dynamic occluder volume you can just create a brush that you want to act as the volume. Center the marker on the brush and right click any viewport and select Add/Object, from the Class Types menu select and add the DynamicOccluderVolume object. Select the brush you created for the volume, and in the node tree place the brush under the DynamicOccluderVolume object. With the DynamicOccluderVolume object selected go to the Properties tab in the project window. Notice there are fields for occluder names. Enter the name of the occluder/occluders you want to be active when the player is in the volume in these fields. It is best to give the dynamic occluders special names to make them easier to keep track of when using them. You can rename them in the node tree, and example would be Dynamic_01.
You do not have the required permissions to view the files attached to this post.
Image

User avatar
Spawn
Admin
Admin
Posts: 1310
Joined: Sun Jul 25, 2004 12:50 am
Location: Norway
Contact:

Re: basic lightning, glass, occluders

Post by Spawn » Thu Mar 24, 2022 2:32 am

Adding Basic AI

The Nolf 2 AI systems are highly advanced and rather complex. Adding a complete set of AI that will behave in a realistic fashion under all conditions is beyond the scope of this document. However, the basics of adding AI are simple. This section will show you how to add a single patrolling AI that will attack when it sees the player.

First, load the Test_01 world, and then save it as Test_03. Then, select Room_2 from the node tree and hide everything else. Next, add an AIRegion object and place it somewhere in the room. It’s exact location is not important. Now add an AIVolume object at the center of the room, and expand it’s size until it almost fills the horizontal dimensions of the room without actually intersecting with any walls. Note that the AI use these Volumes to determine where they are allowed to go, so AI volumes that intersect with walls can allow the AI to walk right through. When done, click on the properties tab, and type AIRegion0 in the Region field.

Now that the volume is placed, add 2 AINodePatrol objects to the level and place them at opposite ends of the room. Make sure that the nodes are positioned within both the horizontal and vertical boundaries of the Volume, or the AI will not be able to reach them. At this point, you must modify the Next property of each node so that they point to each other (i.e. AINodePatrol0 points to AINodePatrol1 and vice versa).

Now that the AI environment has been established, it’s time to add an AI. From the World menu, select Add Object, then click on CAI from the object menu, and then select CAIHuman. Make sure that the AI is placed somewhere within the horizontal boundary of the AIVolume, or it will not be able to move when you run your world. When it’s in position, click on the Properties tab. For ModelTemplate, type in or select HarmGuardPurple. For GoalSet, type in or select Patrol. Finally, Next, click on the Attachments property, and select Sterling from the RightHand field. When done, click on OK to close the attachments window.


To learn more about working with AI, see the Nolf2 AI and Nolf 2 AI Gameplay Setup sections of the Nolf 2 help file.



Creating Multiplayer Levels
The Doomsday mode of play will be briefly covered in this section for creating team based levels. Doomsday levels are very similar to standard CTF (Capture The Flag) levels as far as the layout goes. The level should consist of two bases that are identical or equally balanced in their design. Multiplayer levels require more GameStartPoints, and the Team field in the objects property must be set to specify which team will use that GameStartPoint. Team0 is for the blue team and Team1 is for red.



Below the team fields are two selections for StartPoint and SpawnPoint. Setting StartPoint to true will use this object as a GameStartPoint, a player will enter the level at this point when the level loads. Setting the SpawnPoint to true will use the object as a spawn point, the player will respawn (appear there) after being killed. With both fields set to true, the object will be used as both. Generally the GameStartPoints (8 or more) are set in close proximity to each other near the Doomsday device in each base with the StartPoint and SpawnPoint set to true. The GameStartPoints with only the SpawnPoint set to true are usually placed around that teams base in areas where it would be safe to respawn and less likely to be instantly confronted by the opposing team.



The Doomsday bases and pieces are simple to add, as they are available as prefabs in the Global directory of the Prefabs tab in the Project Window. The Doomsday_Target prefab goes in the blue base and the Doomsday_Target2 goes in the red base. The pieces needed to assemble the Doomsday device are the core, transmitter, and the batteries, they are also prefabs and can found in the same folder as the bases. Each level only needs one of each piece placed in it. The core is generally placed in the center of the level making it equally accessible to both teams. The transmitter is placed in one base and the batteries in the other. Note when placing the items and start points, that they should be in the same position in either base to keep the two sides equal. The same rule applies for placing weapon and gear items in the level. Also, you may notice that the Doomsday bases and pieces will not appear in your levels when you run them through DEdit. This is intentional, since Doomsday levels are also available in Deathmatch modes.



In order for the game to recognize your multiplayer levels, they must be named for the game mode they were designed for, and their .dat files placed in the Game\Worlds\RetailMultiplayer folder of your .rez file. For Deathmatch/Team Deathmatch only levels, add the prefix “DM_” to the level game, e.g. “DM_Test01.ltc”. For Doomsday/Deathmatch/Team Deathmatch levels, use the “DD_” prefix. Cooperative levels do not necessarily require a prefix, but must be set up properly in the game/attreibtues/coopmissions.txt file before they will be recognized by the game.



For more information about setting up cooperative missions, and creating .rez files to distribute your levels, please refer to the Nolf2 Contentpacks and Modifications section of the Nolf2 Tools and Source Code Help file.
Image

Post Reply
jedwabna poszewka 50x60