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

SC2: Local Victory Items option #3017

Closed
wants to merge 3 commits into from

Conversation

Alchav
Copy link
Contributor

@Alchav Alchav commented Mar 23, 2024

Wrote this for my own purposes but thought I would offer it upstream.

What is this fixing or adding?

Adds a Local Victory Items option to SC2. This places local items into Victory locations, which prevents other players' !collects from marking missions as completed when they are not. Items are not locked, but an Item Rule is added to these locations to ensure that if Progression Balancing, etc, swap items out, they do so only with other local items.

How was this tested?

Generating a multiworld and ensuring all victory locations contained local items.

@github-actions github-actions bot added the waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. label Mar 23, 2024
@Alchav
Copy link
Contributor Author

Alchav commented Mar 24, 2024

@Ziktofel

@Ziktofel
Copy link
Collaborator

I want some playtesting there to ensure that nothing breaks

@Ziktofel
Copy link
Collaborator

Did you do a playtest?

@alwaysintreble alwaysintreble added the is: enhancement Issues requesting new features or pull requests implementing new features. label Mar 28, 2024
@Ziktofel Ziktofel added the waiting-on: author Issue/PR is waiting for feedback or changes from its author. label Mar 28, 2024
@Alchav
Copy link
Contributor Author

Alchav commented Mar 28, 2024

Did you do a playtest?

I have not yet playtested a game. I've generated multiworlds and observed the spoiler log for correct behavior. Item placement is the only thing this PR changes

@Ziktofel
Copy link
Collaborator

Ziktofel commented Mar 28, 2024

I want to be sure that it won't mess up beat events and things like that are also attached to victory locations
(a multiworld with 2 tiny grids using terribleterribledamage should suffice)

As we're heading to release I don't want to introduce any game-breaking bug in the release

@Alchav
Copy link
Contributor Author

Alchav commented Apr 14, 2024

I want to be sure that it won't mess up beat events and things like that are also attached to victory locations (a multiworld with 2 tiny grids using terribleterribledamage should suffice)

As we're heading to release I don't want to introduce any game-breaking bug in the release

Played a two-player game, one with local victory items on, one without. The one with the option on had local items in all victory locations, and there were no issues completing.

Copy link
Contributor

@Bicoloursnake Bicoloursnake left a comment

Choose a reason for hiding this comment

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

I'm more familiar with SC2 specific shenanigans than the general AP architecture, but this all looks correct to me. Thanks for the new cool option!

@MatthewMarinets
Copy link
Contributor

Is it possible to set up a unit test for this? I'm working on refactoring this code on my branch, it would be nice to have a way to verify I don't break this functionality when I merge it in.

@MatthewMarinets
Copy link
Contributor

Berserker just raised a good point in the discord -- do we want to solve this problem in this way? An alternative approach would be to use a datastore to save mission completion state separately from items. That way, mission unlocks would not be affected by !collect / !release. I agree that method would be cleaner.

@NewSoupVi
Copy link
Member

What are you wanting to go with?

For the record, I agree with the datastorage approach over this

@ScipioWright ScipioWright 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 May 30, 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 Jun 4, 2024
@Ziktofel
Copy link
Collaborator

Ziktofel commented Jun 6, 2024

!release should always lead to all missions done. It'd be weird if all missions are only white (cleared) or grey (inaccessible) and nothing is blue (able to play, some checks left) if there's at least one grey mission

BTW nothing's changed since my last code review approval.

@Ziktofel Ziktofel removed waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world. waiting-on: author Issue/PR is waiting for feedback or changes from its author. labels Jun 6, 2024
@NewSoupVi
Copy link
Member

NewSoupVi commented Jun 13, 2024

Ok, I finally had a look at this.

This current implementation breaks plando.

If a user plandos one of the randomly selected items that get placed during the restrictive_fill with from_pool: true, the generation will crash because the item has been taken out of the pool before plando runs.

"Place random items from the local itempool onto local checks before regular fill" is a use case that will always run into this issue unless the relevant filling is done in fill_hook.
Question at this point: Was the item rule not enough on its own? Did that lead to fill errors?

Sorry for asking so many questions, but I think I would specifically like to know if you're okay with breaking plando that way. Idk how much your userbase uses plando and would complain about it not working correctly anymore

@Exempt-Medic Exempt-Medic added waiting-on: author Issue/PR is waiting for feedback or changes from its author. and removed waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer. labels Jun 19, 2024
Copy link
Collaborator

@Ziktofel Ziktofel left a comment

Choose a reason for hiding this comment

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

There's already a function to get locations subject to plando

def get_plando_locations(world: World) -> List[str]:
    """

    :param multiworld:
    :param player:
    :return: A list of locations affected by a plando in a world
    """
    if world is None:
        return []
    plando_locations = []
    for plando_setting in world.multiworld.plando_items[world.player]:
        plando_locations += plando_setting.get("locations", [])
        plando_setting_location = plando_setting.get("location", None)
        if plando_setting_location is not None:
            plando_locations.append(plando_setting_location)

    return plando_locations

Discard any plando'd locations from victory_locations

@Alchav Alchav closed this Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: enhancement Issues requesting new features or pull requests implementing new features. waiting-on: author Issue/PR is waiting for feedback or changes from its author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants