Skip to content

Conversation

@leggettc18
Copy link
Contributor

@leggettc18 leggettc18 commented Oct 23, 2023

More bridging of the Gaps between 3drando and soh runtime. Currently the focus has been around seed generation flow. Currently some things are not working, like dragging a spoiler file, so this is marked as a draft.

The idea is going to be that the rando context used during seed generation will also be used during runtime, so that you can generate a seed and go straight into a game without needing to parse a spoiler file first. Spoiler files will also be used to get the seed and settings and use that to generate a playthrough rather than parsing everything. That way hints will be in the user's preferred language (currently only french, most of the hint text still doesn't have german translations I don't think). There will be a plando mode that parses the entire spoiler file though.

Currently in-game is using the ItemLocation table, saving and loading from save files correctly. I've also changed spoiler file generation so that a new seed is automatically generated when making a new save file. This is when a playthrough will be generated from a dragged spoiler file if one was dragged (not working yet, need to set up a place to store the settings and parse only that and the seed from the spoiler first, will be there soon). You can still generate a seed through the ImGui menu and it will not override that one until you make another new save file.

Still need to store the following in the new context:

  • Overrides (Ice Traps and Trick Names)
  • Entrances
  • Settings
  • Hints
  • Merchant Prices
  • Dungeon Quest Type (Vanilla VS MQ)
  • Ganon's Trials

Other tasks

  • Reimplement full spoiler parsing as an option.

Build Artifacts

The parameters were rearranged for easy copy-paste from the GET_ITEM macro calls later on.
Array is all that is needed, since the item list will be contiguous and indexed by the RandomizerGet Enum values.
Up through bottles, many more items still to go.
Also added constructors that put the GET_ITEM_NONE data in for these items, since there is no corresponding GetItemEntry for them.
These are present for GetItemEntry purposes, and aren't really meant to be used in seed generation (unless we find a need for it later on.)
It's now a pointer to memory instantiated on the heap in the constructor. These are shared pointers so the memory is freed if any of the item instances get deconstructed (which they shouldn't but just in case.)
Also replaces calls to the ItemTable method with StaticData::RetrieveItem
This allows importing them without causing weird conflicts in cpp files when importing the z64scene.h and z64actor.h files directly. Now you can just import z64scene_enum.h and z64actor_enum.h instead. The two old files also import these new files so that existing setups still work as expected.
@leggettc18
Copy link
Contributor Author

leggettc18 commented Nov 2, 2023

I'm going to mark this as ready for review now. There will be some cleanup that I want to do and will start on it soon, but in the interest of not inflating this PR further and keeping future PRs smaller, I will do that on another branch. If review deems any of those cleanup changes necessary for merging then I will merge those changes into this branch instead.

EDIT: net deficit of 2000 lines of code is pretty cool though.

@leggettc18 leggettc18 marked this pull request as ready for review November 2, 2023 16:33
@leggettc18
Copy link
Contributor Author

Brief summary of changes:

  1. Seed-gen flow changes: Making a new rando save generates a seed with whatever the current settings are, unless a seed has been generated through the Randomizer ImGui window prior to that. If a spoiler file has been dropped onto the window, the seed and settings from that will be used to generate a new seed, rather than the entire spoiler file being parsed. Due to changes I needed to make, currently there's no way to regen a past seed from a spoiler file on console, although that can still be done by manually ensuring you have the correct settings and input the same seed string.
  2. All that goes out the window with Plando mode, where the entire spoiler file is parsed when a spoiler is dropped, and that information is used to init the save file, no seed generation required.
  3. Options/Settings, Hints, Dungeon Quests, Trials, Entrances, Item Overrides (Ice Traps, Trick Names), Prices have all been moved/merged into new classes and containers under Rando::Context, similarly to Items and Locations before them. This does not result in any functional changes (or at least if they do, it's a bug) but does result in less code on our end since the same structures/objects are used for our code and 3drando code. The remaining code in the 3drando folder was only ever used during seed generation and is not shared with runtime like everything else was. It will be relocated as well eventually but for now it's not really doing any duplicated work like everything else was.

@leggettc18
Copy link
Contributor Author

I resolved the merge conflicts and confirmed it builds (at least on Windows) but have not had a chance to playtest the Master Sword related settings to make sure that works with my other changes.

@leggettc18
Copy link
Contributor Author

I playtested last night, Master Sword Shuffle seems to work just fine, but I think there might be some bug with Warp Song hints specifically? It keeps telling me "a mysterious place" even though I'm fairly certain I turned them on.

@leggettc18
Copy link
Contributor Author

Figured it out. Checkbox defaults to checked while cvarSettings array (which is still in play for now) defaults to RO_GENERIC_OFF. So the box was checked but the cvar didn't update right away.

@leggettc18 leggettc18 merged commit 2698d45 into HarbourMasters:develop-rando Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants