Shop  •   Avatar  •   FAQ  •   Search  •   Memberlist  •   Usergroups  •   Profile  •   Log in to check private messages  •   Log in  •  Register 

Modifying KF files (animation) now works
Post new topic   Reply to topic     Forum Index -> Customization & Modding
View previous topic :: View next topic  
Author Message
Svip
Powder Monkey
Posts: 4


229 Gold -

PostPosted: Sat Aug 05, 2023 9:20 am    Post subject: Modifying KF files (animation) now works Reply with quote

Summary: Download this zip file, install it as a Blender addon. Set up your scene, import a KF file, modify it, export it again and place it in the custom directory.

Ahoy.

This old thread from 2020 suggests that one of the things that has not been modded yet are the KF files. I have not been able to tell whether anyone else has since cracked it, so here I am to present my breakthrough, I guess.

Let me give you a quick preview.


The scene on the left is the normal scene, while the one on the right is my very basic attempt at modifying the scene. I primarily wanted the change to be noticeable. (I had problems recording my screen, so I settled for a still instead, since I wanted to share it as quickly as possible.)

I only had to make some minor alterations to the blender_niftools_addon to get it to work. Fortunately, some of the developers appeared to have been moving towards support for Sid Meier's Pirates!, that I then took advantage of.

You will only need Blender to get started.

I have asked for them to incorporate my changes into their main addon, but if you are not willing to wait for the next release, you can download my version of the addon right here. In Blender, go to Edit > Preferences > Add-ons. Click install and select the zip file. Make sure if you have the existing add-on to disable that first.

On your scene panel, under Niftools Scene Panel, set game to Sid Meier's Pirates!, and be sure to keep user version and user version 2 to 0.

Now import a NIF-file, then import a KF file appropriate for that file. Then use the pose mode in Blender to modify the keyframes. Then export the KF file again, making sure it has the same name as the original, and place it in the custom folder.

In the game, you should now be able to see your modifications.

Only one issue I've noticed. Sometimes you can see some flickering on some of the animations, like vertices jumping around violently. But it's not that often (and most animations don't have the issue at all).

Anyway, because of this issue, I am still considering this beta.

Also, I have only tested this with the Steam version of the game.


Last edited by Svip on Sun Aug 06, 2023 7:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
Pirate
Helmsman
Posts: 5589



109759 Gold -

PostPosted: Sat Aug 05, 2023 11:12 am    Post subject: Reply with quote

Nice keep up the experimentation.
Back to top
View user's profile Send private message
Svip
Powder Monkey
Posts: 4


229 Gold -

PostPosted: Sat Aug 05, 2023 1:57 pm    Post subject: Reply with quote

Here is an example of the glitches I'm talking about.


Larger scale

The entrance animation is in three successive scenes. (For some reason.) What I've done here is import the first two scenes, immediately exported them back, and then saved them. Like no modifications beyond that, and yet this happens.

But I have only noticed this happening with the entrance animation for the governor's daughter so far. Though, I am sure there is a general fix, not necessarily unique to this game. I just don't know it.


Last edited by Svip on Sun Aug 06, 2023 7:44 pm; edited 1 time in total
Back to top
View user's profile Send private message
Pirate
Helmsman
Posts: 5589



109759 Gold -

PostPosted: Sat Aug 05, 2023 9:17 pm    Post subject: Reply with quote

I’d say there was modifications made simply by importing them and saving them. I believe you didn’t make any changes but something changed by importing it.
Back to top
View user's profile Send private message
Svip
Powder Monkey
Posts: 4


229 Gold -

PostPosted: Sun Aug 06, 2023 6:14 am    Post subject: Reply with quote

My strong suspicion - after some more testing - is that it's rounding errors. Blender uses Python for its add-ons, and Python uses floats, though it has no system to deal with imprecision. The most infamous example is how 0.1 + 0.2 becomes 0.30000000000000004.

Comparing the two KF files, I notice a lot of the keys have had their values altered very slightly. But for most of the joints, it seems to be fine. Indeed, so far, I have only observed this behaviour on the skirt. And it only really occurs when the animation includes a lot of animation on the skirt. Characters without skirts, or animations with little skirt animation, do not see these issues. (Though, in fairness, I have only been testing a slim amount so far.)

Unfortunately, comparing the two KF files is a bit of a manual task. And while I am confident, I could fix these specific animations by fixing the specific keyframes, I would prefer that my add-on simply did not create them. But that may be a problem with the Niftools' Blender add-on itself.
Back to top
View user's profile Send private message
Pirate
Helmsman
Posts: 5589



109759 Gold -

PostPosted: Sun Aug 06, 2023 9:37 pm    Post subject: Reply with quote

Yup it’s a software issue. I’m not sure the fix for that. To my knowledge we never had anybody here to focus solely on animations. We did have a couple guys that worked on nifs but neither have been active here for what seems like since the dinosaurs died out.
Back to top
View user's profile Send private message
themodelcitizen
Gunner
Posts: 862



14635 Gold -

PostPosted: Mon Aug 28, 2023 6:17 pm    Post subject: Reply with quote

Wow brilliant stuff. Keep us updated
Back to top
View user's profile Send private message
Svip
Powder Monkey
Posts: 4


229 Gold -

PostPosted: Tue Aug 29, 2023 6:55 pm    Post subject: Reply with quote

I apologise for the lack of the updates, life has kind of caught up on me, but I hope to explore more on this come September. I think I have the solution to detect why the glitches happen, though not sure on the solution (first I need to know what goes wrong).
Back to top
View user's profile Send private message
Pirate
Helmsman
Posts: 5589



109759 Gold -

PostPosted: Thu Aug 31, 2023 10:14 pm    Post subject: Reply with quote

Arrr, based on the information ye be providin', it seems that the issue ye be experiencin' be related to roundin' errors in Blender's Python-based add-ons, me matey. This be a common problem when workin' with floatin'-point numbers, as Python be lackin' a proper system to handle precision on the high seas.

To fix this scurvy issue, ye can try the followin' approaches, me hearties:

1. Adjust the precision: Ye can try adjustin' the precision o' the floatin'-point numbers used in yer animations. This can be done by roundin' the values to a specific number o' decimal places or by usin' a library that be providin' more precise calculations, like the Decimal module in Python.

2. Modify the animation: If the issue only be occurrin' with animations involvin' the skirt, ye can manually fix the specific keyframes that be causin' the problem. This be a task o' identifyin' the altered values and adjustin' 'em to the desired precision, me matey.

3. Report the issue: If ye suspect that the problem be with the Niftools' Blender add-on itself, consider reportin' the issue to the developers. They may be able to provide a fix or offer guidance on how to resolve the roundin' errors on the high seas.

It be important to note that without more specific information or access to the code and files involved, it be a challenge to provide a definitive fix, me hearties. It may be helpful to consult the Blender community or the developers o' the add-on for more targeted assistance. Yo ho ho!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Customization & Modding All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group