rufaswan / Web2D_Games

2D Games playable on the web!
https://rufaswan.github.io/Web2D_Games/
GNU General Public License v3.0
24 stars 6 forks source link

about switch vanillaware games .mbs file convert #12

Open Cloud2333 opened 6 months ago

Cloud2333 commented 6 months ago

Hi, rufaswan! I'm sorry to bother you, I followed the tutorial to try to convert the file, but the .quad seems to have some problems and is a little different from the example you sent. The converted .quad file also won't play properly. I don't know which of my steps is wrong so I want to ask for help. QQ截图20240310010404 Here is a screenshot of my steps. QQ截图20240310010811 Here is the file I converted. https://mega.nz/file/rBdx1YII#GAsi2bebJkjMXhMiwIi2KeLxMY3Tcn_FQOLmUACULLI I'm not good at English, please forgive me.😵

Cloud2333 commented 6 months ago

The test bg was successfully run in the game, and .BBS is the file that truly controls the background. Such as light source, ground reflection, shadow settings. QQ截图20240319020342 And I also modified the .BBS of test bg so that it loaded incorrectly and got another image of rim light. 222-423d-b48a-b03b5c40f88a So the parameters of rim light may indeed be stored in .BBS (I'm not sure, just guessing)

There is also an interesting discovery here. When the character is in the snowy background, there will be a huffing animation. QQ截图20240319004530 The texture of the huffing animation actually comes from "Battle_Effect00", but all BBS does not specifically set up the MBS to use this texture. In other words, all BBS will use this MBS in some way. But I think the BBS of snowy background seems to have a special setting, and can also set the huffing animation to the character's head. QQ截图20240319032302 QQ截图20240319033246

Cloud2333 commented 6 months ago

In order to prove my conjecture, I made some special file modifications. I replaced the texture of the test bg with GB. The light source of the scene settings, ground reflection, shadow settings, and rim light still work normally. By the way, BBS is also related to the background switching time and weather in the game. QQ截图20240319132719 After that I disabled the MBS of test bg and got the same result. The reflection is still there, although it is somewhat unclear. QQ截图20240319134857 And I discovered that the shadow settings and reflection settings are actually the same. QQ截图20240319132919333 The settings of the shadow are the deformation and angle adjustment of the reflection settings, a black mask is added, and a transparency gradient is added at the end of the shadow.

And thanks again to the big bad guy Galerius, the only guy who can jump out of the screen and attack at the maximum range, for telling us that the shadow setting is fixed at one position and will not change with the change of the character's Y-axis position. QQ截图2330240319133529 Fortunately, Galerius is a special guy, otherwise there is no way to prove many things. 😋 I am motivated to do these things because I like this character very much. If Unicorn Overlord didn't have this character, I definitely wouldn't have done so many tests and investigation. 🤔 I think this is all I can do to analyze BBS.

Cloud2333 commented 6 months ago

This is an example diagram of how "Reflection" and "Shadow" are implemented. GB mod is helpful at this time.🫠 If they could render in real time, there shouldn't be this weird perspective error. Of course this is my speculation and may be wrong. 😂 55555 666666

rufaswan commented 6 months ago

Very interesting! Can the position for the texture for huffing animation be changed by loading different character, or is it a fixed position on BBS?

Well, 2D is just a flat image. It do not have any volume in space to generate a correct shadow. The perspective error seems correct to me, Vanillaware must have hide it very well if nobody notice it

Nice work for testing these things! :thumbsup:

Cloud2333 commented 6 months ago

The huffing animation of each character is different. This is the huffing animation of Galerius riding a horse. QQ截图20240319004614 This time the huffing animation is set on the horse’s head. And this is the only character that will play huffing animation twice. This is why I say Galerius is special.😂 By the way, if the weather in all scenes is "raining" or "snowing", the huffing animation will play. However, there is an exception. In this scene, Galerius was not exposed to the rain, so the huffing animation was not played. QQ截图20240319221835

rufaswan commented 6 months ago

I'll need to find this data then. I think it is also how the body connect to the head (headless update), how the character can swap different katana in Muramasa, or how a character "grab" an item or even another character (throw attack).

Thanks! ;)

Cloud2333 commented 6 months ago

