A - Z Beginner Full Guide Page 5

From The DarkMod Wiki
Revision as of 12:56, 11 August 2009 by Fidcal (talk | contribs) (→‎Keys)
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


Windows

Adding windows to rooms will really help them towards looking authentic. Windows can be models or textures; openable (like doors) or mere architecture. Older medieval gothic type windows might be mere shaped slits in the stone. There are many facets to making windows which cannot all be covered in this beginners' tutorial. A few points to remember...

  • If the player can go to both sides of a wall then make sure there is a window on both sides and aligned.
  • Consider if you use outdoor 'lit' windows, can the player extinguish the light inside then go back outside and see the window still lit?
  • Consider the frame.
  • Consider having a windowsill.
  • Perhaps a support beam or stone is needed over the top of the window?
  • Does the window need to be recessed into the wall?

In this old house we shall put a few simple recesses with window texture...

  • On the west wall of the big room, between the middle vertical beam and the south wall, create a niche 80 wide by 112 high using the same technique as for the yard wall torch niche. Try to get it between courses of stonework (though this irregular stone makes that tough so don't worry.)
  • Texture the back of it with textures/darkmod/window/largesquare02_dark
  • Scale it Horiz 0.15 and Vert 0.2
  • Shift the texture so the frame is equally half on one side and half on the other.
  • Check the texture and alignment of the sides of the niche align with the rest of the stone wall.


  • In the same way create TWO windows 56 wide by 80 high in the small room - one about the middle of the west wall and the other on the south wall and to the east.
  • Position and rotate Creep so he appears to be standing looking out of the south facing window but stand him a little to one side. Place the thugs path_corner at his side. With a bit of tweaking later it might suggest the thug is coming and standing there looking out the window with Creep for a few seconds. We are trying to create opportunities for the player to sneak in!

Outside you cannot put a window on the west wall of the yard else it would show indoors which would need more thought. We might consider an openable window - another avenue for the thief to get in? Ideally we'd have a window or two to the yard but let's leave it for now and press on...

Fires and Fireplaces

Let's put a fire and a fireplace in the kitchen - sorry, 'small room' - I'm already visualizing it as being used as a kitchen...

  • Create a model : darkmod/fireplace/fireplace_stone.ase in the south west corner of the small room.
  • Create a model : darkmod/fireplace/grate.lwo and place it in the fireplace
  • Create a model : darkmod/fireplace/burntwood.lwo and place it on the grate
  • Create an entity : light_extinguishable_moving and place it within the top two thirds of the logs
  • To the light add properties...
  1. _color : 0.50 0.38 0.31
  2. light_radius : 180 180 120
  3. model_lit : tdm_fire_flames.prt
  4. model_extinguished : tdm_smoke_torchout.prt
  5. snd_lit : element_fire_fireplace
  6. snd_extinguished : machine_steam01
  7. texture : lights/fire_fireplace

Save and map and check it out. You might want to adjust the position of the fire or logs.

Chests and other Containers

Container are effectively an open box with a lid functioning like a door. You can make a custom one out of brushes but here we shall uses existing models. There are some ready-to-go prefabs that can be loaded via the file menu but I'll describe here how to make up your own so you know...

  • Create three models : darkmod > containers > openable > chest1, 2, or 3 and their respective lids.
  • Place one chest in the little room against a wall.
  • Position its lid exactly on top with the hinges at the back
  • With the lid selected, in Entity Inspector, select the top line - class name
  • Change this from func_static to atdm:mover_door
  • Add a property (or change its inherited property) rotate (NOT rotation but rotate) with the value 0 0 -120. The -120 is the angle it will open; -120 looks about right to me. (note when I made a brush cashbox I found the necessary angle was positive.)

Likewise put the other two chests in the big room. One or both them may eventually go upstairs or in the basement when finished.

Alternatively, chests, footlockers, safes, any container, can be made out of brushes and likewise the lid too. Yes you can add atdm:mover_door to it! See also Doors for details.

Locking the chest will be dealt with later under #Locks, Keys, and Lockpicking.


Putting Items into Chests

Putting an item into a chest is literally that - just position any item(s) in the chest. I suggest some other dummy items to pack it out rather than a single loose gold ring! Try a patch shaped like some blankets or junk with an appropriate texture. For now we shall just put single items in and this we shall deal with later under #Loot!

As created, loot can be frobbed right through the wall of a locked chest. Apart from clever tricks like teleporting there are two basic but incompatible methods of solving this problem...

  • Make the chest itself frobbable. This tends to block frobbing through it.
    • Add the property and value to the chest : frobable 1
    • Add the property and value to the chest : frob_peer <lid name>

Alternatively...

  • Make a frob controlled zone. This removes frobability from entities within the zone when the lid is closed.
    • Create a brush and size/place it within the chest to cover the volume where the loot will go. There is some overlap so it should be well below the lid. If you find the lid won't highlight anymore then lower this brush. Don't go too near the walls of the chest or nearby or dropped objects may lose their frobability when the chest is closed.
    • Add the texture common > clip to the entire brush.
    • Assign to the brush the entity Targets > target_set_frobable
    • Give this entity a suitable name such as FrobZone01
    • Add the property and value to the entity start_frobable 0
  • Add to the lid the properties and values...
    • target FrobZone01 (name of entity)
    • trigger_on_open 1
    • trigger_on_close 1
    • immune_to_target_setfrobable 1

If you have made the chest body frobable then also add immune_to_target_setfrobable 1 to that as well.

Extra note: The above work but there is a problem when the player is trying to unlock or pick if the frob is on the wrong one. A new method uses atdm:froblock on the chest with various spawnargs. I recommend in your real FMs that you insert one of the container prefabs and use it as is or examine its properties to see how to set it up.

Locks, Keys, and Lockpicking

Locking a Door, Chest, etc.

To lock a door, chest, etc. that is using the standard Dark Mod entity atdm:mover_door, just set the property locked to 1. The default is 0 which is unlocked.

Keys

Any object can be made to function as a key with the right properties. Here we use predefined key entities with normal key models...

  • Create entity > darkmod > Keys > atdm:key_ornate
  • Place it on the table somewhere for now. You can rotate it to lie flat (modify menu)
  • Optionally change its name (NOT class name) to say, key_chest3. You can change the name of any entity you create. For most there is no need but here is an example where in a big mission you might have a lot of keys, and they are small after all. By naming them Key_something they will all appear together in the alphabetical enitity list (keyboard L) so you can quickly find what you want. I recommend starting with a capital letter. The list is sorted in ASCII order which means capitals list first so your specials are at the top of the list. The list selects the entity for you in the grid and camera views in Dark Radiant and centres them to zoom in. Neat eh? (keys in inventories are not visible though.)
  • Optionally change the name that shows in the player's inventory when the key is selected by changing the value of the property inv_name
  • You can also add comments to any entity if you wish so you might have 'Gate guard's key to be added to his belt' or something. See Comments for details


To set a specific door, chest lid, etc. to be opened by a particular key, add the following property to the door...

used_by <key name>

You can assign the same key to many different doors by adding used_by to each of the doors. On bigger missions you might create a master key just for testing. Name it key_master and it will work on all locks. Put it in the player's inventory using the property inv_map_start 1. Such a key is provided in the startpack. Remember to set inv_map_start to 0 or delete the master key when you pass your mission to beta testers and the public so they don't get the master key.

You can also assign many keys to open the same door, chest, etc:

"used_by"   "doorkey_1"
"used_by_1" "doorkey_2"

Lockpicking

The basics of setting up lockpicking on a door or chest lid etc is fairly simple but there are enough complications if you add a lockbox, lock bar (that flickers while lockpicking to indicate progress) separate handle etc. that I will not include these in this beginner's guide. Instead I will just refer you to Doors#Lockpicks

You may find in the future that prefabs are available with doors, chests, already set up with default lockpicking so you need only adjust the values to suit your mission.

Giving the Player Lockpicks

To create the lockpicks for the above...

  • Create entity atdm:playertools_lockpick_bent and put it on the table for now near the key.
  • Do the same with atdm:playertools_lockpick_circle
  • Add the property inv_map_start with a value of 1 to each of them which will put them in the player's inventory at mission start. (should disappear from the table eventually.) We covered inventory previously in Tools, Weapons, Equipment

That's it. You'll need to dmap to try this out because of the brush handle we made. See the Doors wiki for general information all about doors.

Managing your Mission Files

So far we have only been saving your map file. You will see in the darkmod folder there are materials, and textures, and models, etc. subfolders. It is possible to produce a respectable mission without any other files except the Dark Mod resources. But even if you do not create any custom textures or models for your game, few missions will not need readable texts in the game. While it is possible to include this text right in your map as properties of the readable, that makes it more difficult for later translations into other languages. So this is a good time to discuss where to store any other files.

Placing materials files into the materials folder and textures directly into the textures folder works but makes it difficult to sort them out for zipping up your mission for publication. A better way to organize them is to create your own subfolder within each of those folders (if needed) and put them in there. However, you still need to sort them out later - it's just easier.

An alternative, which keeps all your own files together as a single project can be considered...

  • Move your Doom 'savegames' folder from the base folder to a backup folder or delete it if you don't want them.
  • Move the 'game' folder from the base/maps folder to the backup folder too.
  • Leave all the other Doom files alone but the maps folder and any other folders you place in here are YOURS exclusively.

So, you could create a textures folder, a materials folder, etc, all in the base folder. And your mission map can go in the base/maps folder. When it comes time to zip up for publishing you just zip up the folders only. Job done.

Not quite. As you develop your mission it is essential that you regularly save with a new version map name (as well as your more frequent normal saves with the same name of course) so you have at least the last dozen or so if not the last hundred versions for reference. If you spend months or years on a mission and some dreadful error occurs then sometimes the only solution is to go back to an earlier save. You might have name300.map, name301.map and so on. So your options are:

  • Save all the previous saves in the base/maps folder but move them out while zipping up leaving only the last one.
  • Keep your development maps in the eg, darkmod/maps/mymaps folder and copy the last one to the base/maps folder only when read to zip. (my recommendation)
  • Either way you can still keep any textures, models, etc. in their appropriate subfolders in the base folder all together.

You might also have multiple missions being developed at the same time - some might be just tests. You can solve this by having subfolders within the other folders - whether in the darkmod or the base folder. You might even have a 'shared' folder I guess.

One other method I have been using for developing multiple projects is to have several base folders named eg, baseMissionXname, baseSomethingElse, with only the current one you are working on named as base. To switch between them you need to exit Dark Mod and Dark Radiant first and just rename base to a suitable name, eg, baseThiefsDen, then rename the one you want to work to just base. Note that every folder has to have all the Doom files but with low priced disk storage I think this is a small trade off.

Give it some thought. For a simple mission it might not be worth worrying about.

Readables: Books & Scrolls

By 'Readables' might mean either static books, scrolls, etc, whether open or closed, or functioning such that can actually be read in-game...


Static Book & Scrolls for Decoration

Creating a static, non-functioning readable is fairly straightforward - just create the model of your choice (see models > darkmod > readables) and place it nicely to decorate a shelf or library in your mission. There are open and closed books as well as shelves and rows of books. Also look under models > furniture > shelves where there are some book shelves with books. At the time of writing I can't see any book textures but it is worth checking to see if any are added later or even make your own. You could then texture a brush bookshelf or even make a reasonable custom book out of brushes and/or patches.

Readable Books & Scrolls

You can see a choice of readable types under darkmod\Readables in the "Create Entity" dialog in DarkRadiant.

In our mission we are going to create the incriminating message from Creep that the player will have in his/her inventory at mission start, ready to place in Creep's hideout.

For our present use we want a carryable (mobile) note, not a book - and a scroll might be too grand - so we use the simple note type...

  • Create entity darkmod > readables > atdm:readable_mobile_paper01
  • Place it on the table for now.
  • Add the property xdata_contents with the value : creeps_message. This is the name defined in the text file we are going to make and identifies each text.
  • Add the property inv_name with the value : Creep's Message. This is the name that will show in the player's inventory.
  • Add the property inv_map_start with a value of 1 so the message will be in the player's inventory at the start.

Now we define the text of the message itself...

Creating Text for Books and Scrolls

In Dark Mod, multiple in-game texts can be stored in one file in xdata format. For details see Readables but here is the simplest description for our tutorial mission and this is all you need for now...

  • If you are maintaining your mission project in the base folder as described previously in #Managing your Mission Files then create a subfolder in the base folder named xdata.
  • Copy and paste the following into a plain text editor
  • The xd file can be any name with the .xd suffix but the final mission name makes sense so...
  • Save it as thiefsden.xd in the xdata folder just made or otherwise put it in the darkmod/xdata folder.
  • You need to be aware where all your mission files are so nothing gets missed when you zip up for publishing.
creeps_message
{
  precache

 "gui_page1"   : "guis/readables/oldparchment.gui"
 "page1_title" : ""
 "page1_body"  : 
 "I have real good information about Frothbody's sceptor" \
 " - I can be trusted on that. " \
 "Must be some rogue who can do this heist for me.\n\n" \

 "If not interested I'll do it myself so make up your mind quick.\n\n" \

 "                  ~ Sebastien Creep" 
}


Explanation...

  • Multiple texts for different messages and books can be defined in this one file.
  • Each definition consists of a definition name then the details within curly brackets as follows...

creeps_message
{
details in between.
}


text2name
{
details in between. (can be many pages in-game)
}


text3name
{
details
}

...and so on.

  • precache - this means Dark Mod will load it at mission start. Otherwise it will load as the player starts to read it causing a slight lag as it loads off the disk.
  • "gui_page1"  : "guis/readables/oldparchment.gui" - the graphical image of the background scroll, book, etc.
  • "page1_title" : "" - Text in this is shown as a large header suitable for posters, notices, etc. (around 10 or 12 characters only.) We left it blank in this message as it is just a scrawled note.
  • "page1_body" - this is the actual text where...
  1. text is in quotation marks
  2. \ at the end of a line after the quotation mark means the next line is to be added to this line and wordwrapped. Make sure you do not have one of these at the end of the last line - a common mistake which will cause an error.
  3. \n within the quotes means start a new line. So \n\n means leave a line gap between paragraphs.

And yes, you can add graphics in .tga format.

For full detals of readables and how you can even make your own readable books out of brushes, see Readables

In-Game Mission Maps

At time of writing multiple maps and automaps are still being considered so search the wiki if you want. However, single page maps can be made fairly easily as follows...

  • Dark Mod in-game maps are image files working in a similar way to readables text over a background parchment etc. and appear in the inventory.
  • Various files are needed:
  1. An image file of the foreground details of your map in tga format
  2. An image file of the background (eg, parchment.) Several are provided in the Dark Mod resources or you can make your own. Your detail and background images might be combined but it is convenient to manage them separately.
  3. A material file - plain text that defines the blending.
  4. A gui file - plain text that defines the images and how they are used.
  5. An inventory icon such as a small version of the map.

Details Map

This is how to make the details map....

  • You need to draw your map in a paint program else on paper and scan it in - so the results depend entirely on your skills in that area.
  • The map should be of a size that fits comfortably into one of the Dark Mod backgrounds in the guis\assets\readables folder or you can make your own background.
  • The map should be foreground detail only (map, text, etc.) on a white background (which will be blended into the background in-game.)
  • Gimp is an excellent free paint program.
  • If you have no artistic skill then either you cannot have a map or you might ask someone else.
  • It does not need to be a great work of art necessarily and likely it's meant to be a map scrawled by some low-life game character anyway!
  • If you are not artistic but have moderate paint program image processing skills you might grab a screen from Dark Radiant with entities filtered out as a start then process that in the paint program (which is what I did.)
  • For this tutorial you can save the following and convert it from jpg to tga format if you have a program to do that. Save it as thiefsdenmap.tga in guis\assets\maps (might need to create that folder) in the darkmod folder (or base if you are keeping your mission files together there.)

Inventory Icon

You will also need an icon image file for the inventory...

  • In your paint program...
  • Darken/Thicken the detail of the detail map somewhat or it may be barely visible in the icon (not the white background!)
  • Place your darkened details map over the background parchment image and combine them
  • Reduce it to about 256 x 170 and save it as thiefsdenmap_icon.tga in guis\assets\hud\inventory_icons
  • For this tutorial you can save the following and convert it from jpg to tga format if you have a program to do that. Save it as thiefsdenmap_icon.tga in guis\assets\hud\inventory_icons in the darkmod folder (or base if you are keeping your mission files together there.)
File:Thiefsdenmap icon.jpg

Materials Definitions File

Materials definitions files are used to define the properties of all materials in Dark Mod including textures and collisions sounds etc. It is normal to include multiple definitions of a type in one file or all custom ones for an entire mission might be saved in one definition file for convenience. So, now we define the material file to enable the details map to blend....

  • Copy and paste the following in a plain text editor
  • Save it as thiefsden.mtr in the materials folder
  • If you create any other textures then their materials definitions can be added to this same file but this tutorial will not cover custom textures...
// blends in-game map details onto background parchment
thiefsdenmap
{
  {
     blend filter
     map guis/assets/maps/thiefsdenmap
  }
}

Gui File

Next we need the gui file...

  • Copy and paste the following in a plain text editor
  • Save it as thiefsden.gui in the guis folder...
windowDef Desktop{
   rect      0, 0, 640, 480
   nocursor 1

  windowDef background_map {
     rect      0, -10, 640, 480
     background "guis/assets/readables/oldparchment_landscape"
     visible 1

     windowDef actual_map {
     rect      70, 70, 500, 340
     background "thiefsdenmap"
     visible 1
     }
   }
}

Adding the Map to our Mission

Now we have our files created we can continue in Dark Radiant...

  • Create entity > darkmod > atdm:map_base
  • Place it on the table (just so you know where it is)
  • Give it a name, eg, SamsMap (to identify it in the editor - Sam being the assumed character who gave it the player character)
  • Add the property gui with the value : guis/thiefsdenmap.gui
  • Add the property inv_icon with value : guis/assets/hud/inventory_icons/thiefsdenmap_icon.tga
  • Add the property inv_name with value : Sam's Map (this will show in the inventory to the player)
  • Add the property inv_map_start with value 1 so it is in the player's inventory at mission start.

Save and map the mission in Dark Mod and the map should be in your inventory.

Adding an Upstairs Room

let's build some more to add interest to our mission and demonstrate climbable surfaces such as ladders...

  • Clone a wall from the small room as our upstairs room doesn't want to be too high.
  • Drag it 16 units above the big room and extend it out to the inner surfaces of that room on the north, west, and south sides but only 352 in length east to west so it is smaller than the big room and doesn't jut out anywhere near the yard.
  • Use the room, go inside and check the walls are the same stone as downstairs, the ceiling is plaster and the floor can be boards.
  • Note there is a wall jutting up at south east clipping through the south wall of our upstairs room so use the Clipper tool to cut it away. To do this...
  1. Remember you cannot cut out a piece to leave an L shaped brush; they must be convex.
  2. Select that wall and using clipper (X key) click on it left and right between floors and use Shift + Enter to split it in two.
  3. Select the part that is clipping into our new upstairs wall and using clipper clip it away using Enter.

Check the main ambient light. I found it needed resizing to cover the upstairs room. Just make sure the centre of the light is not in the void.

Now we'll just create a simple opening in the floor to downstairs...

  • Move down to the big room below
  • Use the clone and curtain method described earlier to split the ceiling up to leave a gap 64 x 64 units in the ceiling in the south west corner of the big room but 32 units from the west something like this...



  • Repeat in the floor of the upstairs room exactly above it.
  • You should now have an opening between downstairs and upstairs.
  • You might have a gap(s?) but just fill in with small solid brushes
  • Check the texturing makes sense. Stone on the wall, wood against the floorboards, plaster below.
  • You should have something like this...



Throw in a few bits of static model furniture for poor old Creep. I lay down three sacks and stuck a mattress over it. A shelf unit and a static model crate at the side of his mattress. I put an entity atdm:moveable_candle1 on that and an entity light_candleflame_moving at the top of the wick. Then on the candleflame add the property bind with the name of the candle so if picked up the flame will go with the player! Remember to adjust the light radius.

Now we need to get the player up there....

Climbable Surfaces: Ladders, Drainpipes, Vines

In Dark Mod a climbable invisible textured brush can be placed over a visible model or other surface that you want the player to climb. Full details at Climbables, Ladders, etc.. For our mission we...

  • Create a model : darkmod/architecture/ladders/ladder_16steps.ase
  • Place it against the stone wall left of midway through our hatch so it's not far too step off at the top. You probably need to reduce grid size to get it close to the wall.
  • The ladder itself is just a visual - it cannot be climbed.
  • Make a brush XYZ = 24 x 4 x 256 (it does not need to cover right to the top of the ladder) and place it around the ladder
  • Give it the texture common > ladder

That's it! Save, dmap, map, and you can try it out. The player must be able to step off the ladder top and bottom without having to jump and be forced to break stealth. So experiment with the ladder brush position - maybe make it a little bigger than the ladder if you want.

Switches, Buttons, & Triggers

In Dark Mod, the entity atdm:mover_button can be linked using the 'target' property to switchable items like electric lights to turn them on and off. Use it like this...

  • Create model darkmod/lights/non-extinguishable/wallight_outdoor3.lwo and place it outside over the yard door.
  • Create a light radius about 180 200 200 and brightness about 35 and centre it just at the bottom of the wall light. Give it a name, eg, yardLight.
  • Create model darkmod/mechanical/numberwheel_button.lwo or whatever switch available that looks suitable as an outdoor light switch.
  • Change its class name from func_static to atdm:mover_button
  • Place this on the wall outside the door - ideally create a tiny niche to keep it out of the rain.
  • Add the propert target yardLight

It should now work to switch the light on and off.


Adding a Basement

This is the final room in our tutorial mission. We are almost there! Adding a basement is a similar exercise to creating the upstairs...

  • Create the room below the small room and exactly the same size and texture.
  • Create the connecting gap between the floors like we did for the upstairs but in the north west corner of the small room. It should be 56 x 56
  • Check texture etc and check for gaps! Remember pointfile if dmap shows a leak!(For details on fixing leaks & pointfile see Leaking maps and Performance: Essential Must-Knows#Build Airtight. Seal out the Void. Avoid Leaks)
  • Make sure the main ambient light radius reaches down to the basement or put another ambient down there.
  • You can throw in a crate or two but we'll rethink decoration later.

Meanwhile how to get the player down there - and back...

Elevators

Sophisticated multi-floor elevators are now possible with Dark Mod (see Elevators, multi-floor) and it is recommended that you use that tutorial for your own missions. But in this beginners' tutorial we shall improvise a very simple, one floor, platform elevator using the sliding door entity...

  • We need a recess for the lift to descend into ideally so the floor surface of the lift fits flush with the floor in the basement. Skip this if you feel lazy...
  1. The recess is just like making a tiny room 56 x 56 and maybe 40 units deep
  2. Make the gap for the recess in the basement floor
  • Create a brush 8 units high that exactly fits the gap 56 x 56
  • Position it flush with the floor in the small room in the gap.
  • Give it the texture darkmod/metal/detailed/rusty_diamond_pattern
  • Ideally it should have supporting struts underneath, motor etc. (if these are assigned to the same entity as the main lift platform they move in sync with it) as well as a track up the wall. Improvise and experiment later if you wish or just leave it as a metal platform.

That's the visible build and now to get it working...

  • Select the platform (and all extra parts, struts, etc if you made any) then RMB grid menu > Create Entity > darkmod > atdm:mover_door_sliding
  • Optionally give it a name like CellarLift.
  • Add/set these properties...
  1. frobable 0 (stops it being frobbed directly like a typical door)
  2. translate 0 0 -132 (distance and direction it has to travel)
  3. translate_speed 12 (units per second)

Finally we need two simple buttons. Make one and clone it...

  • The button can be the darkmod/mechanical/numberwheel_button.lwo (small, not easy to see in the gloom) or make one from a small square brush with a suitable texture. It is likely you will find more button models.
  • Change func_static to atdm:mover_button.
  • Add the property target with value of CellarLift (or whatever name it has)
  • Clone the button
  • Place one on the ground floor near the lift and one down in the basement

Save, dmap and map and try it out!


More info on elevators at Platform That Moves When Button Is Pressed and at How to make a Three Stage Elevator

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

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