A - Z Beginner Full Guide Page 4

From The DarkMod Wiki
Revision as of 10:42, 10 February 2008 by Fidcal (talk | contribs) (→‎Weapons)
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


Dark Radiant Filters

If the rain/snow brushes get in the way you can filter them out with Hide but it gets a bit repetitive so you can define a Dark Radiant filter...

	<filter name="Weather">
		<filterCriterion 
			type="texture" 
			match="textures/darkmod/weather/.*"
			action="hide" />
	</filter>

First close Dark Radiant then insert the above in between two other filters in G:\DarkRadiant\games\doom3.game using a plain text editor. I recommend you back up the original first in case of errors.

Next time you open Dark Radiant the new filter will be in the Filters menu under 'Weather'.

More details in Defining custom Filters in DarkRadiant


Proper Lighting

We put in temporary lights for quickness. Now we must consider how we are really going to light the mission. Some game developers make an entire mission and do this last; some do it as they go along at every stage; I mostly do it section by section and this mini-mission so far is what I call a 'small section'.

Most visible lighting objects in-game like gaslights and lanterns have no light of their own; we simply use the type of lights we have already used placed next to them (some entities exist that are both lights and are visible such as flames.) Generally avoid putting in these lights without a physical light object because apart from testing it makes little sense in game to just have a place lit without reason. Exceptions are ambient and selective highlighting where it might be supposed some light falls, extending the reach of a visible light. Use your judgement, does it look alright?

Begin by deleting all the lights we put in so far EXCEPT for the

  • main ambient light
  • the ambient light in the pool
  • If you wish you can disable the fog without removing by adding an X to fogs/delta1_fog so... fogs/delta1_fogX or just delete them.

Lighting Objects

There is a wide variety of lighting objects in Dark Mod. Scroll down to static model lights in the "Create Model" dialog and functioning lights like candle flames in Create Entity in DarkRadiant and feel free to use different types here. But remember, this must be a playable game, however short so we may well be relying on lights that the player can extinguish with water arrows in certain places. Also consider atmosphere, placement and brightness: the player is likely to come in over the yard wall, open the door, explore the downstairs rooms and later we may add an upstairs to demonstrate ladders, elevators, and stairs, all the while avoiding the enemy. So plenty of shadows to hide in! And of course, if you leave it raining then don't leave extinguishable torches uncovered! We'll use niches in the wall. You can use a non-extinguishable; maybe there is a lantern or even a street lamp type suitable but remember the player must have an opportunity to not be seen!

We don't want the player to start right next to the door then go right in. Let's assume the mission will start at the south end of the yard - leave that area in shadow. Except for special cases, don't normally start a mission with the player exposed; he/she will want a few seconds to get their bearings and admire your mission!

A Wall Torch

Let's add a wall torch to the first little room we did. These will be static visible models in the models list but have separate functioning flickering flames and those will be in the entity list...

  • RMB menu > create model > darkmod/lights/extinguishable\torch_metal_wall from the model selector and place it flush against the east wall in the middle and maybe a little above the height of the player start box. You may need to rotate it so its bracket is against the wall. This would set fire to a beam above so let's move some aside from the middle to make space. Make sure you have grid size 8 set. There was an excess gap on one side of the room so move some beams 8 units in that direction and this leaves a 24 unit gap roughly in the middle. Line up your torch below that.
  • You will probably need to reduce the grid size for fine positioning of models.
  • RMB in Entity Inspector; add to its properties noshadows with a value of 1. This stops the torch itself casting a huge moving shadow which is unnatural.
  • RMB menu > create entity > light sources > light_torchflame_moving. This is extinguishable. Do NOT use 'light_extinguishable_moving' which has no visible flame.
  • Place the flame exactly over the walltorch and about 7.50 units above it. It should sit like an ice cream in a cone roughly. You will need to see it in-game to make sure it looks correct. Use all views to make sure it is aligned in all directions (you only need do this once then we can clone them both together for other torches.) Do NOT rotate a flame; we might need to adjust its vertex origin which is its light source and this can give odd effects if rotated.
  • Press V for drag vertices mode or press on TBB and move the flames vertex out about 8 or 10 units to the front of the flame. The light is cast from this single point so it helps to cast light sideways naturally from the front of the flame. This is why you should not rotate the flame as the vertex will not show with the same rotation in Dark Radiant. When you come to rotate torch/flame combos in the future to place on different walls, select the torch separately if you have moved the flame vertex (or adjust it all after!)
  • Press V to DEselect drag vertices.
  • With the flame selected, in the Entity Inspector check the 'show inherited properties'
  • Select the _colour property. This is set to an orangey light but is slightly bright for our small room. Reduce its brightness VALUE to say 80 or 85.