I can't help you with the technical part. It would be great if these tests can help you confirm the information. I will look forward to the day when QUDA PLAYER will be improved.

Thanks again for your efforts! 😽

rufaswan commented 6 months ago

That's fine. Thank you for sharing your discoveries too! That gives me some ideas to identify those unknown data actually are.

Let me know if you can find anymore interesting things from "playing around" the game! :rofl: :

Cloud2333 commented 6 months ago

I think I will take a break first and then write a files investigation report in Chinese. I'll let you know if I find anything more interesting. 😂

Cloud2333 commented 5 months ago

I re-did some investigation when writing the report in Chinese.

In fact, OTM first appeared in 13 Sentinels. QQ截图20240324144845

In Unicorn Overlord, BBS is a new file that appears for the first time. In addition to being responsible for the complete loading of the background, the BBS can also set the area and priority of partial texture loading. 42 44 46 41 43 The textures used to mask characters and the ground of background in the forest are from "komorebi" , and it only takes effect on characters and ground areas. If the character or background are not loaded, the mask will not take effect. 47 This is the effect of replacing "komorebi" with GB, the green range is the range where this texture takes effect.

By the way, the switching function for different weather and different times also relies on BBS. BBS is also responsible for the play of environmental sound effects in different scenes. And the BBS will give the character's OTM information about the background, allowing the OTM to correctly play the footsteps sound effects of the current background. 50 The footstep sound effects played in these three backgrounds are different, and the play of the footstep sound effects depends on the character's OTM.

I also did some investigation on the system for switching colors. I changed the FTX and MBS of all characters to Galerius', and used their color switching system to change the color of Galerius. I also specially prepared Galerius obtained by modifying the save data. Used to compare with the color changing system obtained by modifying FTX and MBS.

Since the screenshots are all in Chinese, I won’t post comparison pictures. But it’s probably confirmed that the color-changing system relies on the MBS of the character, and MBS needs to be used as an index to change the color of the character’s parts. Because, with the color-changing system obtained by replacing other characters' FTX and MBS, the parts where the color is switched are different every time. Some can even change the color of the horns on Galerius' helmet. 🤣 So I think MBS provides the index of the parts in the texture to achieve color change.🤔

Another interesting discovery here is that none of the characters appearing in the game GUI have rim light set. Because the GUI does not have a corresponding BBS. 🤔 This may be one of the evidences that rim light is stored in the BBS. 11111

rufaswan commented 5 months ago

Implemented a QUAD keyframe debugger

quad v0.5

Start to have some ideas what it is doing. 0,0 is the base for all sets. 1,0 is armor 1 set (with sheep horn). 4,0 is armor 2 set (with cow horn). 2,0 is helmet-less set.

When talking, 2,1 is for the mouth, so it works together with 2,0.

Still playing around to discover things with it atm. :)

Cloud2333 commented 5 months ago

What a genius idea. If can select the layer that needs to be loaded, this problem can indeed be solved.

Cloud2333 commented 5 months ago

Regarding OTM, there are some things I forgot to mention. This time you can customize the voices of the recruited characters. There are 6 styles of male and female voices, and each style has 3 branches. So there are 18 optional voices in total. 11 So there are 18 male and female OTMs with MOB mark each. Regarding the numbering of character voices, I can use Giethe as an example. 12 "11035" is Giethe's character number, "11" is the voice used when he dies, and "12" is the voice used when winning. In the corresponding state, the game will randomly play one of these three voices. Because some characters have a lot of actions, "11" and "12" may not follow the above rules. Galerius' "22" and "23" are both the voice used when he dies, and "24" is the voice used when he wins. As for the play time of the voice, I think it is probably a certain key frame of the action, and the sound effects are also played based on the key frame of the action.This is also the reason why OTM is related to MBS.

There are also supplementary instructions for the color changing system. 16 I think you know that the texture used for dialogue is different from the texture used normally, and the MBS is also different. But after you change the color, the color of both textures will change. In other words, the two MBS have created the same index for the texture parts. If you compare the two MBS, you may be able to find something.

I also played with the QUAD keyframe debugger a little bit, interesting stuff. QQ截图20240327202644 QQ截图20240327202844 The markup is also easy to understand and works perfectly whether it is a normal character texture or an ICON.Will the new QUAD PLAYER also add zoom function? This function is very useful.🫠 Thanks again for all your hard work.😽

