Jump to content
The Dark Mod Forums

Eating animations


Springheel

Recommended Posts

Continued from Sotha's thread:

 

Tels, I notice that when I add the following bolded lines to an eat animation:

 

anim idle_eat02 models/md5/chars/guards/proguard/idle_eat02.md5anim //reaches out to table and eats food

{

no_random_headturning

frame 8 pickup AIUSE_EAT food hand_r

frame 30 sound_voice snd_eat

frame 54 drop food

}

 

the framerate of the map drops immensely. It's just a small room but there is noticable stuttering. Commenting those two lines out returns the framerate to normal. Is that the expected behaviour?

 

Also, I don't quite understand this:

if the spawnarg selector fails (because maybe every entity was too far away or not usable), it still tries the one listed in the animation, and this will also support AIUSE_FOOD or a direct entityname plus the distance constraints mentioned above

 

Does the code stop playing the "eat" animation when all the food is gone? That didn't happen in my test case, but I can't figure out if it is supposed to.

Link to comment
Share on other sites

Continued from Sotha's thread:

 

Tels, I notice that when I add the following bolded lines to an eat animation:

 

 

 

the framerate of the map drops immensely. It's just a small room but there is noticable stuttering. Commenting those two lines out returns the framerate to normal. Is that the expected behaviour?

 

No definitely not. I'll look into it (if possible file a tracker entry). One cause could be the multiple debug prints that are still in the code (printing to the console is quite slow).

 

Edit: I can see the code does a lot of repetition every time the frame command is run, it f.i. always parses the commands again, always converts the joint name to the joint num etc. I think that we could cache a few of these things, but first one would need to find out where the slowdown is actually.

 

Also, I don't quite understand this:

 

Does the code stop playing the "eat" animation when all the food is gone? That didn't happen in my test case, but I can't figure out if it is supposed to.

 

If there is nothing to pickup, nothing will be attached. However, the animation will still continue (except the AI just makes the motion w/o object). The code is designed that simply the pickup fails, and later the drop will also fail (there is nothing to drop) but things go on.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

If there is nothing to pickup, nothing will be attached. However, the animation will still continue

 

This results in the AI continuing to eat even when there's nothing left to eat. Wouldn't it be better if the animation were no longer called if there was nothing left to attach?

Link to comment
Share on other sites

Tels, can you see any reason why this animation wouldn't work?

 

anim idle_eat02 models/md5/chars/guards/proguard/idle_eat02.md5anim

{

no_random_headturning

frame 8 attach atdm:moveable_food_carrot carrot hand_r

frame 30 sound_voice snd_eat

frame 34 destroy carrot

}

 

I'm getting the same error I used to get with the stir and draw card animations--"cannot find attachment "carrot" to destroy".

 

I don't get it. Is the original problem still active? I can't see anything wrong with the formatting of the frame commands. :huh:

Link to comment
Share on other sites

This results in the AI continuing to eat even when there's nothing left to eat. Wouldn't it be better if the animation were no longer called if there was nothing left to attach?

 

I am not sure, that would be something for the "animator" or "user of the animation" to decide. From afar, it looks still ok.

 

Anyway, the problem is that I don't even know if it is possible to abort an animation via frame command, and even then, the frame command (where the AI checks if there is something to eat) comes already quite late in the animation.

 

So to get this to work we need:

 

* a "check-and-reserve-this-entity for me" frame command, which disables frob/physics on the entity (so it cannot be "stolen" by the player via frob or arrow between the check and the time the AI picks it up. This command would then run in the first frame of the animation, and if there is nothing, optionally disable this animation.

* a way to abort an animation via frame command

 

Please file a feature request for that, but I am not sure I can get this to work, my knowledge of animations is very crude.

 

Tels, can you see any reason why this animation wouldn't work?

 

Quote

anim idle_eat02 models/md5/chars/guards/proguard/idle_eat02. md5anim

{

no_random_headturning

frame 8 attach atdm:moveable_food_carrot carrot hand_r

frame 30 sound_voice snd_eat

frame 34 destroy carrot

}

 

 

I'm getting the same error I used to get with the stir and draw card animations--"cannot find attachment "carrot" to destroy".

 

I don't get it. Is the original problem still active? I can't see anything wrong with the formatting of the frame commands. :huh:

 

I'll look into it. Did you get any console warnings about not being able to attach the carrot? As far as I know, it works with moveable apples. No, it might not really work with moveable apples. I'll see what I can do tonight.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

I'll look into it. Did you get any console warnings about not being able to attach the carrot?

 

No, it was attaching them fine, but just not destroying them. This is exactly the same problem that was happening before with the stirring and card-drawing animations. I assume the fix was a general fix, and not specific to those two animations...?

 

edit: I went back and looked at the tracker entry, and greebo's fixes said:

 

Add this line to the anim in question:

 

frame 1 object_call syncLegsWithTorso

 

Better fix in place with rev. 11534, implemented in the idle anim scripts in ai base script. The above frame command method is still available.

 

So maybe this animation wasn't picked up by the script for some reason. I'll try adding the extra frame command tonight.

Link to comment
Share on other sites

No, it was attaching them fine, but just not destroying them. This is exactly the same problem that was happening before with the stirring and card-drawing animations. I assume the fix was a general fix, and not specific to those two animations...?

 

edit: I went back and looked at the tracker entry, and greebo's fixes said:

 

So maybe this animation wasn't picked up by the script for some reason. I'll try adding the extra frame command tonight.

 

It also might be that there is another channel running in parallel with the torso, like the head? (Just a shot in the dark)

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

Link to comment
Share on other sites

Ok, I' added "frame 1 object_call syncLegsWithTorso" to the animation and it fixed it in the testmap. However, when I added it to my mission and ran around testing things, I occasionally noticed a "could not find attachment "carrot" to destroy" error in the console.

 

I wasn't watching the AI at the time, so it's possible that something else caused that problem. I've noticed that if the animation gets interrupted before the "destroy" frame, the carrot stays attached, obviously. I'm not sure if that's what is happening, however...other than alerts, can anything interrupt an animation played by a path_anim?

 

It's a bit of a problem, because I don't really want the guard to wander around holding a carrot.

Link to comment
Share on other sites

Ok, I' added "frame 1 object_call syncLegsWithTorso" to the animation and it fixed it in the testmap. However, when I added it to my mission and ran around testing things, I occasionally noticed a "could not find attachment "carrot" to destroy" error in the console.

 

I wasn't watching the AI at the time, so it's possible that something else caused that problem. I've noticed that if the animation gets interrupted before the "destroy" frame, the carrot stays attached, obviously. I'm not sure if that's what is happening, however...other than alerts, can anything interrupt an animation played by a path_anim?

 

Maybe an idle animation? Or a greeting?

 

It's a bit of a problem, because I don't really want the guard to wander around holding a carrot.

 

As long as he doesn't say "What's up, Doc?" before taking a bite :D

 

Well, I think we need some sort of "failsafe" that destroys things when the animaiton suddenly ends. Not sure where or how to implement this, tho.

"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man." -- George Bernard Shaw (1856 - 1950)

 

"Remember: If the game lets you do it, it's not cheating." -- Xarax

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

    • 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
       
      · 2 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
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
×
×
  • Create New...