Tiniifan / studio_eleven

Level 5 (3DS) Blender Addon
MIT License
9 stars 2 forks source link

.mtn2 export bloats filesize #10

Open asteriddle opened 1 week ago

asteriddle commented 1 week ago

The issue: When exporting an animation as .mtn2, the file's size is exponentially larger than the base animations. Even importing a base game animation and re-exporting it will yield this result.

This becomes an issue when accounting for the fact that, as 3DS games, many L5 games have some form of memory management, even when emulated. If the file size of an animation (or other unrelated model asset) is too large, the game will start to display a buggy UI in an attempt to conserve memory - or will straight up crash on hardware.

Provided are three sample files in the ZIP (Github won't let me upload them raw); studioeleven mtn2 issue samplefiles.zip

These sample files were created based around resources in Yokai Watch 2: Psychic specters

bakulia og mtn2 000.mtn2 - The original, unmodded .mtn2 for Bakulia's p20.xc file, mostly for reference. p20 bakulia reexport.mtn2 - This is the exact same motion as above, but it has been imported into Blender with Studio Eleven and then exported with no changes. p20 complete custom.mtn2 - This is a completely custom .mtn2 that uses my own model's skeleton, though the start and end frames for actions and length of the timeline are the same.

Tiniifan commented 1 week ago

Hello.

I've analyzed the problem of abnormally large file sizes after the export process, it seems that the XMTN exporter exports frame by frame for each bone, it doesn't ignore empty frames or bones that have no motion data. Example: if you have an animation with 1000 frames and 30 bones you have 90000 data (1000x30x3, 3 represents location, scale and rotate). This problem will be fixed in the next update (it was already planned to update the XMTN).

However, this problem may not solve your problem about the game being corrupted, because even if the files are heavy, your file isn't heavy enough to oversize the game memory, this problem comes from the tool you use to replace your files in the .fa which tends to corrupt .fa files for no reason after many modifications.

Thanks for reporting the issue, I keep the issue open until it's resolved in a future commit.