lushen124 / Universal-FE-Randomizer

Properly universal this time.
MIT License
98 stars 28 forks source link

GBAFE Character Shuffling #404

Closed Geeene closed 1 year ago

Geeene commented 1 year ago

A long time ago I watched a Let's play series of a Fates Randomizer, where the Yter had randomly shuffled in Characters from other 3DS games, such as Echoes Palla or Awakening Lissa, which I thought was super cool, and was one of the first things that I wanted to add to Yune once I started working with it.

With these changes you can shuffle in arbitrary Portraits + Data into the randomized Rom. For convenience I have already added data files for FE6, 7, and 8, to the resources, but as long as you use the correct format, you can include custom characters too.

For example:

If I include this Json, and have this portrait of Ilyana in the given path next to the Jar file then I can also include a non-gbafe char, like Ilyana. In the UI you can select multiple files, they just all have to be in the same folder.

Folder ----randomizer.jar ----portraits --------custom ------------Ilyana.png

Ilyana Portrait Source 2023-01-08 16_06_19-C__Users_Marvin_Desktop_custom json - Notepad++.

Implementation wise it looks roughly like this (totally not scuffed) Diagramm:

Diagramm Explanation Character Shuffling github doesn't seem to like the svg, here is a separate link: Link

With the Implementation I have added a couple of additional Refactors, such as Making the GBAFECharacterData and GBAFEClassData into a abstract base classes rather than them being interfaces to reduce code dupplication.

Additionally I have moved some of the Class Adjustment / Autoleveling / Item Assignment Logic of the Recruitment Randomizer into a separate Service.

While all of FE 6,7, and 8 have slightly different Portrait Formats, the implementation is generic enough to be able to handle all of them. (The Attributes of each are defined in a their respective PortraitFormat classes)

As the Implementation puts all of the shuffled Portraits into freespace at the end of the Rom, we do use a decent amount of it. Sadly we can't overwrite the Portrait of the original character that we shuffle into (except for fe8) since for FE6 and 7 the Main Portrait is LZ77 Compressed, and as such aren't of a fixed length.

In FE8, since here the Main Portraits aren't compressed, it would be possible to override the original units portrait, but I wanted to keep the handling identical for all.

From my testing this seems to work fine with other randomization options such as Random Classes / Recruitment.

Though there probably are some quirks that need fixing (f.e. if FE6 Lance is randomized into FE8, and you use Random Recruitment, the names of the different Lances, will be replaced aswell.)

There are some edge cases that I have neglected for now, f.e. that there is afaik no useable Manakete class in FE6 and 7, so Myrrh and Fae can't be shuffled into FE7.

As FE6 is missing some Mouth and eye Frames compared to FE7 and FE8, I just copy pasted some segments of the Original Portrait ... so they do look rather uncanny, but I don't have the artistic ability to fix this.

There is currently no logic behind which character will be shuffled into which slot. It's purely random. Certainly isn't impossible to lead to unbeatable seeds.

The Merge request looks a lot bigger than it actually is, since a lot of it is bloat from the FE6, 7, 8 portraits.

Geeene commented 1 year ago

I found a couple more issues to fix before I will put it on review again

lushen124 commented 1 year ago

This is great! I had an idea similar to this a while back, but the sheer amount of work it would require dissuaded me from really pursuing it, but it looks like you did a lot of the heavy lifting here.

As far as free space is concerned, you have up to 32MB to work with, and all three games, to my knowledge, are 16MB or less, so it's unlikely to run out of free space at the end of the ROM. Just gotta make sure all of the pointers that need to point to them are updated.

Yeah, FE6's portrait format is more primitive than the other two, so they don't naturally have blinking animations, but I think that's a small price to pay for the feature. I mean, FE7's lord portraits are already compromised if randomized recruitment is enabled since there aren't any sad or angry faces for any non-lord characters by default, so portraits not blinking is a far less obvious issue.

Geeene commented 1 year ago

This is great! I had an idea similar to this a while back, but the sheer amount of work it would require dissuaded me from really pursuing it, but it looks like you did a lot of the heavy lifting here.

