Skip to content
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

Shivers: Add events and fix require puzzle hints logic #4018

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

korydondzila
Copy link
Contributor

@korydondzila korydondzila commented Oct 1, 2024

What is this fixing or adding?

Adds events to help clean up some logic and fixes require puzzle hints so that entrances are also accounted for and adds missing logic.
Also just some general cleanup.

How was this tested?

Ran multiple generations to make sure nothing failed and played a few games solo and with others, including GodlFire the existing world maintainer, to make sure the logic was correct.

New Maintainer

I have made a few small prior changes to Shivers AP code.
#2690
#2869
#3558
#3854

Though I have primarily been a maintainer for the Shivers client.
https://github.com/GodlFire/Shivers-Randomizer-CSharp/pulls?q=is%3Apr+author%3Akorydondzila+

I was asked by GodlFire to figure out how to get events working so that redundancy could be removed and logic improved. Also to remove the pot duplicates from the item pool so they don't show up in the advanced options. (these items are solely used to indicate where each pot goes when received but are important for progression)

@github-actions github-actions bot added the waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. label Oct 1, 2024
@Exempt-Medic Exempt-Medic added the waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world. label Oct 1, 2024
@Exempt-Medic
Copy link
Collaborator

To quote the docs regarding adding a world maintainer:

To help the core team review the change, information about the new maintainer and their contributions should be included in the PR description.

@korydondzila
Copy link
Contributor Author

@Exempt-Medic thanks for pointing that out, added more info.

Copy link
Collaborator

@Exempt-Medic Exempt-Medic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some smaller comments, the changes overall look good to me though.

worlds/shivers/Options.py Outdated Show resolved Hide resolved
worlds/shivers/Rules.py Show resolved Hide resolved
worlds/shivers/Rules.py Outdated Show resolved Hide resolved
worlds/shivers/Rules.py Outdated Show resolved Hide resolved
worlds/shivers/__init__.py Outdated Show resolved Hide resolved
worlds/shivers/__init__.py Outdated Show resolved Hide resolved
worlds/shivers/__init__.py Outdated Show resolved Hide resolved
worlds/shivers/__init__.py Outdated Show resolved Hide resolved
worlds/shivers/__init__.py Outdated Show resolved Hide resolved
Comment on lines 246 to 249
for name, data in item_table.items():
if data.type == ItemType.GOAL:
goal = self.create_item(name)
self.get_location("Mystery Solved").place_locked_item(goal)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be doing this when you create the location/item. pre_fill can run into problems with plando

@Exempt-Medic Exempt-Medic added is: refactor/cleanup Improvements to code/output readability or organizization. is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. is: enhancement Issues requesting new features or pull requests implementing new features. labels Oct 2, 2024
elif library_random == 2:
librarylocation.place_locked_item(self.create_item("Key for Library Room"))
# Lobby access:
if self.options.lobby_access == 1:
Copy link
Collaborator

@Exempt-Medic Exempt-Medic Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should use strings (or well, something that isn't just magic numbers)

Suggested change
if self.options.lobby_access == 1:
if self.options.lobby_access == "early":

Copy link
Contributor Author

@korydondzila korydondzila Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally yeah, I have refactors that I wanted to do I just didn't want to overload this PR more than I already have (I already did this with ItemTypes at least). A larger refactoring + all these changes I already made might be a bit much.

I will fix this though since we do use the string names elsewhere.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think doing this for two lines is fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah the strings for sure, I was just responding on the "something that isn't just magic numbers", because also just using strings like this isn't ideal though it is better, enumeration would make more sense for options to me.

Copy link
Collaborator

@Exempt-Medic Exempt-Medic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, the changes LGTM. Some small comments above and some of the world-specific changes GodlFire would definitely need to look at, but it's waiting on their approval anyway. Did 100 solo generations, 100 10-player generations and 100 Shivers+DS3/Witness generations. No errors (or warnings) were encountered in these generations. Playthrough seems to still be fully intact, did not compare region graphs or anything like that before and after but presumably Kory Dondzila and GodlFire would know about those anyway. Did not test for client operations with these changes, but again, presumably they would/did.

@Exempt-Medic
Copy link
Collaborator

This is out-of-scope, but I think it would make sense to eventually convert the item_table or at least create smaller tables for the item types so that something like:

[self.create_item(name) for name, data in item_table.items() if data.type == ItemType.POT]

Could be:

[self.create_item(name) for name in pot_item_table]

@korydondzila
Copy link
Contributor Author

This is out-of-scope, but I think it would make sense to eventually convert the item_table or at least create smaller tables for the item types so that something like:

[self.create_item(name) for name, data in item_table.items() if data.type == ItemType.POT]

Could be:

[self.create_item(name) for name in pot_item_table]

Yep

Copy link
Collaborator

@GodlFire GodlFire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

World Maintainer:

As already stated by Kory we have discussed all of these changes. Looking at the changes the region graphs do look correct Exempt-Medic, as does all of the rule changes.

I have also run a seed and it went fine.

I only see this one rule that could be changed to use the new events.

worlds/shivers/Rules.py Outdated Show resolved Hide resolved
@Exempt-Medic Exempt-Medic removed the waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world. label Oct 4, 2024
region_info = load_data_file("regions.json")
years_since_sep_30_1980 = relativedelta(datetime.now(), datetime.fromisoformat("1980-09-30")).years
Copy link
Collaborator

@Exempt-Medic Exempt-Medic Oct 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this uses relativedelta instead of something simple like:

Suggested change
years_since_sep_30_1980 = relativedelta(datetime.now(), datetime.fromisoformat("1980-09-30")).years
years_since_sep_30_1980 = datetime.now().year - 1980

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe something like:

datetime.now().year - 1980 + (datetime.now().month < 10)

Copy link
Contributor Author

@korydondzila korydondzila Oct 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sep 30 1980 is a very specific date in the game. It's the date that the mystery officially occurs, and the game takes place in 1995, sometime in October or November (The game was released in November) though not specified.

image
image

So the victory item is basically an in joke where you've finally solved the mystery... X years later from that date. Relative delta just for it's accuracy honestly. (Though sadly the item name won't change if the game starts before Sep 30th but ends after Sep 30th).

@Exempt-Medic Exempt-Medic added waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer. and removed waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. is: enhancement Issues requesting new features or pull requests implementing new features. is: refactor/cleanup Improvements to code/output readability or organizization. waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants