66364aeb900b9

66364aeb90960
1 Guest is here.
 

Topic: ShockEd for Dummies pt II Read 3332 times  

66364aeb937c1
ShockEd Basic Tutorial Part 2: Lighting, Objects and Rooms


Lighting at a Glance

As you can remember, the level is currently lit using toggle_lighting, which makes everything bright. This is an editor command only, and if you were to play through the main game everything would be lit with a uniform dull grey. In order to have a level with proper lighting we need to add light sources to the level.

There are several light types in dromed. Firstly, there is ambient lighting. This is a base line lighting applied to your level, and it will never get darker than the ambient value. In new dark this is defined in the editors -> Mission Parameters... setting under 'Rendering Parameters'. This menu has many entries, at present we will only deal with the Ambient Light property. The default value for ambient lighting under new dark is 63,63,63 (Red Green Blue). You can set this to whatever you like, for example 12,12,12 is near total darkness, while 255,0,0 is bright red. To see the effect click OK to apply, then portalise to apply the lighting.



Next there is the brush light. This is a terrain brush which emits a light of a certain intensity, it has no visible in game object and you cannot control its radius. To create a brush light, choose light instead of brush off the create sub panel, and then left click and drag where you want to create it. A yellow cross should appear on your plan views, which indicates where the light is. The light brush behaves similarly to an architecture brush, and has three properties shown at centre bottom; brightness, hue and saturation. Brightness controls the intensity of the light, while Hue and Saturation control the light's colour. By default the light is moderately bright (127) and white (0,0 Hue, Saturation). To see the effect of the light you need to relight the level- this is done as part of portalisation process, or may be done using the 'Light' command in the tools menu. In order to see differences you will need to turn off toggle_lighting if it is on, and if ambient lighting is set to a bright setting it may also not be visible. You may wish to experiment with different intensities and colours- if you wish to delete any lights select them and press delete. You may also want to see how they look in game using alt + g.



The advantage to using brush lights is that they do not take up valuable object space, as you have a limited number of objects. The disadvantage is that they have no visible source so may not look 'realistic' and they must be static, not animating.

Lastly there are object lights, lights which are emitted from objects- such as a fluorescent tube, button or chandelier. These are the most flexible type of light. In order to use these we will need to deal with objects, and the object hierarchy.

Basic Objects

To create any object you usually access the Object Hierarchy which lists all the objects available to you. Go to the Editors menu and choose the object hierarchy, or press F5. It defaults to 'archetypes' in the list box, these are the object templates that you can use. The list is expandable, and clicking on the + will expand that stage. Expand the 'Physical' option, and then the 'Lights' option. You will then see the whole list of available object lights, again some of which can be expanded. Click on the light you want to create, for the moment choose 'Wedge Wall Light' and then press create. The Create submenu should automatically default to Create Object, and now when you drag in a 2D window you will create a wall light.

Object hierarchyExpanded hierarchy

Create one in the middle of a wall somewhere. Do not create it within a wall though- any object that has its centre inside solid architecture will not be rendered! Lights are yellow in the 2d window so that you can easily spot them. Now, if after creating the wedge wall light you can't see anything in the 3d window do not worry. The wedge wall light is a one sided object, and is transparent from the wrong angle. Rotate it around and place it up against a wall near the ceiling. After lighting you will notice that this light emits a cone of light down. Place some more lights about the room as you see fit. If you highlight the wedge wall light and then go to the object hierarchy, it will appear at the position of the wedge wall light, which makes it easy to choose a similar type object.

Now, one thing that it is important to bear in mind is that the hierarchy is just a series of templates. All objects have 'properties' which determine what they are and what behaviour they have, if you manually change the properties enough you could turn a light into a rumbler or a rumbler into a light. The object hierarchy just speeds things up by having the properties already in place. This is extremely useful as it means you could have a chair emit light if you wished - if it is an object, you can change its properties.

Lets take a brief look at the properties. Click on your wedge light. First of all you will notice that when you click on it the name 'A wedge wall light' and then a number in brackets appears above the sub menu. This text is the name of the object, and the number is its object ID. Dromed will automatically assign a generic name to every object you create using the name of the archetype that you created it from as a template. You can change this name to make it more recognisable, and this is useful later on when you try to remember which object is which.

