Jump to content
The Dark Mod Forums

Using sitting and sleeping behavior for something else


Sotha

Recommended Posts

Cool! Although I think I'd get stuck at the "you must give the AI new animations to use" part. Is that wall-lean anim one of your own? That's a look that I've really wanted to see to see but haven't spotted in the core mod yet.

 

I've done a bit of research on the path anim problem by the way. Not tried to test anything yet, I've just looked at the code, but I'm hoping to find a fix for 2.03.

Link to comment
Share on other sites

Cool! Although I think I'd get stuck at the "you must give the AI new animations to use" part. Is that wall-lean anim one of your own? That's a look that I've really wanted to see to see but haven't spotted in the core mod yet.

 

I've done a bit of research on the path anim problem by the way. Not tried to test anything yet, I've just looked at the code, but I'm hoping to find a fix for 2.03.

 

Nice to hear. I didn't even realize path_anim was flawed.

 

Yes, I made that anim for Springheel. It is bundled in Reputation to Uphold. You will also find the anims in Ulysses Genesis. Look in the models\md5\chars\guards\proguard\ folder. lean_*.md5anim.

 

My custom anims have not been put into the core mod because of probably two reasons:

i) the md5anim files are VERY LARGE, because i use blender, and there doesn't seem to be a way to remedy the file size.

ii) the anims often fulfill a niche task: urinate, lean against a wall, kneel and pray, hug & kiss.

 

Anyone is welcome to extract the anims for their own missions and use them freely for any noncommercial application. I really appreciate if I'm credited in the mission readme.

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

I've wanted this functionality for a long time: http://bugs.thedarkm...iew.php?id=2466

 

 

Replacing the sitting/sleeping animations sounds like a good hack (certainly looks good in the example above), but it wouldn't surprise me if it caused some odd problems. Have you tried KOing a guard with this method? IIRC, the sitting and sleeping code does something special to establish the AI's origin and bounding box. Also, if you replace the sleep animations, won't the AI still snore?

 

My custom anims have not been put into the core mod because of probably two reasons:

 

I'm fairly certain the lean animations and the urinate one have both been added to the core mod.

Link to comment
Share on other sites

Replacing the sitting/sleeping animations sounds like a good hack (certainly looks good in the example above), but it wouldn't surprise me if it caused some odd problems. Have you tried KOing a guard with this method? IIRC, the sitting and sleeping code does something special to establish the AI's origin and bounding box. Also, if you replace the sleep animations, won't the AI still snore?

 

I tried to KO and kill the leaning guy. He dies just like he should. KOing works fine. Also if I just wound him, he gets out of the lean with the correct animation and then attacks me.

 

WRT sleeping: oh, I thought the snoring comes from the anims? If not, then the player must override the AI vocal set. If sleeping is replaced the AI can never sleep. Thus the mapper could make the snoring vocals point to silence.

 

 

 

I'm fairly certain the lean animations and the urinate one have both been added to the core mod.

 

Oh, oopsie. Haven't checked. ;)

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

It should be possible to generalize these behaviors; the generalization is described in the bugtracker issue:

 

1 - enter the behavior

2 - execute the behavior

3 - exit the behavior

 

We should be able to have canned behaviors (sitting, sleeping, sitting & sleeping, leaning, hugging, urinating, etc.), with predefined text definitions that describe which anims to use for each behavior state. Then a mapper needn't fiddle around with replacing anims; a new behavior is simply described with a new text definition of anims, and a path node tells the game which behavior definition to read and execute.

  • Like 2
Link to comment
Share on other sites

I've imagined this as a path_entity, with the following spawnargs:

 

"enter_animation" --animation to play upon reaching path_entity

"cycle_behaviour" -- animation to cycle while remaining at that entity--defaults to "idle"

"random_behaviour" --list of animations that are randomly selected just like idle animations. Defaults to none.

"exit_animation" -- animation to play upon leaving path_entity

 

The typical wait spawnargs would control how long the AI spends at that spot. This would cover a wide variety of interesting behavour, including things like maids cleaning, spiders hanging from the ceiling, zombies eating, thieves lockpicking a door, etc. Pathnodes for various behaviours could even be created as prefabs, and the mapper just picks the one he wants.

 

