A - Z Beginner Full Guide Page 6

From The DarkMod Wiki
Jump to navigationJump to search

"Teach Yourself Dark Mod In One Day!" by Fidcal

Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Index


More Sounds, More Atmosphere

We have already covered this in the section on rainfall so we are doing the same thing but this time to add tension as the player enters the house...

  • Clone one of the speakers from the yard. Dark Radiant will automatically rename it. Occasionally two entities might get the same name when cloning and you will get an error when you try to play the map. If that happens you just have to rename it manually to whatever you want. No worries - but just be aware.
  • Give it the following properties...
  1. s_volume 1 = loudness
  2. s_mindistance 0 = start fade distance
  3. s_maxdistance 8 = fades to nothing here
  4. s_shader sound/ambient/ambience/mansion_tense_02.ogg = sound file. try also 01a and 01b (sounds can also be selected at the bottom of Entity Inspector when this property is selected.)
  5. s_looping 1 = plays repeatedly

Place the speaker in the middle of the big room. Check it vertically also to be half way up. Clone it and put it in small room too.

Save and try it out!

Portalizing: Visportals

Portalizing defines which areas of a mission are to be rendered at any time so as to avoid unnecessary rendering. Without it a big mission would grind to a halt. Our little mission could manage but even here, if you put in torrential rain you will find it slowing down on many PCs. Portalizing won't help out with the rain but it will improve performance indoors; why waste processing time on the rain when you can't see it?

To divide up the mission for rendering we use 'visportals'. These are simply brushes with one surface having a visportal texture. Full details of visportals are at Visportals and you should eventually get a good understanding of them. For now, this is how and where we shall put visportals in this tutorial mission...

  • Make a thin brush like a wall 4 units thick and about the size of a door.
  • Give it the texture common > nodraw all over.
  • Give it the texture editor > visportal on one of its big surfaces. This is its active surface which you should focus on when placing the brush.
  • Place it so the visportal surface is inside the yard door and fits the gap in the door frame (no gaps.) Technically it does not need to be inside the door but only need its visportal surface in contact with any part of the door but in this situation that's the most convenient place. Being in contact with the door will close the visportal when the door is closed so no rendering will take place of the outside when you are inside and vice versa. Even if the door is open it will still close itself if you pass through another visportal and round a corner.
  • Clone it, turn it 90 degrees, and place this one close to the old door to the little room. But here, the old door has holes. If the visportal connected with it then when closed the gaps in the door would go black. This would be true of a iron barred gate or portcullis or a glass windowed door etc. So place the visportal so its active surface is tight within the doorframe but not in contact with the door. It is still worth having because it will still work as an auto-visportal as you will see.
  • Clone again and tilt it over and put this one in the gap to the upstairs. Cut right through the ladder. I didn't expect this to work with the ladder entity poking through but it does.
  • Clone again and put this one just below the elevator platform. I left a gap between elevator entity and visportal surface. I'd have to check to see if it would be disabled if they contacted.
  • Clone again and resize this to go in the middle of the yard - right up to the sky and wall to wall. It should be placed at that protruding corner near the door so it crosses the yard from west to east. There must be no gaps.

Save, dmap, map and try it out. If you have torrential rain then you should notice a big difference when you go inside and close the yard door.

Now, try this, in the console type and enter r_showPortals 1 and back in the game you should see your visportals as green or red wireframes.

  • First make sure every one is working - that it is either red or green when you approach it (you won't see the ones too far away at all that's OK)
  • Now check they are working correctly...
  1. From the south end of the yard looking north with the yard door closed you should see the big yard visportal green and the door one red.
  2. Now open the door and the door one should turn green.
  3. Still without looking in through the door you should see the upstairs one and the old door one and maybe the elevator one two depending on your position. They will be red or green depending on your position. Move left so you see them round the side of the yard door visportal and they are red; look at them through the yard door and they should be green. In fact you should only see the elevator one if the old door one is green.
  4. Go inside and close the yard door. Its visportal should go red and if you have a monsoon out there the performance should improve.
  5. Open the yard door again and look back at its green visportal. If you are close you should see the big yard visportal outside also green if it is overlapping the door one. Now step back a few paces and to your right a little until the big yard visportal no longer clips over the door visportal. It should turn red indicating that the bottom half the yard is no longer rendered even though the door is open. Clever eh?
  6. Wander around and notice how the visportals open and close.
  7. You can also try r_showTris 2 which will show you what is being rendered at any time.