Below this name there are a few more buttons which relate to the object submenu. 'Floor me' attempts to align the bottom of the object with the floor and is useful for making sure that tables and other heavy objects are indeed on the floor. 'Class' is a shortcut to the object hierarchy. 'Links' opens up a window where you can specify links between objects - more on that later, and 'properties' opens up the properties dialogue box.

Click on the 'Properties' button to look at the wedge wall lights properties. A window much like the object hierarchy will pop up.



The title of the dialogue box is once again the name and ID of the object, and within the dialogue box this is once again repeated. The 'cube' symbols that you can see in the hierarchy indicates a start of a new object, and everything until the next cube are properties of that object. The object system works under the principle of inheritance, so any object automatically has the properties of objects further up in the hierarchy. This is important to remember, as the property editor inadvertently allows you to edit objects further up in the hierarchy, if you look at the screenshot below you can see that the next object after 'A Wedge Wall Light' is the 'Wedge Wall Light' itself. The latter is the object archetype, the template, and if you edit the properties of that you will change the properties of all Wedge Wall lights. Also, such edits will only be temporary as the object hierarchy is not saved unless you specifically tell the editor, so any alterations will be lost when you reload the level. A good rule to stick to is that you only edit the first object in the list, everything below it will be an archetype and should not be edited unless you know what you are doing. Another way of differentiating object archetypes with concrete objects (concrete is the term used to describe an object which is actually in your level) is the object ID that comes after it. Concrete objects all have a positive ID, while archetypes have a negative one, as you can see in the dialogue box.

The actual properties are marked by the filled in black dots, and are grouped so that similar properties exist under a relevant heading. So, anything that affects the way an object is rendered comes under the 'Renderer' category. Currently, the wedge wall light only has the Light property, but if you expand the archetype object below and that objects Renderer group you will notice that it will inherit 'Spotlight' and 'LightColor' properties too.

Object propertiesExpanded properties

At this point we'll walk through the steps to Add a property and change it. Make sure the top object is hilighted, as in the screenshot, and then click on the 'Add' button to add a property from the list. A large menu will appear of the available properties, go down to 'Renderer' and then click on 'LightColor'. A dialogue box will pop up allowing you to change the values of that property. Type in 0.33 for the hue, and 0.5 for the saturation and then press Ok. You will notice that the 'LightColor' has appeared in the list of properties for your wedge wall light. If you wish to change the values of a property, just higlight it and click edit, which will bring the property edit box back up. The Delete button will remove the property, but be warned, it only removes the property from that object, and if the property exists further up the archetype tree the object will then use the inherited settings instead. For example, if you deleted the LightColor property that you have just added the light will revert to the the light colour variables defined in the Wedge Wall Light archetype.

Properties aren't necessarily one variable and often have multiple variables that you can edit which govern the object's behaviour. LightColor allowed you to edit the hue and saturation, and editing the light property will allow you to edit the intensity of the light, the radius, and the offset from the object. Properties are the key to how an object behaves. The best way to work out what a property does is either educated guess work based on its name and looking at examples from the original missions. The internet is also a useful resource, of course, and many properties are similar or identical between Thief and SS2 as well. Not all properties are designed to be edited though, some are used by the game engine. 'Position' is an example of this, all objects will have it and it will automatically be updated depending on where you put the object, so changing it manually is not recommended. Also remember that some properties will be hidden further up the archetype tree. The property which makes the light sound like glass is hidden up in the 'Lights' archetype, and your concrete object will inherit that property and use it. If you can't work out how an object is achieving a certain effect remember to explore the archetypes for any likely properties.

Now, back to lighting. You should now know enough to experiment with creating lights and changing the lights properties so you can increase the brightness and change the light's colour, so we will return to exploring the light system. In dromed there are three basic modes of lighting, 'Quick Lighting', 'Raycast Lighting' and 'Object Lighting'. Quick lighting provides a rough lighting model, which will often show unrealistic shadows as it cuts corners in the lighting process to speed things up. When creating a general feel of the level quick lighting will suffice, but when you want to check the ambiance you should really try one of the other lighting models. 'Raycast Lighting' is a much better model but is also slower, there won't be any shortcuts taken in generating shadows but objects will not generate light. Most objects don't cast shadows anyway as far as the lighting model is concerned, but some do. In Dromed only immobile objects will generate shadows, and then only when you use object lighting. Object Lighting takes the longest but gives the best results, though it is only slightly different from raycast lighting. To switch lighting models you select the one you want from the Tools menu, and then go to Tools->Light to relight the level using that lighting model.