You could also chain them together (see image), so path 1 has "enter_animation" set (maid takes rag out of her belt) and "cycle_behaviour" (maid makes cleaning motion" but not "exit_animation" set, so maid continues to path 2 with the rag still in her hand. Path 2 has "cycle_behaviour" set, so she makes more cleaning motions, then continues to path 3 and then 4, where she cleans some more, but path 4 has an "exit_animation" set, so when she's done cycling her cleaning animation, she puts away the rag and continues on.

 

Additional considerations would be:

"ignore on alert level" "x" -- if the AI's alert level is X or higher, they skip this spawnarg (so maids don't go back to cleaning after finding a dead body).

"skip exit_animation on alert" -- if the AI is alerted while playing cycle, they skip the exit animation. You might not want the maid to calmly tuck her rag back into her belt if the player jumps out at her, but the AI doing pushups shouldn't immediately blink to standing.

post-9-0-32607500-1408909881_thumb.jpg

  • Like 1
Link to comment
Share on other sites

I've imagined this as a path_entity, with the following spawnargs:

 

Oy, that's quite a lot.

 

Note that the behaviors I gave as examples fit a pattern: stop, do something, continue on. (enter a behavior, do that behavior, exit that behavior). Since they fit a pattern, it's reasonable to create a general behavior mechanism that reads a script of what to do.

 

The maid description is a task, which AI execute while doing other things.

 

Examples of tasks are handling a door, handling an elevator, chasing an enemy, combat, searching, etc. Tasks allow the AI to move around while executing them.

 

So the maid example would need to be fleshed out as a task with several states: enter the task, take out the rag, wipe, move to another location, wipe, move to another location, wipe, put the rag away, exit the task. Where and when she wipes can be controlled by path node spawnargs she encounters along the way. Any future requests to repeat this task would be affected by spotting a body, spotting an enemy, her alert level, etc.

Link to comment
Share on other sites

Note that the behaviors I gave as examples fit a pattern: stop, do something, continue on. (enter a behavior, do that behavior, exit that behavior). Since they fit a pattern, it's reasonable to create a general behavior mechanism that reads a script of what to do.

 

The maid description is a task, which AI execute while doing other things.

 

I'm not entirely clear on the distinction. What do you mean by "doing other things"? The AI would still need to be aware of their surroundings, but that's true whether it's a behaviour or a task, isn't it?

 

 

So the maid example would need to be fleshed out as a task with several states: enter the task, take out the rag, wipe, move to another location, wipe, move to another location, wipe, put the rag away, exit the task.

 

Well, that "chain" example may not have been described well. It's not really a task, it's 4 separate "patterns" (enter-do-exit), except that there's no VISIBLE exit on the first 3 paths (no exit animation is played). The AI is still "exiting" the behaviour--they're not in any special "clean task" state while walking from path 1 to 2, though it might sound that way.

 

Basically, the AI needs to be able to play an "enter" animation; cycle a "do" animation for a set amount of time (with the option of including random animations during this cycle, the way idle animations play randomly while sitting)*; and play an "exit" animation. After that, the AI is completely cleared of the behaviour, from a coding perspective, and reverts to regular behaviour. Anything else is gravy.

 

