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

MultiServer: Fix LocationScouts with "only_new" broadcasting hints for found locations over and over #4482

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

Conversation

NewSoupVi
Copy link
Member

@NewSoupVi NewSoupVi commented Jan 14, 2025

This PR makes it so hints created with LocationScouts create_as_hint = 2 always persist, so that they do not get rebroadcasted if the packet gets sent again.

History:

In #4214, we changed the behavior of LocationScouts with create_as_hint=2 to fix an issue where already found locations would still broadcast every time they were scouted.

However, this had the unintended consequence of making !hint Power Star not just broadcast every previously found Power Star, but also make all of those hints persist.

As a result, we reverted the change in #4367.

However, this brings back the old problem as well. There were two proposed solutions to the issue, I have chosen to go with this one. For the record, the other one is "don't broadcast nor create hints for already found locations, even in the case of LocationScouts"

@github-actions github-actions bot added affects: core Issues/PRs that touch core and may need additional validation. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Jan 14, 2025
@NewSoupVi NewSoupVi added is: bug/fix Issues that are reporting bugs or pull requests that are fixing bugs. affects: release/blocker Issues/PRs that must be addressed before next official release. labels Jan 14, 2025
@NewSoupVi
Copy link
Member Author

The only thing that's awkward here is that only_new is kind of badly named now. It might be good, as Berserker suggested in Discord, to have only_new and remember_everything as two separate behaviors, and make create_as_hint a flag.

@NewSoupVi NewSoupVi changed the title MultiServer Hints: Fix !hint-ing a multi-copy item creating every already found copy as a persistent hint MultiServer: Fix LocationScouts with "only_new" broadcasting hints found locations over and over Jan 14, 2025
@NewSoupVi NewSoupVi added is: enhancement Issues requesting new features or pull requests implementing new features. and removed affects: release/blocker Issues/PRs that must be addressed before next official release. labels Jan 14, 2025
@qwint
Copy link
Collaborator

qwint commented Jan 14, 2025

conceptually i like it but will need to have more extensive testing than the original pr that ended up accidentally breaking things
(also you have conflicts already smhmh)

@NewSoupVi
Copy link
Member Author

NewSoupVi commented Jan 14, 2025

it will need to have more extensive testing

Let's specify what that means

Since this adds an or to a condition, the only time there is a change from current is if hint.found is False, but only_new is True.
This means that when it comes to safety, we need to investigate code paths and use case where only_new is True or becomes True at some point.

That much I am confident in. I won't prime reviewers about anything else.

@NewSoupVi NewSoupVi changed the title MultiServer: Fix LocationScouts with "only_new" broadcasting hints found locations over and over MultiServer: Fix LocationScouts with "only_new" broadcasting hints for found locations over and over Jan 14, 2025
@NewSoupVi
Copy link
Member Author

Btw, I would specifically also like some opinions about making this a new input param for the notify_hints function called only_found or persist_even_if_found, that is set during LocationScouts regardless of whether create_as_hint is 1 or 2.

Copy link
Collaborator

@qwint qwint left a comment

Choose a reason for hiding this comment

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

did a mix of create_as_hint 0, 1, 2, and !hint in a text client
for unchecked locations:
0 never sent a message but always returned the relevant info
1 always sent a message as expected
2 sent a message if the hint wasn't already printed jsoned (by !hint or by create as hint 1 or a previous create as hint 2)

for checked locations:
0 never sent a message
1 always sent a message as expected
2 sent a message if the hint wasn't already printed jsoned by create as hint 2 but when used after create as hint 1 or !hint create as hint 2 would still send a message

!hint everything seemed to re-send all hints (found or not) to other players (the relevant ones)

I think the create as hint 2 not respecting hints on found locations from other sources is a bit weird, but at least it stops duplicating at some point
but wasn't 'not sending found hints requested by the user to other users` part of the thing we wanted to fix?

@NewSoupVi
Copy link
Member Author

NewSoupVi commented Feb 3, 2025

I think the create as hint 2 not respecting hints on found locations from other sources is a bit weird, but at least it stops duplicating at some point but wasn't 'not sending found hints requested by the user to other users` part of the thing we wanted to fix?

In the case of !hinting something found, then scouting it, it's correct that you get the hint printed twice. The first was an intentionally non-persistent type of hint, the second was (and the reason for its persistence is unrelated - It's because scouts should have a complete record)

However, I'm not so sure about create_as_hint = 1 followed by create_as_hint = 2. I wonder if this PR shouldn't reuse only_new, but rather use a new param force_persist that's used by all scout-hints. I think you might have suggested this before as well?

@NewSoupVi
Copy link
Member Author

Ok, gonna update the PR, I think I will just make this a new attribute.

@NewSoupVi NewSoupVi added the waiting-on: author Issue/PR is waiting for feedback or changes from its author. label Feb 3, 2025
@NewSoupVi NewSoupVi removed the waiting-on: author Issue/PR is waiting for feedback or changes from its author. label Feb 3, 2025
@NewSoupVi
Copy link
Member Author

NewSoupVi commented Feb 3, 2025

Ok, I think I like this solution because it gives the client devs the maximum amount of options for different use cases

Devs of games with "shop"-like scouts, where a finished multi should have a complete catalogue of all scouted shop items, can just send create_as_hint = 2 and forget about the rest.
Devs of games with "gossip stone"/"hint-tile"-like scouts, where you'd rather already found items just not be sent at all, can prevent sending scouts for already checked locations client side.

We could even add a new flag to this called "broadcast_even_if_found", then we'd have all 4 behaviors:

create_as_hint=1 + broadcast_even_if_found=False: Rebroadcast only unfound scouts over and over.
create_as_hint=1 + broadcast_even_if_found=True: Rebroadcast all scouts over and over.
create_as_hint=2 + broadcast_even_if_found=False: Broadcast only new hints for unfound locations.
create_as_hint=2 + broadcast_even_if_found=True: Broadcast only new hints, regardless of found/unfound.

But I might add that to CreateHints instead tbh, after we (hopefully) merge this PR.

@qwint
Copy link
Collaborator

qwint commented Feb 3, 2025

you're telling me i gotta do all that testing again? :p

@NewSoupVi
Copy link
Member Author

Yes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: core Issues/PRs that touch core and may need additional validation. 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. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants