Surface Types: Difference between revisions
No edit summary |
Added undeadflesh. Partial cleanup of outdated info. |
||
Line 51: | Line 51: | ||
* armor_chain | * armor_chain | ||
* armor_plate | * armor_plate | ||
* undeadflesh (like flesh, but less vulnerable to mundane damage) | |||
= Instructions on putting in new surfaces = | = Instructions on putting in new surfaces = | ||
Line 91: | Line 92: | ||
= What surfaces do = | = What surfaces do = | ||
Surfaces are used to tell what sound to play when you walk on a surface (this code is already in D3, we just have to tell it what sounds to play and how loud those sounds should be to AI). They are also used when a projectile hits a surface, to play a specific sound, give off a specific particle effect, or | Surfaces are used to tell what sound to play when you walk on a surface (this code is already in D3, we just have to tell it what sounds to play and how loud those sounds should be to AI). They are also used when objects collide or a projectile hits a surface, to play a specific sound, give off a specific particle effect, or to trigger a specific action (rope arrow only sticks in wood; only "climbable" surfaces can be climbed). | ||
They also determine armor factors in combat (an arrow will bounce off the AI's helmet, but if you shoot it right into the eye opening, it will hurt). | |||
= See also = | = See also = |
Revision as of 03:48, 27 December 2009
Originally written by Ishtvan on http://forums.thedarkmod.com/topic/2974
Okay, adding the new surface types wasn't as easy as I thought, but I have put in a system for it and it works. This is subject to change. However, unless people really don't like this, I think we can go with this.
The following surfaces are standard D3 surfaces. We cannot change the name of these even if we wanted to.
Old (D3) Surface Types
Put these in the first line of the .mtr file
- none
- metal
- stone
- flesh
- wood
- cardboard
- liquid
- glass
- plastic
- ricochet
- surftype10
- surftype11
- surftype12
- surftype13
- surftype14
New (unique to TDM) surface types
Use surftype15 and put surface in description string (this list is not fixed, we can keep adding to it):
- tile
- carpet
- dirt
- gravel
- grass
- rock
- twigs
- foliage
- sand
- mud
- brokeglass
- snow
- ice
- squeakboard
- puddle
- moss
- cloth
- ceramic
- climbable
- slate
- straw
- armor_leath
- armor_chain
- armor_plate
- undeadflesh (like flesh, but less vulnerable to mundane damage)
Instructions on putting in new surfaces
We had to do some tricks to expand the list of surfaces. In the material file, put surftype15 as the first line. Then, in the "description" line, put the new surface type in quotes. If you want to add anything after that, that's fine, just make sure the surface type is the first thing in the description, and you put a space after it.
NOTE: Old surfaces can be entered the same way as new surfaces, but it decreases performance You could use the surftype15/description method to enter surface types for old D3 textures if you wanted. Entering it the "old" way would lead to slightly faster performance though, since wood is in the enumeration so no string manipulation is required. I don't think this performance impact will be noticable, but you never know.
Examples
Putting in one of the old D3 surface types, wood:
textures/darkmod/mansion/floor/manfloor03 { wood qer_editorimage textures/darkmod/mansion/floor/manfloor03.tga diffusemap textures/darkmod/mansion/floor/manfloor03.tga specularmap textures/darkmod/mansion/floor/manfloor03_s.tga }
Putting in a new surface type, tile:
textures/darkmod/mansion/floor/manfloor02cen2 { surftype15 description "tile" qer_editorimage textures/darkmod/mansion/floor/manfloor02cen2.tga diffusemap textures/darkmod/mansion/floor/manfloor02cen2.tga specularmap textures/darkmod/mansion/floor/manfloor02cen2_s.tga }
Again, note that you could put more in the description line, for example:
description "tile This is a tile mosaic that might look nice in a mansion entry hall"
This will work because the first word is tile and there's a space after it.
Warning!
As of now, there is no system to tell you when you make a typo in the new surface type name that goes in the description field. The surface just won't play the proper sounds, etc, it will play the default sounds or none. In the final release, we will hopefully include a quick parser that will go thru the material files for the map and let you know if the new surface types don't match the valid ones.
What surfaces do
Surfaces are used to tell what sound to play when you walk on a surface (this code is already in D3, we just have to tell it what sounds to play and how loud those sounds should be to AI). They are also used when objects collide or a projectile hits a surface, to play a specific sound, give off a specific particle effect, or to trigger a specific action (rope arrow only sticks in wood; only "climbable" surfaces can be climbed).
They also determine armor factors in combat (an arrow will bounce off the AI's helmet, but if you shoot it right into the eye opening, it will hurt).