Sound Propogation

Visportals not only affect rendering but also sound propogation. Sound from the player to AI is directed through visportals and reduced if they are closed. Sound from AI to the player is also affected but comes more direct. So an AI the other side of a wall might be faintly heard. When a door in contact with a working visportal is opened further along he might be louder but the sound will still seem to come directly from him through the wall. Whereas if the player makes a noise the AI will hear it from the direction of the door and go there to investigate.

You might have already noticed that the sound of Creep and the thug in the house is reduced when you are in the yard with the door closed at mission start. And the sound of the rain is cut off when you are inside and close the door.

Finishing Decor & Furniture

Now you can finalize the appearance and add/move furniture to enhance the mission. Keep in mind this is a thief's den, a rough hideout. I see them almost as squatters in a derelict place...

I added a front door on the west wall of the big room to the north of the window. Just make a niche, fit frame and door - but make the door func_static or frobable 0 to stop it opening. It will just be static architecture like the window. Later you could expand this mission out through the door if you wanted.

I added a window upstairs and a few pieces of rough furniture. I put one of the chests up there and obscured it with a big old wardrobe and junk.

Have you noticed that convex corners that jut out like the one in the yard or window edges have ugly, mathematically-sharp edges. It is recommended that in a 'real' mission you soften them by clipping off the corner and replacing it with a bevel patch. Details are in Patches#Round and Softened Corners: Bevels and you might want to try at least one so you know how even if you don't do all the corners in this tutorial mission.

Down in the basement I moved another chest and added odds and ends, an upturned table, a coil of rope.

In the big room I stuck in a barrel, a long bench. In the kitchen some old pots, broom whatever.

In the yard some debris, an old cartwheel.

Take a look through the models and have fun!

Loot and Special Items!

Virtually all TDM missions will have loot for the player to find as an objective and often special items to find too.

Placing Loot

We need to place some loot around for the player to find and complete a couple of objectives. Creep is a thief so might have various valuable items stashed away but other stuff he might just leave lying around. Look in the entities under darkmod/Loot; you will see there are subsections Moveable and Static. Many loot items are in both lists. The Static ones will remain fixed at its start position so might be used if you don't want the item to be nudged or for say, a magical floating gem or a gold plate 'hanging' on the wall. The Moveables will fall from where you place them to the nearest surface below once the game starts and they can be knocked or nudged down a drain etc so keep that in mind. Both just go into the inventory as loot once frobbed by the player.

Just before you start placing loot, think about total loot values...

Counting Loot Total

Ultimately you will need to know the value of all the loot there is in your mission altogether so you can evaluate sensible objective amounts; there is no point in having an objective to get 1000 in loot if there is only 900 in the mission. At the time of writing there is no automatic method of counting this so this is what I did...

  • As you add loot items and they are still selected...
  • Check the check box in Entity Inspector to show inherited properties.
  • Select the property inv_loot_value
  • Click the check button at bottom right of Entity Inspector. This confirms the value as specific to this item, not just inherited.
  • You can of course change the values but keep in mind the defaults have been carefully chosen to make sense.
  • Any time you want to know the total loot value, load the map file into any plain text editor and search down for atdm:loot. You should then see the inv_loot_value and you will see all the values and count them as you go. If you forgot to set the value of any then you should spot all loot anyway and can adjust.


Go ahead and pick a few appropriate items. It's a tiny demo mission so we probably need to seed it more thickly than normal with plenty of loot. In particular we need a scepter for the main objective. This can be found in the entities at atdm:loot_scepter so put this in the best hiding place you can make but not so difficult as to annoy the player.

Special Items

Now the scepter is a special item we need to get for the main objective. If it just goes in with the rest of the inventory loot it will be anonymous - the player might not even realize they had frobbed it! So this is how to change a loot item into a special item:

  • Select the scepter
  • Give it these properties...
  1. inv_category : Special
  2. inv_loot_type : 0
  3. inv_name : Lord Frothley's Scepter
  • The inv_loot_value does not matter as it will not count towards the loot because we made it inv_loot_type : 0 but you can set it to zero if you want. If not, make sure you don't include its original value in your total loot count.
  • If you want and are able you can create an inventory icon as described before at Inventory Icon and then add the property inv_icon with value : guis/assets/hud/inventory_icons/<name>.tga (substitute whatever name you gave it for <name>)


Giving AI Keys and Valuables : Pickpocketing

