Jump to content

Help with behaviors, animation blending and states


Ceruulean

Recommended Posts

Here's the deal: I am working on improving Burning Skies, the playable dragon race mod (http://www.nexusmods.com/skyrim/mods/25261). One of the many requests was to implement takeoff and landing animations, which was previously thought impossible. After recent progress in mods that alter behaviors, I decided to take a crack. The biggest issue was that playing these animations on the player caused the game to CTD. After looking into the behavior files, I concluded that the animation events are linked to the game engine, and the engine does not have player-controlled flight programmed into it. I made a new dragon race with a copy of the files, and changed all the names of the animation events. The animations finally play without crashing.

 

Still, there are several problems I have encountered. One is that the Crusing state animation blending stops working properly. In the mod, flying animations blend correctly as the player turns. However, using the custom behavior, the blending works sometimes, but often goes into a T-Bone pose seemingly at random. The only difference I can think of is that the mod directly calls the FlyStartCruise event from the ground (by a weird game quirk that the previous author discovered) while the custom behavior graph actually follows the takeoff sequence and cannot start FlyStartCruiseFDR directly from the ground, and the events are renamed. Is there a way to get rid of the T-Bone?

 

Interestingly enough, the dragon's Hover state disables player movement. I was trying to make moveStop trigger the Hover state from Cruising, which works, but I cannot return to the Cruising state even though I have set up the moveStart transition to do so. Annoyingly, I can still shout, so the controls are working, and if I type into the console "player.sendanimevent moveStart" or "player.pa (id of ActionMoveStart)" it will fire correctly. I have tried removing modifiers to catch the culprit; nothing. Does anyone have any idea why/how a state disallows player movement?

 

Another unusual problem is that while flying with the custom race, typing 'help -insert word here-' as a console command crashes my game. This kind of instability is worrying and seems related to the custom behavior graph even though I haven't changed that much. It doesn't crash with any of the vanilla behaviors. Can this be fixed?

 

Finally, I added new states and essentially tried creating a custom Hover state, but the game and the CK puked when I viewed the animations (changing race in-game, animation tab in CK). Since then I scrapped the file. Well, I pasted objects at a random place in the behavior file, and assigned them IDs like 9999, 9998, etc. Is there a certain order I must follow or some hidden requirements? (pretty sure I had the correct event names and generators and stuff attached, although I did reuse and rename useless animation events instead of creating my own, maybe that's why?)

 

Thanks for reading.

Edited by Ceruulean
Link to comment
Share on other sites

Best people to answer this would be Fore or maybe Deapri (author of that flying houseboat). Its complicated I'm sure. :huh:

Fore...he does all the FNIS schtuff, must know something about that?

 

Deapri:

http://www.nexusmods.com/skyrim/mods/24234/?

 

Deapri is a monster scriptor. I trust anything he says. IF, IF, If you get any response from him, pay heed. ;) good luck. If you don't, then don't bother poor Deap, he's prolly dealing with things.

Link to comment
Share on other sites

I don't have time to look into behaviors right now (new mod coming, and 2 updates), but let me tell you my experience about the t-pose issue.

 

The sporadic t-pose is most likely cause by missing pre-cache, which is a common issue for custom animation. And as soon as the engine is under high load it takes too long to read the animation file (again and again).

 

For characters the (vanilla) pre-cache takes place whenever the character changes weapon. Which animations have to be pre-cached is determined by information contained in meshes/animationsetdatasinglefile.txt. This file is a dump of behavior information, not primarily defined to support pre-caching. So it's quite hard to find the relationships. Among other information there are lists of animation files which have "something to do" with specific animation events.

 

Why these lists are defined in this way is really hard to tell. Because thes lists often are very long (100 and more animations), and most of all, animation file names and their path are crc32 encrypted. And the files (in crc) do not only appear once, but some of them (1hm_attack if I remember right) appear like 16 times (8 male and 8 female).

 

FNIS supports pre-caching for its animations. Gender, PCEA, and Alternate Animations (starting with FNIS 6.0) is built-in, others, like for FNIS Flyer, FNIS Sexy Move, XPMSE can be set via an interface file GenerateFNIS_for_Users/CustomPreCacheFiles.txt. With that information, the FNIS generator goes through the animationsetdatasinglefile, looks for certain reference files for each of the custom animations, and adds crc information for them. In vanilla asdsf has about 75,000 lines, my last generated one is swollen to 106,000 lines.

 

Unfortunately for you, FNIS is doing this only for male and female. And, since you need a new race, a complete new structure for your custom race has to be added to asdsf. And although you can use a copy of the dragon one, you would need to change the path information (in crc!!) everywhere. And I have no idea what it takes to make the engine accept the new race information in this file.

 

I invite you to have a look in this asdsf file to see what is awaiting you. :)

Link to comment
Share on other sites

Informative answer; it certainly makes sense. I noticed the blending works when I am stationary or run into a wall, but once I start moving it appears that calculations were overloading the engine, causing hiccups.

 

This is a bummer. If I could manage to add new data entries to animationsetdatasinglefile, it would be incompatible with the FNIS generated version. However, you are able to add information to the humanoid races, so I reckon it's possible to add new race entries. There's a list of all the behavior project files, maybe I'd just have to add mine! (if only it was that simple) I'm not a programmer nor developer but I think limiting the engine to only recognize existing races would make it difficult to add DLCs, although Beth has the source code and we don't. :tongue: And to fix the blending, this is only if I could read the information in the first place... I've thought about altering the original dragon behavior but I'm afraid of breaking their AI and the flying mechanisms surrounding it.

 