Radius of Lights Close to Walls

  • Now we come to light radius. Adjust this by typing in the values in the light_radius property in the Entity Inspector so that the light centre does not move (as it would if you tried to drag.) For wall lights, the light radius must not extend much beyond the far walls. The reason is that the light will fade to zero beyond those walls which means those walls will be proportionally brighter (as they catch the light well within the brightness rather than near the end of the fade). Because the wall on which the torch is mounted receives light at a very shallow angle and it fades rapidly to zero along it then it will look much too dark if the other walls are very bright. In the worst cases it can look almost black by comparison. Try it out and you will see what I mean. If you then reduce the radius so it only extends beyond the far walls by 10 or 20 units then it will look much more natural. Place other lights if you need to add more light on those side. You will have to experiment in each individual situation. In this particular case the torch is not quite central so will extend about 30 or 40 units on one side and maybe 10 on the other. Similarly set the height radius so it just extends beyond floor and ceiling. Too much and you will have a super bright ceiling compared to the torch wall.

Save the mission and clone both torch and flame and move to the north wall of the big room between the central vertical beam and the west wall. You don't want to illuminate the player character as he/she sneaks in the door.

  • You will need to rotate so remember to keep the flame vertex (light source) sticking out at the front of the flame. If the flame is rotated it will not show the vertex in the right position so if rotated, delete any rotation property from the flame and adjust the vertex in the grid view.
  • Adjust the light radius so it just protrudes beyond the south wall. The west wall I found could be extended 75 or 100 units without spoiling the torch wall and this means it exends equally to the east a realistic amount.

Candles

I don't think either of those rooms needs any more large lights but a candle or two carefully placed might look good...

  • RMB menu in grid view > Create Entity > darkmod > atdm:moveable_candle1 or 2. Place it on a table or shelf etc.
  • RMB menu in grid view > Create Entity > darkmod > light_candleflame_moving. Place its centre at the tip of the candle's wick.
  • To the flame, add the property bind and the value will be the name of the candlestick. Get this by selecting the candlestick, highlight the 'name' property (NOT the classname but the next line down) and the copy the name from the input box at the bottom of Entity Inspector. Reselect the flame and paste this in as the value for the bind property you added. This will attach the flame to the candle so if the player picks it up then the flame won't stay behind! (note that bind does not move the flame at mission start so you must position the flame at the wick in the editor.)

Now we can add a torch or two in the yard. But it may be raining! If so, here's a way to make some wall niches...

A Niche : CSG Subtract, Another Cutting Tool

This is another way to cut out a section of a brush (or rather split the brush up to simulate rather like hollow and room) using CSG subtract. Be cautious with this as it might not always work the way you expected. It involves using a small brush as a guide for which piece to 'cut out' of another brush...

  • Grid Size 8
  • Select any yard wall where you would like a torch niche
  • We made these walls 8 units deep which is not deep enough for a torch niche so deepen it to 16.
  • Clone it (just a convenient way of making a block that is already aligned.)
  • reduce it to a small block by resizing its height to 68 (fits between courses of bricks) and 16 wide (along the wall Y direction.) Leave it the depth of the wall.
  • Position it midway up the wall so it fits between courses of bricks not cutting into bricks vertically. Adjust its height if necessary to do this. Sideways it's obviously not possible to avoid half bricks but that's true in the real world.
  • Position it anywhere on the wall but not too near the south end of the yard where the player starts.
  • On the Brush menu select CSG > CSG Subtract. Nothing might seem to have happened but this will have split the wall up into smaller brushes surrounding the small clone and deletes the part of the wall where the clone is still selected.
  • If you were to delete the clone now there would be a hole right through the wall. Instead push it back into the wall the whole depth of the wall so it can form the back of a niche. We might have deepened the wall and neatly trimmed this back piece but it isn't worth it. Let it stick out the back into the void. Don't leave a gap of course!
  • Check the texture inside the niche. CSG Subtract cleverly uses the right texture but is the scale, etc. OK? Adjust if necessary so it all lines up.

You might also consider a supporting stone across the top of the niche if you were doing a 'real' mission but we must press on....

  • Clone a torch and flame together and drag them low in the niche with a generous gap above the flame.
  • Select the flame, V for drag vertex, and move the vertex (light source) in to the centre of the flame I found best. V to DEselect vertex mode!
  • I increased the brightness to the max 100 and extended the radius to about 250. Always try to make the radius value a cube generally so here depth and width I set to 250. But the height I reduced to 90 as it looked too bright on the ground.