Pickpocketing is an important theme in a stealthy thief game. Items can be attached anywhere on any AI, typically on the belt, but they can be half inserted into pockets (they need to be somewhat visible for the player to grab them) or they might be worn jewellery or ammunition - anything that seems realistic to you should be possible. The items have to be attached to a particular joint so they move with that joint. This is how to do it...

. Select one of the keys we have already made or you may prefer to use loot, say a belt purse - check the loot in the entity list. . In Dark Radiant, place the item where you want it to be located on the character, eg, belt. It is not technically necessary to make any contact - it will not fall and will still move with the joint even if it is floating ten feet away. . View from different sides in the camera to make sure it is aligned nicely. For example, you might be able to slip it under the belt but make sure it does not clip into the hip and look unnatural. It is often a matter of trying it out in game to see how it looks. . Add to the item the property and value - bind <AIname> . Add to the item the property bindToJoint <jointname>

A list of the joint names can be found at How to Make Your AI Unique#Joints Names but the most common ones you will use are LeftHips_Dummy for the belt and RightHips_Dummy for the other side.

Whether AI will need keys to enable them to go through locked doors is still work in progress at this time.

Note that attachments do not have to always be grabbable by the player - they can be mere adornment if you wish.

Objectives

Dark Mod mission objectives are very advanced but an editor is being developed to make it easy to set up quite complex challenges for the player. Do not use the earlier objectives editor (in Dark Radiant at least up to 0.9.5.) In this tutorial we shall only set up some common objectives as example by manually entering properties in an objectives entity...

  1. Steal back the scepter Creep stole from you
  2. Drop the incriminating message in a chest.
  3. Creep is a thief and must have other loot worth stealing - take at least 400
  4. Find his key and when all else is done, exit by the front door

Create an entity target_tdm_addobjectives and place it anywhere not in the void but preferably somewhere you can find it easily and add these properties and values. Do not include my comments shown in square brackets...

  • obj1_1_spec1 : name
  • obj1_1_spec_val1 : FrothleysScepter [use name of scepter]
  • obj1_1_type : item
  • obj1_desc : Nobody crosses me! Must get back Frothley's scepter Creep stole off me.
  • obj2_1_type : custom
  • obj2_desc : Pay him back! Drop his incriminating note in a chest so he won't see it till Sam tips off City Watch when I'm gone.
  • obj3_1_args : 400
  • obj3_1_spec1 : overall
  • obj3_1_type : item
  • obj3_desc : He's small time but Creep may have good stuff stashed he can't fence yet. Shan't leave without at least 400 loot.
  • obj4_1_spec1 : spawnclass
  • obj4_1_spec2 : name
  • obj4_1_spec_val1 : idPlayer
  • obj4_1_spec_val2 : exitLocation
  • obj4_1_type : location
  • obj4_desc : Find Creep's front door key. That's my way out when done.

By default they are all incomplete, visible, mandatory, and reversible (so UNdoing an objective will UNcheck it.)

Objectives 1 and 3 will work automatically.

For Objective 4 you need to create a brush at the exit location and give it the texture common/clip. Then assign to it the entity info_tdm_objective_location. Give it a suitable name like exitLocation and that name must be used in the objective property. When testing, experiment with the best position for the brush so it triggers timed for the best effect.

Strictly speaking, Objective 4 should only be completed if 1, 2, and 3 are done first but I can't see an easy way to do this at the moment so for now it can be left as a location example and because it is by default, reversible, if the player goes there early then the objective will check off but the mission will not complete and the player has to return (when that objective will UNcheck.) Not ideal but simple (in the released Thief's Den I used a system too complicated for this beginner's tutorial.)

An info_tdm_objective_location entity might also be used for Objective 2 but at the time of writing we found this too imprecise for something as small as dropping a message in a chest so for this we shall use a stim response (see next section.)

First we create a target_tdm_setobjectivestate entity. Place it somewhere you can find it such as near your target_tdm_addobjectives. Give it a name such as SetObjective2Complete. This objective can now be completed by any trigger that targets this entity and as said, we shall use a stim response in the next section. Add these properties to it...

  • obj_id1 2 [defines Objective 2]
  • obj_state 1 [defines the required state of the objective after triggering as complete]
  • wait_for_trigger 1 [makes the entity wait for a trigger]

Using S & R in the next section is fairly advanced so skip it if you like and maybe omit Objective 2 or even think up your own to replace it?

For more on objectives see Objectives