rufaswan commented 5 months ago

It is reasonable to assume they saved the custom colors for each character, so their normal, cutscene, and icon will all share the same appearance. So the set_id also need to be the same.

QUAD PLAYER already has a ZOOM function, but it is AUTO. It will enlarge any sprites that are too small, like NDS Kumatachi. It will also auto-adjust when you turn your phone from portrait to landscape.

And ZOOM is also on EXPORT option too. You can manually adjust it from 0.1 to 10.0.

Thanks for the feedback!

Cloud2333 commented 5 months ago

In fact, ICON is not the same as the other two. The colors replaced by the other two color-changing systems will not be used on the ICON. Even if the character controlled by the player changes color, it will still be blue. This is to distinguish it from the enemy's ICON. The NPC's ICON can be green or yellow.

With automatic zoom, some characters are still too large and will exceed the display range. Although the browser's custom zoom can be used to display them completely, It might be better if a manual ZOOM button can be added on the basis of AUTO. Everyone’s screen zoom level and resolution are different, so they may see different things. QQ截图20240327232508 QQ截图20240327232517 But will this conflict with EXPORT’s ZOOM?🤔

rufaswan commented 5 months ago

Nope, AUTO ZOOM and EXPORT ZOOM are different things. AUTO ZOOM uses canvas size to calculate the ZOOM level, EXPORT has no such thing. I guess there are some logic error somewhere...

Let me look around.

rufaswan commented 5 months ago

Messing around with other files, I can confirm those set IDs are actually bitflags, and they existed since PSP Grand Knight History. So the values are always 1, 2, 4, 8, 0x10, 0x20...

Then PS4 13 Sentinels onward, it has multiple bitflags, like 0x9d, 0x1f. Need to investigate.

That game also start to use set sub-ID, and that are also bitflags. Sets are now in 2,0 2,1 0x10,1 0x9d,0x10 0x1f00,0x80...

Custom color ID existed since VITA/PS3/PS4 Odin Sphere remake. Weird.

Hmmm... I think I have enough data to work on QUAD PLAYER v0.5 already. Just need to confirm some details.

Stay tuned!

Cloud2333 commented 5 months ago

Forgot to replace the character's texture with GB, looks interesting. 🤣 The BOX that sets the texture is completely discolored. Now I can say that the correlation between color changing system and MBS is 100% . 😂 QQ截图20240330230919

Rim light range, here are some interesting pictures too. QQ截图20240330231710 QQ截图20240330233254 QQ截图20240330233605 QQ截图20240330233621 Different scenes have different thicknesses of highlighted edges.🤣

If want to further investigate the color switching system, you may have to look into "eboot.bin" (PS4) or "main" (Switch). Anyway,I will put the link to eboot.bin and decompressed main file here. https://mega.nz/file/7REVVBKa#s051La6FXCdsD6ARsUlDcwzL96T1Emv03Z3zAxEgELA

Cloud2333 commented 5 months ago

I suddenly realized that the animation of "Battle Effect" is almost bound to a certain part of the character, just like the huffing animation.

BBS does have a lot worth investigating. 🤔

Cloud2333 commented 5 months ago

The 0.5 update is really interesting. I didn’t expect that even the color switching system has been completed.You are so awesome. 🫡 And the problem of being unable to export images before has been solved this time. (Although due to some restrictions, the number of exported frames seems to be limited, but setting different starting frames and exporting several times can solve the problem. )

555 (In the game, the coat of arms on the shield can be customized, the related textures are in the "CoatOfArms" folder, and the color of some textures can be customized with RGB specifications. The "coat of arms" in the character FTX is probably similar to a placeholder and provides resolution information. )

The ZOOM problem has also been solved, and there will be different ZOOM levels for different actions. QQ截图20240404023112 QQ截图20240404023258

As for the texture's lightness and darkness being recognized as transparency, and the issue of seams with gradient transparent textures, there's actually a simple solution. 00000011 Copy the exported texture layer and then overlay it. This is the best solution at present. 🤔 However, this is just a method of manually repairing it with PS after exporting the texture, which may not be very helpful.

There are actually new problems. To be precise, they existed before. It should be a problem with QUAD. 🫠 Because ZOOM has been repaired, I can record it directly.