Looks good to me; how was yours?

Save with a new name, dmap, map to take a look. Make one or two more if you wish but don't make the yard too bright! Take one more look around in-game to check out the lighting. Atmospheric? Too difficult for the player to get by? Maybe we should look at arming the player character with a few tools and weapons, especially something to help put out those lights!...

Tools, Weapons, Equipment

Inventory

To add an item to the player's or any AI game character's inventory at mission start it can be included in the player's equipment shop as 'starting gear (see later) or it can be added this way...

  • Create the item in the map. It can be placed anywhere (except in the void) but will not be visible in the editor once it is assigned to the inventory. In fact it will not even exist in the map technically. However, it will always have its original coordinates and will re-appear there if removed from the inventory in the editor. So you might consider...
  1. Create a 'blue' room (a room not accessible by the player) and store all items intended for the inventory in there (purely for management purposes)
  2. Just place each item in any place that makes sense to you. Normally you will never see them again anyway. Should you wish to select any inventory item in the editor to modify or delete, etc then use L to list all the entities and select from the list.
  3. I placed items within a thick solid with no problem.
  • Add the property inv_map_start with a value of 1 (a setting of 0 means it is not in an inventory.)
  • If it is to go in an AI's inventory, eg, you want a guard to have a key, then add another property inv_target and give it the value of any entity's name (it's individual name not class name.) Yes, even inanimate entities have an inventory. The default inventory is 'player1 (the default player name) so no need to use this property for the player.
  • If the item is one of many of its type, eg, 4 health potions then add the property 'stackable' and give it the value of how many you want.

Dark Mod provides inventory categories to group all of a type together and many other features. Read Inventory for details.

Weapons

Currently, to set the default number of each weapon/ammo that the player starts with you can set the value in the file tdm_player_thief.def in the def folder. Scroll down to the section that starts '// ammo to start with' and the quantities are fairly obvious. You will need a copy of that file in your published archive.

Alternatively, mission designers can give or sell the player weapons and other equipment in the pre-mission shop described in the next section...

Pre-mission Player Equipment Shop

NOTE: some items still not defined for the shop as at September, 2007. To be reviewed

You can optionally provide a pre-mission 'shop' for the player to select, drop, or purchase items. See Purchase Items for full details. For our particular mission this is what you do...

  • Close your mission editor, eg, Dark Radiant.
  • Open your mission 'map' file in a plain text editor.
  • Copy and paste the following immediately beneath the "classname" "worldspawn" line and resave it. MAKE SURE the file is saved with the .map suffix. If you afterwards load it into Dark Radiant and select any primitive brush you should see the following listed in the entity inspector under worldspawn (or you can enter/modify them as properties there one by one (without quotes).....
This list to be reviewed again nearer completion of this tutorial

// the amount of starting gold you want the player to have to buy equipment: "shop_gold_start" "700"

// items the player starts with:
"startingItem_1_item" "weapon_blackjack"
"startingItem_1_qty" "1"
"startingItem_2_item" "weapon_shortsword"
"startingItem_2_qty" "1"
"startingItem_3_item" "weapon_broadhead"
"startingItem_3_0_qty" "15"
"startingItem_3_1_qty" "10"
"startingItem_3_2_qty" "5"
"startingItem_4_item" "weapon_waterarrow"
"startingItem_4_0_qty" "10"
"startingItem_4_1_qty" "5"
"startingItem_4_2_qty" "0"
"startingItem_5_item" "atdm:playertools_compass"
"startingItem_5_qty" "1"
"startingItem_6_item" "atdm:playertools_lockpick_bent"
"startingItem_6_qty" "1"
"startingItem_7_item" "atdm:playertools_health_potion"
"startingItem_7_0_qty" "1"
"startingItem_7_1_qty" "0"
"startingItem_7_2_qty" "0"


//items available for purchase:

"shopItem_1_item" "weapon_broadhead"
"shopItem_1_0_qty" "25"
"shopItem_1_1_qty" "15"
"shopItem_1_2_qty" "10"
"shopItem_2_item" "weapon_waterarrow"
"shopItem_2_0_qty" "15"
"shopItem_2_1_qty" "10"
"shopItem_2_2_qty" "5"
"shopItem_3_item" "weapon_firearrow"
"shopItem_3_qty" "2"
"shopItem_4_item" "weapon_ropearrow"
"shopItem_4_qty" "4"
"shopItem_5_item" "weapon_noisemaker"
"shopItem_5_qty" "3"
"shopItem_6_item" "atdm:playertools_flashbomb"
"shopItem_6_0_qty" "5"
"shopItem_6_1_qty" "3"
"shopItem_6_2_qty" "1"
"shopItem_7_item" "atdm:playertools_health_potion"
"shopItem_7_0_qty" "3"
"shopItem_7_1_qty" "2"
"shopItem_7_2_qty" "1"
"shopItem_8_item" "atdm:playertools_spyglass"
"shopItem_8_qty" "1"


To skip the Buy Equipment screen...

  • Select any worldspawn brush
  • Add the property and value : shop_skip 1

AI Game Characters

By default, AI Game Characters will fidget around on one spot and mutter except if attacking but you can make your game more intesting if some of them are walking about, guards patrolling etc.

First let us define the actual characters for this tutorial mission...

  • Delete any AI that we put in temporarily
  • RMB menu Create Entity > darkmod > AI (type B and AI is just above it) > Thief > atdm:ai_thief. This will be our main character 'Creep'. Place him in the small room for now facing south near the south wall as if looking of a window. It can be a nuisance testing with enemies keep attacking so give him the property team with value 0 temporarily.
  • RMB menu Create Entity > darkmod > AI > Thug > atdm:ai_townsfolk_thug and put him near the torch in the big room. This is a hired thug and we may add another later. Again, put him on team 0 for testing and this one we want to patrol about as if keeping a lookout.

AI Patrols, Walking Routes

To make our thug walk between three points and wait for a varying amount of time at each of them we do the following...

First we create what we need...

  • Create Entity > darkmod > path_corner and place it near Creep. This path_corner is one point on a route that the thug will take. We can adjust its exact position later.
  • Clone that path_corner and put it near the thug in the big room.
  • Clone again and put this one in the yard towards the south right corner. Not too far south - perhaps three quarters of the way down the east wall. Again, we can adjust later.
  • Create a path_wait entity.
  1. Add the property wait, value 5 (this is the minimum seconds the thug will wait)
  1. Add the property wait_max, value 25 (this is the maximum the thug will wait so now he could wait anywhere between 5 and 25 seconds)
  • Place this near Creep.
  • Clone it and place this near the thug
  • Clone it and place this near the path_corner in the yard
  • Unlike path_corners which mark a place, these path_waits can go anywhere except the void because they do not make the AI go to them. However, it makes sense to place them near where they will be used for clarity in the editor.
  • Remember you can copy and paste names! Select the name on the second line down in Entity Inspector and copy it from the input box at the bottom.
  • We shall link all the above together in a chain. Each one must have a 'target' property to the next one in the chain and the final one back to the first in a loop.
  • So, for example, the path_corner near Creep - add the property: target and the value you give it will be the individual name of the path_wait that is near it.
  • To that path_wait you do the same but with the name of the path_corner near the thug
  • To that path_corner near the thug, do the same but with the name of the wait that is near it.
  • To that wait, same but the yard path_corner's name.
  • To the yard path-corner, same but the name of its nearby wait.
  • Finally, to that wait, add same but the name of the FIRST path_corner near Creep.

When you nudge any of these you should see line drawn between them all in a triangle. This is the route that the thug will follow.

  • On the thug add the property: target and the value will be the individual name of the path_corner near Creep. At mission start he will...
  • First go to Creep - because that is his first target
  • Next he will wait there between 5 and 25 seconds because that is the next target
  • Then he will go back where he started in the big room
  • He will wait there again
  • Then he will go out into the yard
  • and wait there.
  • Finally, he will return to Creep, wait, and start all over again.

At mission start the player will drop over the wall at the south end of the yard. He/she wants time to get their bearings so it will be some time (but an unpredictable time) before the thug comes out.

More information on patrol path entities at Currently supported Path Entities


AI Character Relationships: Friends, Enemies, Neutrals

I have already mentioned the team property...

  • All AI belong to a particular team.
  • There are defaults for the basic types of AI, eg, guards and undead are on different teams so will attack one another; the player is on team 0.
  • You can see which team any particular AI is on in Entity Inspector (with 'show inherited properties' checked.)
  • Each team responds to AI on other teams in defined ways.
  • Mostly they will attack anyone on another team
  • They will not attack anyone on their own team.

Generally, for the complete beginner, you need not worry too much about the teams as all the AI are assigned to their default teams. But say you wanted a certain person to be in an alliance with the undead then you would change his team to that of the undead.

Much more complex relationships can be set up for the advanced mission designer. For details see AI Relations (Editing)

Other Animations, Postures

To be reviewed

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

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