Stims and Responses

Stims and responses are used to trigger events when one entity comes into the vicinity of another, for example a water arrow in the vicinity of a flaming torch will trigger it to be extinguished. A stim provides a named stimulus with various properties on an entity and a response of the same name on another entity will be triggered if it comes within range of the stim, producing various effects. You can have multiple responses to the same or other stims on the same entity. Dark Mod S & R are very advanced so we shall just describe one example here to complete the objective where the player has to drop an incriminating message into a chest.

Although stim and response properties can be added directly in the entity inspector there is an excellent s & r editor built into Dark Radiant which we shall use.

Before you begin this you should have created a target_tdm_setobjectivestate entity named SetObjective2Complete (see the previous section on objectives.)

  • Create a small brush of about 4 x 4 x 4 and place it inside one of the chests at approximately the centre of the positions the message will be when dropped in.
  • Give it the texture common/nodraw
  • Give it the entity func_static
  • menu > entity > stim/response
  • Select the tab Custom Stim
  • Click the button 'add stim type' to create a new custom stim with the default name CustomStimType
  • In the Name box change its name to IncriminateStim
  • Select the Stims tab
  • Click the downward pointer in the Type box and all available stims will show.
  • Select IncriminateStim
  • Check the checkbox at the left of the Radius input.
  • Enter 5.0 as the radius
  • The other fields can be left blank - the 'Active' checkbox should already be checked.
  • Click OK.

Clone that brush and drag it into any other chests you have made so the message can be dropped in any of them.

Now we add the response to the message entity...

  • Select Creep's message - the one you created under the readables section.
  • menu > entity > stim/response
  • Select the Responses tab.
  • Click the downward pointer in the Type box and all available stims will show.
  • Select IncriminateStim
  • With IncriminateStim highlighted, double click in the big window on the right headed Response Effects.
  • In the popup menu select the downward pointer in the Effect field.
  • Select Trigger.
  • Select the downward pointer in the Target field and select SetObjective2Complete (or type or paste it in.)
  • The Activator field should be left blank and the Active checkbox should be checked.
  • Click the Apply button and the response effect should appear in the Response Effects list. Double click it if you need to edit it.
  • Click OK

The objective will be set if the response on the message (origin point) comes within the radius of the stim in one of the chests but if the player then takes away the message the objective will remain checked. This does not make sense in the story so to prevent the player taking away the message we make it unfrobbable after dropping...

  • Make sure Creep's message is still selected.
  • menu > entity > stim/response
  • Select the Responses tab.
  • Click to highlight the IncriminateStim
  • Double click in the big window on the right headed Response Effects.
  • In the popup menu select the downward pointer in the Effect field.
  • Select Set Frobable
  • Select the downward pointer in the Target field and select CreepsMessage (or type or paste it in.)
  • The Activator field should be left blank and the Active checkbox should be checked.
  • Click the Apply button and the response effect should appear in the Response Effects list.
  • Click OK

We have created two response effects to the incrimate stim that is in any of the chests - one to set the objective complete and the other to stop the player removing the message again. You will need to test and adjust the best position of the stim brush in the chests.

This is just one simple example but you can see the possibilities and flexibility of s & r for many other tasks in your missions. For more on s & r see Stim/Response

Testing Your Mission

  • You need to keep test playing your own mission as you develop it.
  • Keep a notebook or scrap paper or make notes as you test play of things that want correcting or new ideas that come to you. Otherwise you are likely to overlook things. When you have corrected things in the editor mark the notes to check they work as expected.
  • Don't be discouraged even if you finish up with piles of paper. That is normal. Just work through and cross them off one by one as you fix them.
  • When you feel your mission is complete you still need to test play thoroughly as if you were actually playing. Try playing in different styles not just how you normally play.
  • Finally, you need a few other players to beta test for you before you release the mission to the general public. It is likely they may find a host of new problems. Again, don't be discouraged. Work through them one by one and beta test again.
  • At last you should be ready to reveal your work to the world!

Zipping up

Your final mission and any custom resources it uses must now be zipped up and uploaded for others to play. For details of how to do this see How to pack your mission (PK4 creation)

Your own Build Design

link to build design wiki

Additional Recommended Information

All mission developers ought to read and know the following...

Performance: Essential Must-Knows

"Teach Yourself Dark Mod In One Day!" by Fidcal

Page 1 | Page 2 | Page 3 | Page 4 | Page 5 | Page 6 | Index