Lincoln-LM / swsh-mods-exl

exlaunch-based Pokemon Sword and Shield mods
GNU General Public License v2.0
10 stars 3 forks source link

Overriding max spawns on other spawners (outside of Glimwood) #8

Open FrostedGeulleisia opened 2 weeks ago

FrostedGeulleisia commented 2 weeks ago

More of a question/request than an issue. Since we have an option to override the spawn counts of spawners in Glimwood Tangle, would it be possible to do the same for every other spawner in the game? At least the ability to bring their spawn rates to those of the base game Wild Area. Some parts of the game, especially DLC areas, have a noticably lower amount of spawns on average compared to the base Wild Area, making them feel much emptier. And it's even worse in some other base game dungeon areas.

Lincoln-LM commented 2 weeks ago

you could modify the spawn cap of any spawner yes but if the reason for less spawns is a lack of spawners rather than lower caps then that is not as easy to fix

FrostedGeulleisia commented 2 weeks ago

just wondering how difficult actually modifying all the spawners' caps is, considering i couldn't find anything in pknx that would suggest modifying the spawners' properties directly (just the encounter tables, which i want to leave vanilla)

Lincoln-LM commented 2 weeks ago

just wondering how difficult actually modifying all the spawners' caps is, considering i couldn't find anything in pknx that would suggest modifying the spawners' properties directly (just the encounter tables, which i want to leave vanilla)

modifying this via romfs would entail editing the placement data for what pknx labels PlacementZoneSymbolSpawnHolders and would probably have to be done manually using the flatbuffer schemas it provides as it seems to be able to dump the information but not edit it. the glimwood mod does this by checking a list of known spawners (those in glimwood) and setting the max spawn count as the spawner is initialized in memory. if pknx's placement dumps list the spawner hashes (it should) and you can find in that list which ones you want to modify it would be trivial to do what the glimwood mod does. you could also accomplish this by setting all spawners' max spawn count to some number you deem fitting or even conditionally replace all spawners with a cap of X to a cap of Y.

FrostedGeulleisia commented 2 weeks ago

been trying to build it to see if my idea even works, but no matter what it can't find flatc even though i built it manually just to make sure it is there, not even copying it to related places in this project directory works, is there something i'm missing?

Lincoln-LM commented 2 weeks ago

been trying to build it to see if my idea even works, but no matter what it can't find flatc even though i built it manually just to make sure it is there, not even copying it to related places in this project directory works, is there something i'm missing?

flatc is expected to be somewhere accessible like PATH & is expected to be the same version that swsh-mods-exl includes. cloning the repo with submodules and sudo make installing or whatever equivalent should be good enough to guarantee both expectations. you can reference the commands the CI runs to build if you want to follow something that works. https://github.com/Lincoln-LM/swsh-mods-exl/blob/b05b57f3259aefaf088a84a33d6080fbc2ff2a70/.github/workflows/build.yml#L25-L31 i'm not sure about your specific environment but i've gotten it to build fine on both an ubuntu installation & msys2 on windows

Lincoln-LM commented 2 weeks ago

additionally for more direct help with building/troubleshooting development i can help in the pokemodding discord

FrostedGeulleisia commented 2 weeks ago

okay i think i've got it to work, turns out i hadn't put the binary in $PATH (though, perhaps that part should be mentioned in the readme somewhere for anyone else who wants to try building the mod from source, imo) Though it's quite late here so I'll report on whether or not my idea even works, tomorrow

FrostedGeulleisia commented 2 weeks ago

additionally for more direct help with building/troubleshooting development i can help in the pokemodding discord

stuck at the server limit so, sorry, can't do.

also, my self-built version just, crashes, even if the modified glimwood_overworld hook is disabled in settings. Any clue what that's about? (And before you ask, all I'm getting is the generic switch error message) Yes I know I was about to go to sleep, but I want to at least get it to boot before I do

Lincoln-LM commented 2 weeks ago

additionally for more direct help with building/troubleshooting development i can help in the pokemodding discord

stuck at the server limit so, sorry, can't do.

also, my self-built version just, crashes, even if the modified glimwood_overworld hook is disabled in settings. Any clue what that's about? (And before you ask, all I'm getting is the generic switch error message) Yes I know I was about to go to sleep, but I want to at least get it to boot before I do

  • the build defaults to shield if you dont specify a version so if youre trying to run it on sword it will cause issues
  • trivially, if you can build a functional non-modified version its somehow an issue with your edits (hooks are still injected even if theyre turned off in the settings they just explicitly conditionally check if the mod is active before doing extra functionality). if you cannot then it is somehow an issue with your build process without knowing your edits (if even any are relevant) i can't say for sure but debugging crashes with gdb is doable if you know your way around it.
FrostedGeulleisia commented 2 weeks ago

actually, it may have been it writing garbage data, is there any particularly simple way to hook into every spawner without manually finding the hashes for every single one?

Lincoln-LM commented 2 weeks ago

the function being hooked is the constructor for all EncountSpawners so it is hooking into every single one. a spawner is initialized -> the hook is run -> the hook checks if the spawner is in the list of hashes so that it doesnt modify anything it doesnt want to modify -> if it is then it modifies the spawn cap. if you want to modify every spawner you just remove the check.

FrostedGeulleisia commented 2 weeks ago

i guess commenting out the statement (to easily restore later if needed) broke it, but outright removing it didn't either that or it's some spacing jank either way, it's definitely working now, will report tomorrow on how well this actually impacts the general spawn rates in each area (or rather, if there are any issues in particular areas)