Animated static objects: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Baddcog (talk | contribs)
No edit summary
Baddcog (talk | contribs)
 
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''Animated  Static Objects'''
== Description of object files ==
In The Dark Mod it is possbile to have 'static' objects that are animated. A static object is basically anything other than an AI (a chest, a building, a piece of loot). In Dromed this was done by use of joints or multiple models via Tweq settings. In TDM this is done differently.


In Dark Radiant it is possbile to have 'static' objects that are animated.
Animations can be done in a 3d program such as 3dsMax, [http://www.blender.org/ Blender], Lightwave or Maya and exported to ''md5mesh'' files along with ''md5anim'' files.
A static object is basically anything other than an AI (a chest, a building, a piece of loot).
In Dromed this was done by use of joints or multiple models via Tweq settings. In Dark Radiant this is done differently.


Animations can be done in a 3d program such as 3dsMax, Blender, Lightwave or Maya and exported to ''md5mesh'' files along with ''md5anim'' files.
An md5mesh file contains the object and bones info. Objects need to be an edit mesh with a skin modifier. The skin modifier attaches the bones to the mesh (object). The md5anim file contains the animation keyframes. Each animation file has it's own md5anim. This is the same as AI use. For instance a city guard would have a city_guard.md5mesh (containing the AI's data and joints [bones]) and many md5anims such as city_guard_attack1.md5anim (which would obviously be an attack anim). Scripts can be used to call up these anims.
 
An md5.mesh file contains the object and bones info. Objects need to be an edit mesh with a skin modifier. The skin modifier attaches the bones to the mesh (object). The md5.anim file contains the animation keyframes. Each animation file has it's own md5.anim. This is the same as AI use. For instance a city guard would have a city_guard.md5mesh (containing the AI's data and joints [bones]) and many md5anims such as city_guard_attack1.md5anim (which would obviously be an attack anim). Scripts can be used to call up these anims.


Static objects whether animated or not need several files to define them.
Static objects whether animated or not need several files to define them.
*A non-animated object uses an ''.ase'' file (3ds max native) or ''.lwo'' file (Lightwave native) to describe the mesh and which material shader/s it contains. This also contains shadow meshes and collison meshes.
*A non-animated object uses an ''.ase'' file (3ds max native) or ''.lwo'' file (Lightwave native) to describe the mesh and which material shader/s it contains. This also contains shadow meshes and collison meshes.
*An animated object uses the above mentioned ''.md5mesh'' file for this purpose.
*An animated object uses the above mentioned ''.md5mesh'' file for this purpose. (I believe a shadow mesh must be weighted to the bones if used; collision models aren't supported, an AF file must be created for collision data)
*A .mtr file which contains the material shader descriptions (this is referenced by the md5mesh, ase or lwo file)
*A .mtr file which contains the material shader descriptions (this is referenced by the md5mesh, ase or lwo file)
*Some objects will also have a ''.def'' file. This is a deffinition of the object. It defines charactristics such as frobbablitity (can player use it, pick it up?), a list of animations, sounds an object makes, and a bounding box for the object among many other options. If an object has a def file it will need to be created as an entity in the editor, not a model, although it's model can still be reference in the model viewer.
*Some objects will also have ''[[.def files]]''. This is a deffinition of the object. It defines characteristics such as frobability (can player use it, pick it up?), a list of animations, sounds an object makes, and a bounding box for the object among many other options. If an object has a .def file it will need to be created as an entity in the editor, not a model, although its model can still be referenced in the model viewer.
*An AF (Articulated Figure) file is required for collision data on an md5.mesh (animated object). AF files are created in the in game console. Go into game mode, hit '''~''', type '''editafs'''. This allows you to attach basic objects (cube, cylinder, ect) to each bone for collision data. You also need to set links and joint types for the AF. The AF editor will create the af file.


Back to animated objects, static non-animated objects are described further here (make this a link):
== On to animated objects ==
Static non-animated objects are described further here (make this a link):


Proper placement of md5 files is as such:
Proper placement of md5 files is as such:


darkmod/models/md5/gfclock (the grandfather clock files would go here), textures can go here also, or in  
'''darkmod/models/md5/gfclock''' (the grandfather clock files would go here), textures can go here also, or in  
darkmod/models/textures
'''darkmod/models/textures'''
 
A drawback to animated objects is that they don't have collision data, the player can walk through them, arrows can be shot through them. This however can be remedied (?) by adding data to the objects .def file.
Below is an example of the grandfather clocks .def file.


***Code*** (this needs fixed)
A drawback to animated objects is that they don't have collision data, the player can walk through them, arrows can be shot through them. This however can be remedied (?) by adding data to the objects .def file. Below is an example of the grandfather clocks .def file.


//anything behind double foward slash is comment, not read by game...
''CombatModel=1'' will make the engine use all polys on a model to calculate collision data. This takes alot of processing power. Using a simple AF model is a better choice, you would use ''CombatModel=0'' in that instance.
//not sure if the damage command is needed, probably not. Will mess with it more and update, Baddcog


model gfclock {
== Code ==


mesh  models/md5/props/gfclock/gfclock.md5mesh
//grandfather clock obj by who?
anim idle  models/md5/props/gfclock/gfclock_idle.md5anim
//anything behind double foward slash is comment, not read by game...
model gfclock {
    mesh  models/md5/props/gfclock/gfclock.md5mesh
    anim idle  models/md5/props/gfclock/gfclock_idle.md5anim
    {
        random_cycle_start
    }
}


{
entityDef atdm:furniture_gfclock {
random_cycle_start
    "spawnclass"    "idAnimated"
}
    "model"          "gfclock"
    "editor_mins"    "-12 -12 -52"
    "editor_maxs"    "12 12 52"
    "size"          "24 24 104"
    "start_anim"    "idle"
    "CombatModel"    "1"
}


== Description of code ==
*'''model gfclock'''  - name of model (gfclock.md5mesh)
*'''mesh  models/md5/props/gfclock/gfclock.md5mesh''' (path to mesh)
*'''anim idle  models/md5/props/gfclock/gfclock_idle.md5anim''' (path to anim/s) currently anim idle is an animation of the pendulum swinging back and forth. It could be changed in the future to be a blank anim, the clock is idle/not doing anything. Then more anims would be listed such as:
*'''anim running models/md5/props/gfclock/gfclock_running.md5anim''' (this way it could be 'wound' by player (frobbed), and thru a script it would turn on)
*'''random_cycle_start''' -'''''edit this, not sure what it means exactly'''''


}
Now that we've got the model and paths out of the way we come to the entity descriptions. This is what effectively takes the model and changes it from a model which does nothing in game, to an entity which is almost limitless through use of properties, scripts and ingenuity.


entityDef atdm:furniture_gfclock {
*'''entityDef atdm:furniture_gfclock''' - the name that will be in the editor entity list. (atdm is used so it can be found in list with all other DarkMod entities, furniture further catagorizes it for ease of use)


"spawnclass"  "idAnimated"
*'''"spawnclass"  "idAnimated"''' - all entities are 'spawned' when the game loads, they have to have a class to which they belong. In this case it is idAnimated which will let it run animations. This however causes the problems with being able to walk through the object. I believe these classes are defined somewhere in the gamecode itself so certain props need added to a def file to fix the problems.
"model" "gfclock"
"editor_mins"    "-12 -12 -52"
"editor_maxs"    "12 12 52"
"size"      "24 24 104"
"start_anim"      "idle"
"snd_bounce"    "material_wood_impact"
"CombatModel"    "1"


"damage"      "100000"
*'''"editor_mins"    "-12 -12 -52"'''
*'''"editor_maxs"    "12 12 52"'''
*'''"size"      "24 24 104"''' - fairly obvious, size of bounding box for object in game. These 3 props add a player/AI collision model. Now the object can't be walked through. But you can't hide behind it either 'cause a guard can shoot an arrow through it. So we need to add
*'''"CombatModel"    "1"''' - this creates yet another bounding box around the object, this stop projectiles from going through the object. I believe this can be changed to a few shapes such as a cylinder for more realistic physics.
*'''"start_anim"      "idle"''' - and this obviously tells game which anim to start with.


}
== Other info ==
***CODE END***
The clocks material file has wood as a material type. The description of wood in the .mtr file is what causes arrows to stick to it and to make it sound like wood.


the clocks material file has wood of course. I'm not sure that snd_bounce above is needed either, I think since it now has a collision box it uses the material to determine the reaction/sound.
Go in game, pull down console and type
g_showcollisionmodels
The red box drawn around the object is the player collision model, the blue box is the combat model.


Other than that I think the neccesary info to include is that the animated obj is a combo of the md5.mesh and md5.anim (maybe links to those things, I think the Wiki does have info on that).
[http://www.doom3world.org/phpbb2/viewtopic.php?t=5474&sid=b60f18bf1d3f2fbe8f6fafa138683f35 Der_tons md5 model exporter] works great for exporting the model/anim. He has several versions. I have only used the 3dsMax one. There are other useful tools in that list.


Der_tons md5 model exporter works great for exporting the model/anim. He has several versions. I have only used the 3dsMax one. But he does have a GMax one, gmax was free public download, just checked but looks like they stopped offering it in 2005. I think I have it on disk somwhere, not sure we'd want to distribute it though.
[[Category:Models]]
[[Category:Tutorial]]

Latest revision as of 20:23, 2 September 2007

Description of object files

In The Dark Mod it is possbile to have 'static' objects that are animated. A static object is basically anything other than an AI (a chest, a building, a piece of loot). In Dromed this was done by use of joints or multiple models via Tweq settings. In TDM this is done differently.

Animations can be done in a 3d program such as 3dsMax, Blender, Lightwave or Maya and exported to md5mesh files along with md5anim files.

An md5mesh file contains the object and bones info. Objects need to be an edit mesh with a skin modifier. The skin modifier attaches the bones to the mesh (object). The md5anim file contains the animation keyframes. Each animation file has it's own md5anim. This is the same as AI use. For instance a city guard would have a city_guard.md5mesh (containing the AI's data and joints [bones]) and many md5anims such as city_guard_attack1.md5anim (which would obviously be an attack anim). Scripts can be used to call up these anims.

Static objects whether animated or not need several files to define them.

  • A non-animated object uses an .ase file (3ds max native) or .lwo file (Lightwave native) to describe the mesh and which material shader/s it contains. This also contains shadow meshes and collison meshes.
  • An animated object uses the above mentioned .md5mesh file for this purpose. (I believe a shadow mesh must be weighted to the bones if used; collision models aren't supported, an AF file must be created for collision data)
  • A .mtr file which contains the material shader descriptions (this is referenced by the md5mesh, ase or lwo file)
  • Some objects will also have .def files. This is a deffinition of the object. It defines characteristics such as frobability (can player use it, pick it up?), a list of animations, sounds an object makes, and a bounding box for the object among many other options. If an object has a .def file it will need to be created as an entity in the editor, not a model, although its model can still be referenced in the model viewer.
  • An AF (Articulated Figure) file is required for collision data on an md5.mesh (animated object). AF files are created in the in game console. Go into game mode, hit ~, type editafs. This allows you to attach basic objects (cube, cylinder, ect) to each bone for collision data. You also need to set links and joint types for the AF. The AF editor will create the af file.

On to animated objects

Static non-animated objects are described further here (make this a link):

Proper placement of md5 files is as such:

darkmod/models/md5/gfclock (the grandfather clock files would go here), textures can go here also, or in darkmod/models/textures

A drawback to animated objects is that they don't have collision data, the player can walk through them, arrows can be shot through them. This however can be remedied (?) by adding data to the objects .def file. Below is an example of the grandfather clocks .def file.

CombatModel=1 will make the engine use all polys on a model to calculate collision data. This takes alot of processing power. Using a simple AF model is a better choice, you would use CombatModel=0 in that instance.

Code

//grandfather clock obj by who?
//anything behind double foward slash is comment, not read by game...
model gfclock {
    mesh   models/md5/props/gfclock/gfclock.md5mesh
    anim idle  models/md5/props/gfclock/gfclock_idle.md5anim

    {
       random_cycle_start
    }
}
entityDef atdm:furniture_gfclock {
    "spawnclass"     "idAnimated"
    "model"          "gfclock"
    "editor_mins"    "-12 -12 -52"
    "editor_maxs"    "12 12 52"
    "size"           "24 24 104"
    "start_anim"     "idle"
    "CombatModel"    "1"
}

Description of code

  • model gfclock - name of model (gfclock.md5mesh)
  • mesh models/md5/props/gfclock/gfclock.md5mesh (path to mesh)
  • anim idle models/md5/props/gfclock/gfclock_idle.md5anim (path to anim/s) currently anim idle is an animation of the pendulum swinging back and forth. It could be changed in the future to be a blank anim, the clock is idle/not doing anything. Then more anims would be listed such as:
  • anim running models/md5/props/gfclock/gfclock_running.md5anim (this way it could be 'wound' by player (frobbed), and thru a script it would turn on)
  • random_cycle_start -edit this, not sure what it means exactly

Now that we've got the model and paths out of the way we come to the entity descriptions. This is what effectively takes the model and changes it from a model which does nothing in game, to an entity which is almost limitless through use of properties, scripts and ingenuity.

  • entityDef atdm:furniture_gfclock - the name that will be in the editor entity list. (atdm is used so it can be found in list with all other DarkMod entities, furniture further catagorizes it for ease of use)
  • "spawnclass" "idAnimated" - all entities are 'spawned' when the game loads, they have to have a class to which they belong. In this case it is idAnimated which will let it run animations. This however causes the problems with being able to walk through the object. I believe these classes are defined somewhere in the gamecode itself so certain props need added to a def file to fix the problems.
  • "editor_mins" "-12 -12 -52"
  • "editor_maxs" "12 12 52"
  • "size" "24 24 104" - fairly obvious, size of bounding box for object in game. These 3 props add a player/AI collision model. Now the object can't be walked through. But you can't hide behind it either 'cause a guard can shoot an arrow through it. So we need to add
  • "CombatModel" "1" - this creates yet another bounding box around the object, this stop projectiles from going through the object. I believe this can be changed to a few shapes such as a cylinder for more realistic physics.
  • "start_anim" "idle" - and this obviously tells game which anim to start with.

Other info

The clocks material file has wood as a material type. The description of wood in the .mtr file is what causes arrows to stick to it and to make it sound like wood.

Go in game, pull down console and type

g_showcollisionmodels

The red box drawn around the object is the player collision model, the blue box is the combat model.

Der_tons md5 model exporter works great for exporting the model/anim. He has several versions. I have only used the 3dsMax one. There are other useful tools in that list.