In new dark there is also a more advanced lighting system available under Tools-> Build Dialog... with more lighting options. This is a bit beyond the scope of this tutorial, but useful for future reference.

Another new dark feature is 32 bit/ hardware rendering in the 3d view of ShockEd- which significantly improves the appearance and fidelity compared to the default software renderer. This is only available if the game is running in hardware mode (true for most users) and requires enabling two commented lines in dromed.cfg. Remove the semicolon (;) from in front of the lines "editor_disable_gdi" and "edit_screen_depth 32", and add a semicolon before the line "edit_screen_depth 16". It is a significant improvement over the default.

Remember, the lighting model will not be updated until you tell it to by portalising.

Resizing Objects

It will take time for you to familiarise yourself with the contents of the object hierarchy, and what objects will suit your mission best. Hopefully you should by now know enough about it to place any object in your level, try adding some decor by using objects from the Object->Physical->Decorative section. For the moment stick to the Physical section, as that is where all the physical objects which you can place in the world exist.

Object placement is quite important, objects are not snapped to the grid, which means you have to do all the fine tuning yourself. It may look like your object is aligned up against a wall, but if you go in game, or zoom in, you may notice that there is a very small gap between the object and the wall. Try to always place objects completely flush with the wall, with the floor it is easy as you can use the 'floor me' button and the command 'ceil_object' will bring an object to the roof, but with the wall the easiest method is to enter in the coordinates by hand. Orientation of objects is another important necessity. People will notice if an object is the wrong way around!

Some objects in the hierarchy are not meant to be created, they are just there to hold property information for the child objects that occur beneath it and are not designed to be created by themselves, the actual object 'Decorative' has no properties at all and is there for organisational purposes. If you create one of these holder objects in world you will see a white wedge indicating that the object has no valid model.

You will also undoubtedly resize objects in your travels, but resizing objects has another catch to it. Let's create a table to resize, some tables to choose from exist under Physical->Decorative->Furniture->Tables. Pick one and place it in the middle of a room somewhere. Now, to resize you could use the same controls as brushes and the object will resize. The catch is that dromed differentiates between the visual size of an object and the physical size as far as the game engine is concerned. In other words, if you enlarged the table you could walk through the expansion and bump into the original table. To rectify this you have to change the Dimensions property, select the table and open up its properties, and then expand the Physics->Model area, and edit the dimensions property. Make the dimensions in the property match the dimensions next to the DWH boxes. Note that if we were editing a spherical object, such as a basketball, it would likely have a single radius setting in the dimensions instead. A shortcut to visual resizing is in the Shape->Scale property, and you will notice that it has some non standard values after you have resized your object. These numbers represent multipliers of the object models initial size. If you wanted to double the size of your object in all three dimensions you would change the scale value to 2,2,2 - assuming it started off as 1 that is. Also, for later on, you cannot scale AIs in this way.

You do not always have to match the dimensions up and some objects do not have a dimension property, for example the wedge wall light. These are usually objects which aren't designed to be walked into or collided with. If an object can be walked into then it has dimensions so that the engine can check whether you are walking into it, and if you resize the visual object you should resize the dimensions too. Doors are one example of objects whose dimension property must always be kept in synch with the visual size.



Doors, Links and Basic Scripting Properties

Remember that with Dromed objects and architecture are separate, so creating a door does not automatically create a doorway. You have to carve out a doorway yourself else the door will exist in solid space. Create another fill air brush in your level on the other side of a wall, so that there is a gap of solid between them, and then create a smaller airbrush roughly the size of a door to connect the two. You may have to reduce the grid size to 12. This will have to be refined later, as doorways are the same size as the doors, and until you choose a door you cannot make the doorway the correct size. For now, portalise, and then make sure that you can fly through one room, through the doorway, and into the next - checking that you can see from one room into the other. This will hopefully prevent one of the few commons stumbling blocks, not having a space for the door to exist in.