ezgif-7-1c0ebb4cf2 BlackPrince_HG_M00 / D_WALK_B1 [LOOP] [MIX]

ezgif-7-b3c5595664 BlackPrince_M00 / D_WALK_B1 [LOOP] [MIX]

ezgif-7-11ead500a2 BlackPrince_M00 / D_LAUGH_B [MIX]

ezgif-5-f4916324e1 BlackPrince_M00 / VICTORY_3 [MIX]

ezgif-2-28d4b30d47 FeatherShield_M00 / GUARD [LOOP] [MIX] (The same situation applies to COVER_A2 [LOOP] [MIX] and COVER_B2 [LOOP] [MIX] )

ezgif-2-2e81f47b8f FeatherShield_M00 / COVER_D1 [LOOP] [MIX]

Some parts can't keep up with the action, keyframes don't move correctly when performing actions, some weird parts move, and keyframes appear early? 🫠

"FeatherShield" actually has some interesting things. This guy has a mysterious "circle". This "circle" exists for most actions. QQ截图20240404035039 QQ截图20240404035147

The sword and shield don't appear, and the "circle" disappears as well. QQ截图20240404035438

I don’t understand why I find some weird things every time. It seems that I will bother you for a while longer. 😂

rufaswan commented 5 months ago

That was quick! I keep forgetting stuff so I have to remove the v0.5 tag for a few times. Did you got any annoying notifications from it?

BTW, the export code is untouched. Most likely you have freed some memory somewhere, so it works. On Firefox about:config, javascript garbage collection (javascript.options.gc_delay) is set at 4000 milliseconds. Try wait 4 seconds between every export to see if it helps.

So far, as you know, QUAD PLAYER only opens a MBS+FTX set. Support for "CoatOfArms" FTX would be the same for support for multiple QUAD (Headless update), it will be for v0.6 or later.

Animation are something we still looking a way to debug. It can have fade in/out, motion blur, nearest/linear/cubic interpolation, etc. So far the only I done it is run the game at 0.5x speed and record a video of it, then compare it frame-by-frame with QUAD PLAYER.

There are different alpha blending modes too. I only put in Normal. It can also be Logic Op instead. If you noticed something went missing, try turn back to LINE mode to see if there is a quad there. Not sure if we can even figure out these blending modes by just looking at screenshots.

The errors for FeatherShield_M00, those can be afterimage effects. like from Symphony of the Night. Not sure. Can you record an in-game video for comparison?

It also seems Vanillaware turn ON interpolation / keyframe mixing by default, so the meaning of ON/OFF are now switched. That's probably why the keyframes doesn't move. Not sure when did Vanillaware changed that.

In any case, I'm going to make an announcement post, then take a break.

Thanks!

Cloud2333 commented 5 months ago

Well, although the code in the export part has not been adjusted, I didn't do anything. In short, the problem was solved. As for the "circle" of "FeatherShield_M00", that actually has nothing to do with the texture. It will exist even if the texture is not loaded. QQ截图20240404195223

The error of "FeatherShield_M00" is not an afterimage effect. ezgif-3-6f7f14a517 However, sticky frames seem to only occur when switching from one state to another loop playback state. 🤔

As for notifications, only the replies to the issue will be sent via email. I won't receive reminders for other things.

Cloud2333 commented 5 months ago

Let me talk about some other discoveries here. In fact, the actions played by QUAD PLAYER have more key frames than the number of key frames in the game.

ezgif-5-ec685adfce In-game example

ezgif-1-02df6df349 My imitation example

ezgif-2-b0602d924b Full playback example of exported image

ezgif-7-1a5d5d0f83 Comparative example

For the movement of the legs, there are actually 3 frames of images that are not used. 🤔 Thinking about it this way, it seems that the previously mentioned parts didn't move correctly just because that parts was only set to the keyframes used by the game. 🤔

Cloud2333 commented 5 months ago

I probably know the reason why the QUAD PLAYER playback some action suddenly becomes smooth. 🤔 I’ll use some of Armoria_HG’s action to give some examples.

ezgif-7-0233bc34fd D_LOOK_IDLE_B1 [LOOP] [MIX] ezgif-3-0609efe7dc D_LOOK_IDLE_B2 [LOOP] ezgif-7-61f423c3e7 D_SIGH_B [MIX]