Thanks :) This has certainly been quite a lot of work, so seeing it finally be in a State where it works well makes me very happy.

I'm also especially happy with the fact that this just works with arbitrary portraits, so if players cared to make the configuration files, they could randomize characters from whatever romhack / other game / reduced list of characters from the provided ones.

Though the UI Portion of the custom files certainly can use some work still.

As far as free space is concerned, you have up to 32MB to work with, and all three games, to my knowledge, are 16MB or less, so it's unlikely to run out of free space at the end of the ROM. Just gotta make sure all of the pointers that need to point to them are updated.

Yeah then that really won't be an issue, since it appends the rom by
56 units in FE6 * ~ 7kb per Portrait (though in fe6 it would be compressed), so not even close to 1MB.

Yeah, FE6's portrait format is more primitive than the other two, so they don't naturally have blinking animations, but I think that's a small price to pay for the feature. I mean, FE7's lord portraits are already compromised if randomized recruitment is enabled since there aren't any sad or angry faces for any non-lord characters by default, so portraits not blinking is a far less obvious issue.

I did already make sure that related portraits are all repointed by adding a mapping to the DataProviders

Actually, for the blinking issue, I guess I can use these now that I think of it: Portraits with blinking Frames Since afaik those are free to use. (I'll message the creator just to be sure though)

As said above, I'm gonna fix some more issues that are related to this change, before I put it on review again, those being:

  1. Adding excluded Indicies for Reverse Recruitment Text replacement (so that Lance doesn't change the names of the Iron Lance etc. (though honestly that also has it's own charm lol)).

  2. Since I have no logic as to who can replace which character, I would add CharacterNudges for characters such as Cormag and Farina, since they might be unrecruitable, though Cormag Ch 13 Eirika specifically needs some big changes.

  3. Currently there are no default Palettes for Classes such as WYVERN_RIDER_F, WYVERN_LORD_F, HERO_F, SHAMAN_F, DRUID_F. Alternatively, Characters such as Niime, Vaida, Melady etc. who this would apply to could go into the male equivalents, but I would prefer using the female classes where applicable (even if the combat animation is just the Male one).

Which leads to some NPEs when adjusting the Palettes for the Characters. (MANAKETE_F in FE6 and FE8 also lead to NPEs since the palettes are not loaded by default)

(Which I guess leads to another possible improvement in that currently I don't have supplementary Hair Colors for the characters, so they are purely based on the reference character. But that's not a priority to me right now)

  1. There are also some Autoleveling anomalies like, Douglas randomizing into Knoll, losing a lot of stats, then Randomizing into Seth and having horrendous stats because:

General Promo Bonuses > Paladin Promo Bonuses

and

Gaining -2 Auto Levels since there is (also in the current state of yune) a flat -3 levels for newly promoted units to make them not as broken and Knoll only gets 1 level when Recruitment Randomizing into Seths Slot.

So here I would say to both only apply the -3 when they get more than 10 levels, and reducing the down levels if they get more than 10 levels aswell. Just so they are not as screwed. (or like 70% rounded down which should have similar effects)

  1. Maybe I should downadjust Weapon ranks if f.e. someone like Perceval becomes an unpromoted unit, he currently still has really high weapon ranks.
Geeene commented 1 year ago

alright, I fixed all of the above issues, except for

(Which I guess leads to another possible improvement in that currently I don't have supplementary Hair Colors for the characters, so they are purely based on the reference character. But that's not a priority to me right now)

I'll also still wait till I get a confirmation that the portraits are free to use till I commit those.

Issue 2, the character nudges, got a pretty big enhancement in the process.

Issue 3, I ended up with putting them in the male classes rather than fixing the Female ones, just not enough of a point.

Geeene commented 1 year ago

added another commit with the constant for autolevels, and Text Replacement

lushen124 commented 1 year ago

Do you think we're good to merge? Or were there other changes you want to make?

Geeene commented 1 year ago

Do you think we're good to merge? Or were there other changes you want to make?

I'm double checking, one thing I did notice that I hadn't added the options to the changelog yet, and I didn't actually use the newly added constant, though that shouldn't take long to fix

Geeene commented 1 year ago

should be fine now, I added it to the changelog