The next step is to get a door; object hierarchy, Physical->Terrain->Doors. Then choose the Sci Med Door. Create the door in the middle of one of your air brushes so you can notice its size, which is probably bigger than your doorway. Now, you could either resize the doorway to match your door, or the door to match the doorway. For the moment let's do the former. First we check the rotation of the door. If it is the correct alignment that is fine, if it is not, rotate the door's heading by 90 so it is in line with the wall door - assuming that your walls are at standard rotations. Note down or remember the doors standard dimensions, D: 6, W: 0.63, H: 10.5. We only really need to use two of these dimensions, depth and height, as doorways are sometimes wider than the door. Hilight the airbrush for your doorway, and type in the depth and height values of the door into the airbrush for a precise fit. If you had to rotate the door, then you will have to type the width in the depth box as the two have swapped due to the ninety degree rotation. After resizing the brush you will probably have to reposition it so that the floor is in line with the other two rooms, if you have not changed the grid size you may find that you cannot set the height to 10.5 due to snapping. Portalise, and the doorway should be the same size as the door. Move the door into the doorway.

Doors block AI sight when closed, if you move a door and do not portalise after you may notice some odd black rectangles appearing- these are due to how doors block sight. If you resize a door and do not resize its physical dimensions as well you may also see odd black rectangles appearing, doors should always have their apparent and physical dimensions matching unless there's a very good reason not to. Now, try going into game mode and opening the door...

And it won't work.

This is because it has not been told that you are allowed to interact with it, and nothing is telling the door to open. Click on the door and then have a look at its properties. It has a Door->Translating property which governs how the door opens - nothing wrong there, and there is a 'StdDoor' script which tells the engine that the object is a door and how it works on the Door archetype. What we lack is anything to trigger the door opening- in real life this might be turning the handle, pressing a button or simply pushing it so what we need is the DromEd equivalent. There are two general ways of triggering interactive objects with scripts, directly or via something else, through 'links'. In real world terms this is the difference between opening a door by pushing it directly, or by pressing a button/ approaching a sensor which does it for you. As we do not know about links yet (more later) we will first make our door open by clicking it directly. To do so we need to add several properties to the door object.

First, select the door object and open its properties. You want to add the property Engine Features-> Frobinfo to the door. Set the 'World Action' to 'script'. This tells the engine that the script can be fired by clicking on it. You also need to add the Inventory-> Pick Bias property and set that to 0.5. This property sets the object's selection priority- in most cases objects are not directly interacted with so the pick bias is set very low to avoid such objects competing with things like buttons that should be selectable.



If you try to test it now it still won't work.

Any new level by default hasn't got the script module loaded which controls the functionality of all objects. You have to load this module every time you create a new level. If objects and items do not work the way you intend, then the module has not been loaded. To load the module use the command, 'script_load allobjs' in the command window. In shocked there is only one module you have to load.

If you test the door now in game mode it will open fine- but will not shut and will disappear halfway through opening.

We can solve the first problem by adding a property which makes it automatically shut itself after a certain amount of time has elapsed, Door->Door Timer Duration. This is a number denoting the time in seconds the door will stay open before closing. Alternatively, if we fix the second problem we would also be able to shut the door by clicking on it a second time. The disappearing door problem requires us to make somewhere for the door to go when it opens. You may recall from earlier that any object that has its centre inside solid architecture disappears, and this is what is happening here. In order to have the door not disappear we need to create a slot into which the door can slide. Create a cube air brush of appropriate size- the door's DWH is 6, 0.63, 10.5 so a slot size of 6, 1, 10.5 might be best- so that the door can slide into it. Portalise and go into game mode. The door should work, not disappear, and shut of its own accord after a few seconds.



Doors in SS2 aren't normally opened directly though. They either open 'automatically' (actually via a hidden tripwire trigger) or are activated using a button. To do this we will need to learn a bit about links. To save time it will also often be useful to use 'multibrushes', these are selections of brushes and objects that may be duplicated together and moved in one go. Creating a multibrush is a simple task, hold down shift and left click on the objects to be multibrushed. In this case we want to copy the door object, and the fill air brushes defining the door frame and slot. This saves time as we do not have to create and change their properties from scratch each time. Once the objects are selected press insert to copy them and move the newly created selection into the desired position.

