lushen124 / Universal-FE-Randomizer

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

FE4: Unlock Erin's class options #247

Open karavalenge opened 4 years ago

karavalenge commented 4 years ago

I know that you don't typically do this for flyers, but I do like to see some variety in the characters when possible. I tested out what exactly is possible for Erin, Fee/Femina, and Altena and here are my findings:

There are two types of movement events that we need to look at. One where the character data is not loaded and the character moving on the map is just an image, and the other where the character data is loaded and the character must follow the rules of the game to move.

All of the images shown here are from a hack I created that made everyone into a Mounted Unit, and also gave Mounted Units specifically the ability to move over Peaks (Not Cliffs) in order to visualize what is necessary for the game to not crash.

FE4 Master Knight099

FE4 Master Knight100

Here are two pictures of Altenna moving over Cliffs despite not being able to, this is due to her event here being with an unloaded character. (End of ch 8 and start of ch 9)

FE4 Master Knight110

FE4 Master Knight111

This event however (Leif talks to Altenna - ch9), she specifically goes around the cliffs despite it taking longer because her character data is loaded in.

In order for a character class to be usable, all events they are involved in where their character data is loaded must begin and end on tiles they can move to. (And tiles between that invoke movement, but that's not necessary to look at for this.)

The only character this can change is Erin(ys).

In Ch 8, Altenna must arrive here or the game script will break:

FE4 Master Knight097

Unknown if it causes a crash, but her being unable to also go attack the home castle in Ch9 will cause more issues. It's not worth it to get into changing her class with so many potential issues even if it is plausible.

In Ch 6, Fee loads in from the west side of the map on top of a Peak:

FE4 Master Knight083

FE4 Master Knight084

FE4 Master Knight085

As soon as she spawns in, she must be able to move over Peaks or else the game will crash.

In comparison, here is Erin's events in action:

FE4 Master Knight011

Four(Five?) copies of her image come in from off screen and move over Cliffs, something she can not do. That means this event is with unloaded data and will always play out this way.

FE4 Master Knight013

FE4 Master Knight014

Regardless of what they looked like, her troop is now loaded correctly separate from her. She starts next to the castle and moves downwards immediately. Notably, her troop spawn on top of the Cliffs, so they must be fliers even if she isn't.

FE4 Master Knight015

FE4 Master Knight017

FE4 Master Knight018

She will then come and sit by the gate until you take the second to last castle (Her troops kinda flutter about nervously, but they won't go too far from her), afterwards:

FE4 Master Knight019

She moves south to meet your troops. No events broken. Peak/Cliff movement not required.

I probably put way too much effort into this, but it was fun to do.

lushen124 commented 4 years ago

This is really interesting! Admittedly, I took a relatively sledgehammer approach for fliers, which is to say, they must remain fliers unless they can be verified to not break any scripts. I just assumed Erinys would have to move over mountains, but I forgot that those mountain moves are actually not scripted. They're actually done in-game, so as long as she never started on a flier-only tile (which she conveniently doesn't), there shouldn't be any problem for her to pathfind her way to your home castle on land.

I'm open to the idea of unlocking Erinys from flying only, but it does have the potential to violate some of the other rules for Fee (and somewhat by extension, Femina). Maybe I can add it as an option.

Enaluxeme commented 3 years ago

1 year necropost, I know, but I have a question: would it be impossible to just... Move the characters away from peaks? What if you just change the tiles where fliers spawn to? As we saw, it's not needed for Eryn, but can't Femina just spawn exactly where the event stops, next to Arthur? If she has to start from the border of the map, perhaps you could turn all tiles directly left of where Femina and Arthur start to plains. It will look weird to have the mountain brutally cut, but it won't really impact the gameplay so I say it's worth it.

I get this is more work, but I figure that when people play a randomized game they actually want their characters to be randomized, you know?

karavalenge commented 3 years ago

For Fee/Femina, I imagine that the simplest way of allowing her to be anything is to draw her movement path out of the map and turn it into walkable tiles, yeah. I don't know how this game handles events, but from what I recall she spawns on top of unmovable terrain directly, and her event is also the one that spawns Arthur, as soon as she has finished moving. Changing the event itself would probably be messier, but anything is possible.

But with Altenna, giving her paths would let the player go straight to the end and break the whole chapter. It may be possible to change her class and not crash the game, but would require some experimenting. I'm pretty sure I have a vague memory of someone changing her class and she waits down by the second-to-last castle while trying to move towards your HQ, similar to how Eryn waits on foot. I never tested if she crashes the game in Ch8 by being unable to sit on Peaks.

lushen124 commented 3 years ago

It's not a problem that it's more work, it's only a problem if it causes other issues. 🙂

At some point, I would like to explore modifying chapter scripts to unlock some of these characters from their restrictions, but I currently prioritize game coverage above it. If you feel this is more important, then we can explore this for the next release (hopefully 1.0, which is when FE10 is supported). Fliers from all the games would benefit from this change due to how they are currently treated universally unless whitelisted. At the moment, this also includes bosses, which is the other thing that would be freed up.

That said, while I have some idea of how to do this for GBAFE and FE9, I'm unsure of how FE4 chapter scripts work or where they are located. I do have Lamia's FE4 docs to reference, but I haven't confirmed that I understand what's going on yet, so it would take some more research.

Vennobennu commented 3 years ago

There is another solution to avoid units spawning/moving to unreachable tiles locking up the game (at least for GBA), and that is to reduce the movement costs of such tiles from 255 to, say, 50. Doing this for Peaks, Cliffs, Sea and Lake terrain types should be sufficient. A tile is only considered totally unreachable for a class if its movement cost for the class's movement type is 128 or greater. Otherwise, the unit can freely move on them during cutscenes even if they remain practically untraversable.

This would have the side-effect of allowing units to be Dropped on any terrain so modified, since Drop does the same "is it 128 or more" check to see if a unit can be dropped on a tile. That would probably open up some skip strats, but maybe it's worth the price?

lushen124 commented 3 years ago

Interestingly enough, the approach of reducing the movement cost over impassable tiles to something high, but not 255 is what my old randomizer used to do. I wasn't particularly satisfied with that solution, and it also had some other benign, but funny looking side effects where the scripted movement started going nuts. Dropping people in walls was one of the main issues that it highlighted, which I felt was too big of a breaking change. I felt that being able to shift their starting position or redefining their scripted movement route was a better solution, but I haven't done the code plumbing yet to intelligently handle chapter scripts for GBA in the new randomizer yet. Honestly, this doesn't really need an intelligent solution. I just need the binary deltas to apply in the case the character is a land unit. As far as what the characters that are currently restricted are:

FE6

FE7

FE8

To be back on topic for this thread, FE4 locks Erinys, Altena, and Fee/Femina. It sounds like Erinys can operate without the restriction, but Fee cannot without changing her starting position and/or move. Since the two are at least loosely related in most options, Erinys' class is locked anyways but could be unlocked if Fee/Femina's starting location can be modified. Altena's lock is due to some more complex mechanisms as pointed out above. As I said above, I have yet to look too closely through Lamia's FE4 docs, so there might be ways to adjust the script to unlock all of these characters.

To go back off topic again, FE9 locks all originally flying classes to other flier classes. Most of this is because I haven't experimented with how land units deal with being spawned over air or other impassable terrain. From what I've seen though, FE9 seems to be weirdly accepting and forgiving of a lot of weird setups (once I fixed all of the syntax issues in the files), so maybe I'll just disable that check and see what happens to Jill or Haar.