Animated static objects: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
'''Animated  Static Objects'''
 
== '''Description of object files''' ==
 


In Dark Radiant it is possbile to have 'static' objects that are animated.  
In Dark Radiant it is possbile to have 'static' objects that are animated.  
Line 25: Line 27:
  Below is an example of the grandfather clocks .def file.
  Below is an example of the grandfather clocks .def file.


***Code*** (this needs fixed)
 
== ***Code*** ==
(this needs fixed)


//anything behind double foward slash is comment, not read by game...
//anything behind double foward slash is comment, not read by game...
Line 67: Line 71:
***CODE END***
***CODE END***


Description of code:
 
== Description of code ==
 


'''model gfclock'''  - name of model (gfclock.md5mesh)
'''model gfclock'''  - name of model (gfclock.md5mesh)
Line 89: Line 95:
"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
"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.
'''"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.
'''"start_anim"      "idle"''' - and this obviously tells game which anim to start with.




== Other info ==


------------





Revision as of 18:41, 2 June 2007

Description of object files

In Dark Radiant 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 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 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.

  • 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.
  • 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.

Back 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.


***Code***

(this needs fixed)

//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"

}

      • CODE END***


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 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.

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).

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.