When the first picture enters the IDLE state, there are more key frames, while the second picture is in the IDLE state and plays fewer key frames. The reason is also very simple. The IDLE state of the first picture does not involve texture replacement in the BOX, only simple movement and deformation. The IDLE state of the second picture involves texture replacement in the mouth BOX. In order to match this type of sequence frame texture, some actions will not be played. The sighing action is actually very easy to understand. The initial eye-closing action lacks key frames. The inhaling action does not involve BOX texture replacement, so the number of frames is higher. The mouth-opening animation lacks key frames. The exhalation animation does not involve BOX texture replacement, so the number of frames is relatively high. The final eye-opening animation involves BOX texture replacement, so it lacks key frames.

High-fluency animations are basically only applied to GUI types. Because Galerius does not have sequence frame textures for opening and closing eyes, opening and closing mouth, many actions have more key frames. (Damn, this guy is really special. 🤣)

ezgif-2-22c6ae244f However, the lack of keyframes seems to only apply to the sequence frame texture of certain parts of the character. The sequence frame of this character's cape switch has no impact on the number of keyframes for the character. 🤔 There are also cases where the character opens and closes its mouth, but other parts still move smoothly. Still need to investigate to get more information.

Because I completed some file batch processing methods last night, even if the processing script is updated, all files can be immediately converted into a format usable by QUAD PLAYER. I will check the movements of all the characters during this time to find some interesting things. Once all the characters are confirmed I will summarize the useful information. 😶‍🌫️

rufaswan commented 5 months ago

Hey Cloud2333! It has been a while. How are you doing? Any update?

Thanks for your hard work! :+1: :100: :1st_place_medal:

Cloud2333 commented 5 months ago

In fact, I was working on my graduation thesis during this time. However, I have confirmed some special things that I can explain first. 🤔 ATTACK_B1  LOOP   MIX cATTACK_B1  LOOP   MIX ElfArcher_F+ElfArcher_M / ATTACK_B1 [LOOP] [MIX] The bows and arrows have the wrong layer priority and are placed in the wrong position. (By the way, the bow strings are rendered in real time.) VICTORY_1  LOOP   MIX ElfArcher_M / VICTORY_1 [LOOP] [MIX] Thrown weapons did not rotate correctly and instead shrunk. QQ截图20240409232412 QQ截图20240409232524 Cleric_F+Cleric_HG_F When playing animations for these two characters, the facial textures will be loaded incorrectly and the priority of the facial textures will become higher. QQ截图20240410005601 DarkMarquess_S_M This guy's shield is problematic in most of his moves. Huscarl_M also has the same problem. As for the sudden abnormal movement of part textures, I will explain that at the end. This happens with certain actions of some characters.🤔 In fact, there are still some detailed issues that I think I will explain in detail at the end. It is a bit difficult to explain without using dynamic images.

Here is an investigation into some missing keyframes for playback actions. QQ截图20240417221555 The blue areas are all the frames the game has not actually used (note: sticky frames also count). Taking 0 as the initial frame number, 0 stalls for 4 frames, 4 stalls for 4 frames, 8 stalls for 7 frames, 15 stalls for 7 frames, 22 stalls for 7 frames, and 29 stalls for 7 frames. QQ截图20240417222157 This action is relatively special, using a keyframe every 6 frames, and setting a special number of playback frames for some keyframes. (36 only uses 2 frames.) If you only use these keyframes to compose the animation, there will be no particularly outrageous component position errors. QQ截图20240417222718 And this action uses a keyframe every 3 frames.

Because the survey samples are relatively small, it is impossible to give an accurate conclusion, but skipping unnecessary frames does exist in the game, and it will give different stall frames to the actually used keyframes. 🤔 If you see animations that suddenly play smoothly in QUAD PLAYER, that is not the actual performance of the game. 🤔

rufaswan commented 5 months ago

Good luck for your graduation thesis. Feel free to take some time off to focus on real-life stuff. I'll still be around when you come back.

Looking at your animation timeline, I wonder can you compare the animation data within .QUAD file to see if you figure something out from there?

And since keyframe has its own debugger, I think I can make another debugger for animation. Will have to put some more thought about designing it.

