Making better use of Ogre's capbilities?

Everything about development and the OpenMW source code.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Making better use of Ogre's capbilities?

Post by Chris »

Chris wrote:It seems the problem with animations not playing runs a little deeper.
Fixed. I missed that there was a call to setSkipAnimationStateUpdate that, for some reason, prevented only some NPCs from animating. When I remove that, they all move.

If it's true that Silt Striders aren't considered Creatures by the game, then it would make sense for them not to animate since they wouldn't have a CreatureAnimation object. That being the case, then as far as I can tell animations are all working, and performance impact is negligible around Seyda Neen with everyone animating.

There's still some things to do, though. I still need to do keyframe interpolation for when loading into Ogre, since the key times for rotation, translation, and scale don't match up. It may also be good to figure out how to do Quadratic or TBC interpolation with Ogre, as opposed to just linear. Also I need to get the groupings turned into animation states, get the text keys returned back from the NIF so the character AI knows how to do stuff (play sounds, etc), and support for .kf files.

There's also a bug that cropped up when I was messing around with the NPC parts, that I may need someone who's more familiar with the ideas behind the code to take a look at. For some reason, certain body parts (e.g. the chest) don't get removed when equipping items, so you have skin popping out of clothes and armor. As far as I can tell, the associated entities should be getting detached and deleted, but I may have missed something that leads to the removal function not getting called.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Making better use of Ogre's capbilities?

Post by scrawl »

That being the case, then as far as I can tell animations are all working, and performance impact is negligible around Seyda Neen with everyone animating.
Awesome work! Kudos :)
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

Chris wrote: There's also a bug that cropped up when I was messing around with the NPC parts, that I may need someone who's more familiar with the ideas behind the code to take a look at. For some reason, certain body parts (e.g. the chest) don't get removed when equipping items, so you have skin popping out of clothes and armor. As far as I can tell, the associated entities should be getting detached and deleted, but I may have missed something that leads to the removal function not getting called.
So once the armor/clothing is autoequipped, the skin is still showing? Can you give an example NPC name and cell? I will check master/the old animation system to see if the problem exists there too.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Making better use of Ogre's capbilities?

Post by Chris »

jhooks1 wrote:So once the armor/clothing is autoequipped, the skin is still showing? Can you give an example NPC name and cell? I will check master/the old animation system to see if the problem exists there too.
Ajira, in the Balmora Mages Guild. Her chest shows through her robes. I'm pretty sure it didn't occur in master, so it's probably due to something I changed.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

OK, I checked Ajira in master, don't see any skin showing through. I also checked your code and the logic behind handling clothes, skin, and armor is pretty much the same/unchanged.

I think the problem lies within NPCAnimation::removeEntities(), I have not tried running your code yet. It looks like it is getting called properly. Can you try commenting out destroyEntity() within? Just a guess to see if that itself is causing the problem.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

Adding a std::cout statement to removeIndividualPart() could help you see if the code is trying to remove the skin chest part. Just put it in else if(type == ESM::PRT_Cuirass)//3.
You could display the entities mesh name to identify the part being removed.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Making better use of Ogre's capbilities?

Post by Chris »

jhooks1 wrote:Adding a std::cout statement to removeIndividualPart() could help you see if the code is trying to remove the skin chest part. Just put it in else if(type == ESM::PRT_Cuirass)//3.
You could display the entities mesh name to identify the part being removed.
It seems to be a problem with the filter. It's passing way more than it should.

Code: Select all

if(meshes[i].second.length() < filter.length() ||
   !boost::algorithm::lexicographical_compare(meshes[i].second.substr(0, filter.length()),
                                              filter, boost::algorithm::is_iequal()))
{
    ...filtered out...
}
meshes[i].second is an std::string with the mesh name, with filter being "Tri "+bonename.

The chest part is getting removed but the tail is also using the skins file, and though it filters using "Tri Tail", it passes "Tri Chest" as matching. Any time the filter name is the same length as or shorter than the shape name, it passes.
jhooks1
Posts: 780
Joined: 06 Aug 2011, 21:34

Re: Making better use of Ogre's capbilities?

Post by jhooks1 »

Sounds logical, I didn't think of that.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Making better use of Ogre's capbilities?

Post by Chris »

I'm currently stuck on figuring out how to handle the animation groups. Or more precisely, what Morrowind considers an animation group and how it's all controlled.

I had figured I could simply take the "Foo: Start" and "Foo: Stop" markers as the animation group for "Foo", and have the animation handler watch for things like "SoundGen: Bar" in the text key list as the animation plays to trigger whatever needs to be done at the appropriate time.

However, I find I'm running into text keys like "WeaponTwoWide: Thrust Start" that don't have a corresponding "... Stop". So at this point I need to know how the engine is supposed to handle animations, particularly how changes are triggered and how this information should be fed back to the AI, along with how (or if) this ties in with the "playgroup" methods and the like.

I wonder if the animation time tracking should be moved out of mwrender since it's a bit more intimate with character and combat AI, and just having the mwrender subsystem follow how the character AI has set the animation time. Essentially, the character AI gets the text keys and sets the "animation time" based on what it's doing. Then the mwrender subsystem will take the specified time and set the animation properly.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Making better use of Ogre's capbilities?

Post by Zini »

We haven't figured that out yet. The playAnimationGroup/skipAnimation functions are meant for the script interface. We don't have a concept beyond that.

However I am reluctant to move anything out of mwrender, since animation really is a part of the rendering. Instead the RenderingManager should get additional functions for running animations (assuming we can't use playAnimationGroup here) and possibly querying informations about the state of the currently running animation.

I guess of particular interest are two categories of animations here: combat and movement, neither of which is currently implemented outside of the rendering system.

1. Combat

The question here is how do we determine how long an attack is (i.e. when can an NPC start the next attack). Is it a fixed duration? Or should we actually use the duration of the animation? If it is the later, we only need a method to determine if the animation has finished.
Also, when does the attack comes into effect? At the beginning of the animation? Halfway through? Is there anything in the animation data that we can use to determine it? Not sure.

2. Movement

That is particular difficult, at least for things like walking, running and sneaking. As I understand it, while running through an animation a NPC moves over a considerable distance. This must be compensated somehow, i.e. the internal coordinates of the NPC object in the world model must represent where the NPC actually is and not where the NPC was at the beginning of the animation, i.e. the NPC must move continuously and not in discrete steps. So there is probably need for some feedback from the rendering system to the world model (and the physics system).

I think the original plan was to implement these parts of the animation system, when we are implementing the parts of the engine that are making use of them. Not sure if that is still feasible.
Post Reply