Silvris / Magicite

A BepInEx plugin for the FINAL FANTASY PIXEL REMASTERS that allows for the loading of new assets and replacement of existing assets
13 stars 1 forks source link

Battle backgrounds aren't getting replaced #1

Open Gravrain opened 1 year ago

Gravrain commented 1 year ago

Hello! First off, I just want to say thanks for making this tool. It makes replacing assets so much easier than editing bundles directly. I've been porting my graphical overhaul mod to Magicite over the last few days and it's working great so far.

However, in my initial testing, it seems that battle backgrounds aren't getting replaced by the loader. I'm using the same folder structure output by the exporter, and there are no errors in the log, but the changes aren't showing up in-game. I tried deleting the SpriteData file and loading the PNG as a Texture2D instead, but that didn't solve the problem. I also tried both with and without the BgPrefab item in the keys file, in case that made any difference.

For what it's worth, this was also an issue in Memoria IIRC, so I'm guessing there's something funky with how the battle backgrounds are stored/loaded in general.

On a side note, I was also curious about the folder structure contained within each group folder. I initially found the redundant structure a bit inconvenient, as I'd have to enter/exit so many folders just to access the relevant files. Then I looked into using a custom structure instead. I ultimately settled on the following:

I don't really understand how the mod loader uses this structure, but it seems to be working fine so far, and avoids the errors caused by simply placing the files in the top-level group folder. However, I just wanted to make sure there wasn't anything wrong with this, as the preferred structure seems to be the typical Assets/GameAssets/etc. one.

Thanks!

Silvris commented 1 year ago

The thing about battle backgrounds is that they're handled a bit uniquely compared to most of the other assets in the game. They're loaded directly as GameObjects, with the GameObject pulling the texture (completely avoiding all of the places Magicite attacks to load assets). I've been considering options in regards to handling this, and I feel like the best way might be to allow for loading assets from arbitrary AssetBundles, so people would be able to create asset bundles in Unity and then load them using Magicite (doing this in theory should also support editing the games' VFX, but I have no real confirmation on that). What is your opinion on this matter?

You're pretty close on the structure, but the top level is actually meant to be a mod name. Like this

I really need to get around to writing some guides for Magicite here soon.

Gravrain commented 1 year ago

Thanks for the quick response!

I do indeed have a top-level mod folder as well, I just forgot to include it in the diagram. My main point was rather that within each group sub-folder, I replaced the Assets/GameAssets/etc. structure with a single folder with the same name as the group folder itself (using the same folder name across each group caused errors; I'm guessing they're all combined into a single filesystem at some point?). This made it quicker to access the assets by removing all those extra folders, but I wasn't sure if there's any reason to stick with the original folder structure over this modified one. Here's a better diagram of what my structure looks like:

I've also since found that this structure doesn't work for replacing SpriteAtlas assets. For whatever reason, the .atlas file must be in the original exported location, even after updating all of the relevant paths; if it's in a different folder, then according to the log, it messes up the paths that Magicite tries to load from, crashing the game.

As for the backgrounds, I think I understand what you're saying. I'm guessing there isn't any way to edit the GameObjects themselves, or where they try to load assets from? If that's the case, editing AssetBundles instead isn't the end of the world, although admittedly that's what I was hoping to avoid by using a mod loader. I don't have much familiarity with Unity or BepInEx, so I'm afraid I don't have much insight into the problem or any potential solutions.

Maybe I should brush up on my C# and get familiar with the actual code.