Note that multibrushes do not snap to the grid automatically as they would if created manually, as multibrushes may include objects as well as architecture. If you should want to gridsnap you can use the 'Highlight' menu items 'Highlight Unsnapped' then 'Snap Hilighted'. In this case it should not be a major concern as the architecture is simple, but unsnapped architecture can cause problems.

Once you have cloned and positioned the other door, portalise and you will have another door in a doorway. However, this time we want to create a button that opens the door instead of being able to open the door by frobbing it. Change the properties of one of the doors so that it has no FrobInfo and the pickbias is back to the default, either by changing the values back to defaults or by deleting the added properties. The next step is to create the button. Open up the object hierarchy, and go to, Functional-> Controllers-> SimpleButton-> Button#1. Place it next to the door and align it up against the wall, making sure it faces the right way. The button archetype is automatically set up to be frobbed so no properties have to added manually, but it hasn't yet been told what happens when you frob it. This is where links come in.

You have to add a 'link' from the button to the door, so that when you frob the button, it sends a frob signal to the door. To do this, highlight the button and click on the links button, in the window that pops up click on Add to add a link. When you add a link you have to specify the type of link, the object you are linking from and the object you are linking to, by object number or unique name if given. There are many types of link, some of which we don't really use as the game adds them on the fly. The most common, and the one we need to use for the button, is a 'switchlink' (in thief it is controldevice). The object ID of the button will be shown in the links window but you may need to cancel out to get the object ID of the door. You could also use the name of the object instead, which is why it is a good idea to rename objects that you need to link up, but by default the name of the door will not be distinctive.



If you are succesfull when you click ok you should see a link with flavour switch link from the button to the door. If either the To or From field is None, then you didn't type in the ID or name correctly, try again and delete the incorrect link. Once successful, select the door you linked to and go to its links, you will see a reciprocal (~switchlink) link going from the door to the button. This was automatically generated when you created the first link as links always come in pairs, going from one object to a destination object. If you save and test, frobbing the button will now open the door. If the Door->Door Timer Duration is still there then it should still auto shut after the door has opened. If your door connects to another room you may get trapped there if you go through, as at present there is only a button on one side of the door. If you wanted to have a door that was openable from both sides you would need to add another button on the other side, then add another switchlink from that to the door.

Room Brushes & Sound

You have probably noticed that you have no sound in game - the doors do not make sounds, nor do your footsteps and there are a lot of error messages in the MONO window saying '..not in room!'. This is where the room brush comes in. For a better sound calculation model, dromed uses room brushes. Sound can only propagate where these room brushes overlap, so you can control where sounds are heard. As you need to be within a room brush to create and hear a sound, all places that the player can visit have to be in a roombrush. You can create room brushes using the drag and drop way by using create room, but as the room brushes are normally going to follow the terrain you have created there is a shortcut key. Highlight the operation brush that you want to use as a template, and then press Shift + insert. A purple cuboid indicating the room brush will appear indicating the room brush. There are a few rules about room brushes. Though they can and should overlap slightly to propagate sound a room brush's centre should never be within another room brush. Also, room brushes are always cuboid in shape, but can be resized/moved/rotated like any other brush.



Go through your level, adding room brushes. Your level is relatively simple, so there should not be many problems and it should largely be a case of selecting the fill air brushes and using Shift + insert. Once you have finished, you have to build the room database for the changes to take effect, much like you did for lighting. The option is available through the Tools menu. Sound will only propagate between connected rooms, and it may be difficult to tell whether room brushes intersect or not. There is a visual shortcut though. There are two options available when you click on a room brush, Show All and Show Sel. When you toggle them on, dromed will display lines which indicate how sound propagates between room brushes. Show All shows all room brushes, and Show Sel only shows the connections to the nearest rooms. Remember that it will only update after you recalculate the room database. Once you are done test the mission and you should be able to hear sound from the doors- but not your footsteps, as the player is not yet set up properly.