I'm curious, how do you decipher the asdsf file? Is there a program? Do you know what the additional .txt files do (Like characterroject.txt)? As far as I can tell, there's animation events that correlate with the behavior graph (like killing an actor in a killmove at x seconds), and random integers. Are they also in crc?

 

Well, it turns out behaviors are the easy part haha. I recall someone mentioning an interview where someone asked a Skyrim dev whether it was possible for modders to make dragons playable. Apparently he said it was impossible. He was wrong, because the mod exists, but he was right, because for a true, fully functioning playable dragon, the same system used by NPC flight has to be coded for player-controlled inputs, after reverse-engineering the engine since modders don't have the source code (currently it's possible to mimic flight with an SKSE plugin). Otherwise when creating a copy of the dragon behavior graph the animations need additional processing. Phew! No wonder the Skywind development team has run into brick walls in regards to implementing custom creatures.

Edited by Ceruulean
Link to comment
Share on other sites

Breaking down the asdsf into its parts is not that hard. The problem is the sheer size.

 

THe whole file consists of blocks that start with the number of entries it contains, followed by these entries. Now these entries can be just 1-liners (like this very first block), or of nested blocks. But with a little inspiration that can also be done.

 

Now you see the second block starts at line 51 (line 1 + 1 line with count ("49") + 49 * 1 line = 51). These 3 lines ("1"/"FullBody.txt"/"V3") are the typical start of a project ("ChickenProject").

 

Now looking into the dragon project it looks extremely simple compared to character. It starts at line 62838 with the 1/FullCharacter.txt/V3, followed by a few anim events together with the corresponding clipgenerator names. Then there starts the block of 192 animations. Interestingly the dragon only has 179 animations, but some of them seem to be doubles. Each file entry consists of 3 lines:

3692944883 'crc32 for meshes\actors\dragon\animations

3191128947 'e.g crc32 for ground_bite, the first dragon animation, lowercase, without ".hkx"

7891816 'crc for hkx

 

Now I would assume that it is completely sufficient to add dragon custom animations to pre-cache by simply adding triples with the same scheme at the end of the list. There are plenty of online crc converters. Just make sure they provide the same result when fed with the "meshes\actors\dragon\animations".

 

Now if you can add a complete new race this way I can't say. But at least I would say you got a good chance.

Link to comment
Share on other sites

Sounds great, but I still don't know how to convert crc32 to readable text. I've searched for online crc convertes but they give me different values. I am missing something.

 

You can't. :smile:

 

crc32 is only a check value that comprises a string or a whole file to a 32 bit number. But the algorithm is so good, it is almost impossible that 2 strings have the same crc. So when you see crc values you need to know what you are looking for to make conclusions.

 

How long do you think it took me to figure out what these numbers meant? If they hadn't separated "hkx" as 3rd part of the triple, and if the crc value of a 3 character string would have the same hex value as the string itself, I probably had never found out what those numbers stand for.

Link to comment
Share on other sites

Ok, so the crc is a check value. I'm guessing it works like this: When the behavior graph requests to play an animation, the game encodes the animation string into crc32, then checks the crc in the asdsf. If the encoded value matches a check value, it loads the animation from the pre-cache; otherwise it loads from the file directly. It seems most, if not all, animations are included in asdsf.

 

All the online converters give values that are different from the ones in the file, so would that mean the game uses a custom CRC algorithm? And in order to add my own file paths I'd have to figure out the algorithm and get an integer CRC value? Well, I don't even understand half the stuff about how a CRC is calculated.

 

Hmm, maybe an easier method would be to place the duplicate behavior project file in the same folder as the vanilla dragon actor but with a different name, then link up the new behavior files with each other. The custom race will use the altered behavior files and the vanilla dragons can continue using vanilla behavior. Why didn't I think of this before! :O Although, the asdsf file lists DragonProjectData\DragonProject.txt which means I might have to deal with pre-caches after all. I will see what happens when I have time.

Edited by Ceruulean
Link to comment
Share on other sites

No, I have made the experience that most online tools provide the same result. As far as I remember there was one that allowed you to set the seed, and the their default was FFFFFFFF, but Skyrim uses 0. You also have to make sure that everything is lowercase, file without ".hkx", path starting from meshes.

 

The algorithm is public domain, relatively simple and efficient. For FNIS I used public C code, which I have re-written in VB. Works great. In the mean time I even use this function for other things as well. For example to determine if something has changed in the FNIS generation between 2 different loads.

 

The way pre-cache works is a little different from what you described. For character the pre-cached files are read whenever a new weapon is equipped. Then all the particular files are read, and are simply there whenever the behavior need them. But since all dragon files are in one list, I assume that all files are read on load, and are present all the time. But you can figure that out with the Windows Process Monitor. VERY useful. Without it I had never learned how pre-cache actually works.

 

And no, I don't think that you can get around adding a new project in asdsf. Btw, I don't think that a file DragonProjectData\DragonProject.txt is necessary. This is probably only an intermediate file for every race. Because what is important is the name of the "entry" behavior file, which is dragon/dragonproject.hkx.

Link to comment
Share on other sites

@fore: Awesome that you give so much information, even while you claim time is not to spare. +1, and I also appreciate your posts as they are quite informative and easy to translate to my laymen level just by looking at what you reference as I read.

 

Thank you very much, fore. :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...