Thanks!

CarlosPerson commented 5 months ago

GB (Green Background) mod is just made for fun.😶‍🌫️ In fact, the way to make mods now is to mount an external cpk, which the emulator can easily do. (...)

Hey Cloud2333, you guys have made an amazing job with this project. Impressive! Since you mentioned this, I wanted to ask you a quick question.

I am trying to make a "simple" mod that disables the "battle outcome" UI in the game (it spoils the result and I want to hide it/make it transparent). Rufaswan here very kindly hinted me towards using the emulator's texture replacement feature for that.

After some investigation, I understand how layeredfs works. However after unpacking the game CPK, the assets are not in a standard format and I've not found a way to open them yet - let alone modify them. It's likely it's the file at TOC/GUI/Interface_Battle_00.ftx but I'm not sure.

Since you have tinted the background of the game Green, could I ask you how you did that? Hopefully I can tint this specific UI transparent, or even black.

Thanks a lot and best of luck for your thesis!

Cloud2333 commented 5 months ago

GB (Green Background) mod is just made for fun.😶‍🌫️ In fact, the way to make mods now is to mount an external cpk, which the emulator can easily do. (...)

Hey Cloud2333, you guys have made an amazing job with this project. Impressive! Since you mentioned this, I wanted to ask you a quick question.

I am trying to make a "simple" mod that disables the "battle outcome" UI in the game (it spoils the result and I want to hide it/make it transparent). Rufaswan here very kindly hinted me towards using the emulator's texture replacement feature for that.

After some investigation, I understand how layeredfs works. However after unpacking the game CPK, the assets are not in a standard format and I've not found a way to open them yet - let alone modify them. It's likely it's the file at TOC/GUI/Interface_Battle_00.ftx but I'm not sure.

Since you have tinted the background of the game Green, could I ask you how you did that? Hopefully I can tint this specific UI transparent, or even black.

Thanks a lot and best of luck for your thesis!

In fact, if you cannot edit MBS, there is no way to prevent the battle results from being displayed. QQ截图20240418172624 The damage numbers for this interface come from the font file "ManofaFont", which is also the font used for the title screen. The most important thing is that the texture of this interface is almost actually a part of the "Interface", and the HP bar is actually rendered in real time by the game. Even if all other parts are replaced with transparent textures, the HP bar will still exist. QQ截图20240418213200 (It’s troublesome to modify the file, so I just made it a 0kb file.)

CarlosPerson commented 5 months ago

So if I understood correctly, even if I modify the MBS I won't be able to get rid of the health bars.

That's bad news - then I guess the only other way to go about it would be to modify the code so that this UI is not opened in the first place. I will mess around and try to do that, but I feel like my chances are getting low. For starters, the scripts are binary .ASB files and I haven't found a way to open them. If you know about any way to read these I would greatly appreciate it :)

Cloud2333 commented 5 months ago

So if I understood correctly, even if I modify the MBS I won't be able to get rid of the health bars.

That's bad news - then I guess the only other way to go about it would be to modify the code so that this UI is not opened in the first place. I will mess around and try to do that, but I feel like my chances are getting low. For starters, the scripts are binary .ASB files and I haven't found a way to open them. If you know about any way to read these I would greatly appreciate it :)

That's not my area of ​​expertise, so I can't give an opinion. 🫠

CarlosPerson commented 5 months ago

No worries, thanks a lot! I'll report back if I discover something.

Cloud2333 commented 3 months ago

Now that I have dealt with those troublesome things, here are some other interesting things. 🫠 QQ截图20240527173404 Ryujinx actually has a version that can export game textures in real time, and also allows real-time editing of textures. Although this function is still imperfect so far, it can also be used to confirm some things. Because the exported texture has been changed from non-swizzle state, it is also very convenient to edit. QQ截图20240527175144 If you want to use the external CPK method, you need to use switch swizzle to process the texture, then use BC7 compression, and finally use a hexadecimal editor to replace the relevant content. QQ截图20240527180502 Because I don't have a way to convert the normal texture into a switch swizzle texture, I could only use a solid color texture to replace it. 🤣 If rufaswan you could write that kind of script I should be able to do something more interesting. As for BC7 compression, I was able to use texconv ​​to convert the texture to BC7 compression.