It is also generally a good idea to add the line 'check_rooms' to your dromed.cfg file, as this will automatically highlight any bad rooms every time you build the database as well as showing their ids and why they are bad in the MONO. Not all errors thrown up here are critical though, only ones where centres are within each other. It may also find rooms connecting through solid space- which you will generally want to fix as you may end up being able to hear things you realistically should not, but that will not have any other adverse effects.

Rooms are also used to control the automap, change gravity settings, and to trigger events. They can act as a big tripwire which sends a SwitchOn signal to a button, or a lever, etc. The properties that you can assign are under Properties->Rooms. They are different from the way that you would assign properties to objects in there isn't really an example of a single 'concrete' room in your level, at least not in the same sense as concrete objects. If you change one instance of a room, you will change all instances of that room type. So, if you want to change the properties of a room brush you have to modify the room archetype list. Unlike modifying other archetypes, this information is saved with your mission and does not need a new gamesys. To do this, open up the object hierarchy, and in the listbox that says 'Archetypes' change to 'Rooms'. You should then be shown a different tree which shows the basic room brushes that the level starts with.

To create a different type of room brush, you follow the same procedure you would for objects. Click on the room type you want to create and then click on create. If you then drag on drop you will create a room brush, or if you then press shift and insert it when selected on a piece of terrain it will create a room brush to the same size of the type you last selected. You should notice that these new rooms instead of being called 'Default Room' have the name of the type you selected. Remember to switch back to default room afterwards. For most uses Default Room is fine, it is only for advanced features- radiation, gravity, automaps- that you will need to change.



If you already have a room brush present but want to change its type select the room brush and then click 'create' in the toolbar down the bottom. This will bring up the room hierarchy and you can then select the room type you want to change to, clicking create again will switch the room brush to what you selected.

To create a new 'room' type, go to the room hierarchy and select the room type you want to inherit from. This will usually be Default Room, but try to arrange your tree in a sensible manner. Let's for example make a less damaging version of the rad room. Select 'RadRoom' and then click 'Add'. Type in a sensible name, LowRad, and then click 'no' to concrete room. Your new room will now appear under the Rad Room, but it will have the same properties as RadRoom as we haven't changed them yet. Click on the LowRad and select edit, hilight the LowRad object and add the property Gamesys->Radiation Level. Change the 35 to 15 and ok. We now have a new room type with a lower radiation level which we can use to create rooms in our level like normal. It is vital that you remember that when you change a rooms properties you change all instances of that room in your level, so if you want a room brush to behave differently you have to create a new one in the hierarchy and use that instead. If you added radiation to Default Room for example then all the areas using Default Room would become radioactive!

Note: Radrooms will not actually cause radiation at present as the player is not linked up correctly, something which will described in part III

EAX settings work differently, you do not need to create a new Room archetype for every different setting, you can add these to individual brushes. To do so your room database must be up to date, and you can then select the room brush and use shortcut keys to assign the different EAX types. Assigning EAX values is not compulsory.

Part III will include all the stuff you need to turn your level into a functioning game rather than just some objects and architecture.
« Last Edit: 07. September 2013, 23:27:18 by Zygo »
Re: ShockEd for Dummies pt II (draft)
66364aeb93a85
Updated it into a more refined form. Note that there are a couple of pictures missing at present, as I have hit the attachment limit. It's also probably still a bit too wordy, even though I cut quite a lot from the original tutorial.
« Last Edit: 03. August 2013, 22:14:16 by Zygo »
Re: ShockEd for Dummies pt II (draft)
66364aeb93c7a
I have exempted global mods from upload limits. You should be able to upload the missing pics now.
66364aeb93db4
Cheers. Got too late last night so I'd stopped anyway.

Should be close(ish) to final form. Only other thing that might be useful is a check list/ direct step by step guide for basic functions and that might be better as a separate page anyway.

Your name:
This box must be left blank:

Look at you, hacker: a pathetic ____ of meat and bone!  (Fill in the missing word):
1 Guest is here.
We're not even sure if invisibility will save you here.
Contact SMF 2.0.19 | SMF © 2016, Simple Machines | Terms and Policies
FEEP
66364aeb951a2