* (it would be important to turn off regular random idles during this time. For example, Sotha might make an animation of a leaning guard spitting that could play randomly, but he wouldn't want the guard snapping to standing pose to play a cough.)

Link to comment
Share on other sites

Biker,

https://drive.google...dit?usp=sharing

 

6.2.2014

This package contains the leaning animation by Sotha.

It is free to use in any way for non-commercial purposes.

 

The animation comes in two parts: "lean" which is the whole anim in one file, intended for RITs.

"lean_loop_*" are the same anim cleaved into segments that could be used in conversations or other advanced

scripted events.

 

def/ folder contains a .txt file that contains the animation def lines,

that should be added to the AI animation defs.

 

maps/ folder contains test maps for the anims.

 

models/ contains the animation files themselves. Simply add the files into your TDM folder.

 

source_files/ contains the original blender files, if someone wants to alter the anims later on.

 

Enjoy!

-Sotha

 

 

Edit: oh, it doesn't contain the entitydefs and modeldefs. I'll copy them later here. To use a custom animation for AI you always need to make a custom entitydef for the AI that uses custom anims.

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

Those animations are already in the core mod, or at least svn.

 

Yeah, looking at tdm_ai_humanoid_guards01.pk4\models\md5\chars\guards\proguard\ it really seems all the leaning stuff is already there. However, tdm_ai_humanoid_guards01.pk4\def\tdm_ai_guard_proguard_devel.def show no sign of lean animations. The anims seem to be in the mod, but they are not defined.

 

To get them to work, you need to make a new file into /def folder. custom_anim_ai.def.

model sotha_ai_custom {
   inherit		    tdm_ai_proguard
   mesh   models/md5/chars/guards/citywatch/tdm_ai_citywatch_lesser.md5mesh
   channel torso  ( *Spine_Dummy)
   channel legs  ( origin Pelvis Pelvis2 *Hips)


	   anim lean				   models/md5/chars/guards/proguard/lean.md5anim
   {
prevent_idle_override
frame 1  call overrideLegs
frame 40    footstep
frame 65    sound snd_rustle
frame 361 sound snd_rustle
frame 583 sound snd_rustle
frame 620   footstep
frame 694 sound snd_rustle
frame 730   footstep
   } 
	    anim lean_loop				   models/md5/chars/guards/proguard/lean_loop.md5anim
   {
prevent_idle_override
frame 1  call overrideLegs
   }

	    anim lean_loop_enter				   models/md5/chars/guards/proguard/lean_loop_enter.md5anim
   {
prevent_idle_override
frame 1  call overrideLegs
   }
	    anim lean_loop_exit				   models/md5/chars/guards/proguard/lean_loop_exit.md5anim
   {
prevent_idle_override
frame 1  call overrideLegs
   }
}
model sotha_ai_custom_thug {
   inherit   sotha_ai_custom
   mesh   models/md5/chars/guards/thug/tdm_ai_guard_thug.md5mesh
   channel torso  ( *Spine_Dummy)
   channel legs  ( origin Pelvis Pelvis2 *Hips)

 }
entityDef sotha_ai_guard_thug
{
"inherit"	 "atdm:ai_guard_thug"
    "model"					 "sotha_ai_custom_thug"  //so it inherits custom anims
}

 

So basically there is "sotha_ai_custom" that gives the new anims. Then I declare "model sotha_ai_custom_thug" which inherits the previously mentioned and tells it to use the thug mesh. And then I declare "sotha_ai_guard_thug", which inherits the standard "atdm:ai_guard_thug" and simply tells it to use the model defined at "sotha_ai_custom_thug."

 

You can expand this idea over all other AI types.

Clipper

-The mapper's best friend.

Link to comment
Share on other sites

Ok, I figured it out, but your map was a bit confusing. It didnt help having the path_corners with the same name format as the path_anim's didnt help ;-P that said its a much needed anim, and I am going to use it on some ne'er-do-wells in my current wip. I assume looking at the def I can create lean anims for any Ai of my choosing?

 

On the anim front, the Ai does a quick & jaring step anim going into the lean, but is perfect coming out of it.

Link to comment
Share on other sites

However, tdm_ai_humanoid_guards01.pk4\def\tdm_ai_guard_proguard_devel.def show no sign of lean animations. The anims seem to be in the mod, but they are not defined.

 

That's an oversight then. I'll add those to SVN so special modelDefs won't be needed in 2.03.

Link to comment
Share on other sites

I've setup an animation (created by someone else) for Goldwell a while ago. I can't remember the details (really have to work on my brain regarding remembrance :) ), but he may could provide the files I've made a s a fundament to get new animations into the game.

 

A path anim is one way to get this to work, but there may be other options so the ai use it more randomly, without the mapper having to specify the single spots it is used on.

 

If you take the lean animation for example one basically owuld have to assume the following parameters:

  • The ai's back has to face the "wall"
  • said wall needs to have a certain height at least so the anim makes sense
  • The ai has to stand at a specific distance to said wall

Just an idea, though. ;)

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • nbohr1more

      Was checking out old translation packs and decided to fire up TDM 1.07. Rightful Property with sub-20 FPS areas yay! ( same areas run at 180FPS with cranked eye candy on 2.12 )
      · 1 reply
    • taffernicus

      i am so euphoric to see new FMs keep coming out and I am keen to try it out in my leisure time, then suddenly my PC is spouting a couple of S.M.A.R.T errors...
      tbf i cannot afford myself to miss my network emulator image file&progress, important ebooks, hyper-v checkpoint & hyper-v export and the precious thief & TDM gamesaves. Don't fall yourself into & lay your hands on crappy SSD
       
      · 3 replies
    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 7 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
×
×
  • Create New...