-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Witness: Item loading refactor. #1953
The Witness: Item loading refactor. #1953
Conversation
Co-authored-by: el-u <[email protected]>
This change shuffles around a lot of the item loading and creation logic for the purpose of increasing readability and setting me up to work on the speed boost rework. These changes are fairly extensive, but they've been tested rigorously to ensure that the actual output does not differ at all between the existing code and this refactor. This does not touch any of the logic/location code except where necessary to interface with the item refactor. Summary of changes: - Condensed all fields that stored redundant data into a smaller number of unique lists, replacing all uses of those fields with list/dictionary comprehensions where relevant. - Moved most item generation logic out of WitnessWebWorld and into WitnessPlayerItems. WitnessWebWorld.create_items() now only builds the actual list of items and places specific items on specific locations, with all of the actual item selection behavior happening in WitnessPlayerItems. - Replaced various anonymous data structures with ones with concrete fields, such as ItemData. - Moved filler/trap ratios into WitnessItems.txt and reworked the generation logic to calculate total quantities before creating any items. - Added "joke" item category. Joke items are automatically added to the junk pool.
Refactor + Code quality improvements (Motivation: Make it easier to add new junk items)
Blastron is a new dev for this world (and long-time dev of the client). I approved his changes and asked him to take the lead on the PR process as well :) So please treat him as the main person responsible~ |
thanks for adding the tag, i'll be sure to check those in the future |
# Generate the actual items. | ||
for item_name, quantity in item_pool.items(): | ||
self.multiworld.itempool += [self.create_item(item_name) for _ in range(0, quantity)] | ||
if self.items.item_data[item_name].local_only: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this is not currently being used by anything live. I've tested it locally with my other changes.
Ah shoot, that's right I forgot. My bad. Should have checked my own CODEOWNERS sheet lol.
All good, it's 80% of what I do on GitHub anyway. :P |
Sorry for merging the other PRs first, creating a merge conflict, but they were labelled as fixes. @NewSoupVi can you still review and test, if not done already, and approve the changes (using the github approve feature)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already reviewed, I can approve yes
Altho yeah the merge conflicts will have to be solved ofc
Co-authored-by: el-u <[email protected]> Co-authored-by: NewSoupVi <[email protected]> Co-authored-by: black-sliver <[email protected]>
Co-authored-by: el-u <[email protected]> Co-authored-by: NewSoupVi <[email protected]> Co-authored-by: black-sliver <[email protected]>
Co-authored-by: el-u <[email protected]> Co-authored-by: NewSoupVi <[email protected]> Co-authored-by: black-sliver <[email protected]>
What is this fixing or adding?
This is an in-place refactor to the code that loads Witness-specific items from its configuration files. No actual AP- or player-facing behavior is different.
How was this tested?
I generated a bunch of runs with fixed seed values and compared spoiler logs before/after to verify that they were identical.
If this makes graphical changes, please attach screenshots.
N/A