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

Add medal unlock components #9611

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Add medal unlock components #9611

wants to merge 5 commits into from

Conversation

cl8n
Copy link
Member

@cl8n cl8n commented Dec 8, 2022

this is a proposal for an interface to award medals from osu-web

each medal is a queueable event listener that extends MedalUnlock. basic flow is

  • $event type-hints the events it will listen for
  • shouldHandle() tests whether the received event is actually relevant to the medal unlock -- checks in here should be inexpensive bc it runs synchronously after the event is dispatched. if true, the handler will be queued as a job
  • getApplicableUsers() gets the users that may unlock the medal, based on the event and any info saved at queue time (getQueueableState())
  • shouldUnlockForUser() tests whether a user will unlock the medal, if they didn't have it already

medal unlocks won't run without a corresponding entry in osu_achievements where enabled=1, so it's safe to either add the implementation before the db entry, or add a disabled db entry first and enable it after implementation.

the event-driven design is partly so medal logic is in one place, and partly so hush-hush medals can be easily dropped in from a closed-source repo and Just Work:tm:. kind of over-engineered lol but it should be easy to make lots of different kinds of medals with this. I have some random example medals & tests at https://github.com/cl8n/osu-web/tree/medal-examples and https://github.com/cl8n/osu-web-hush-hush-medals

@peppy
Copy link
Member

peppy commented Dec 8, 2022

For the hush-hush portion, is there already premise for this existing? Feel free to PM me example usages, because I can't immediately think of any which wouldn't be score related.

@cl8n
Copy link
Member Author

cl8n commented Dec 8, 2022

not really, I have some ideas for hush-hush but it's not the immediate reason I was working on this. will PM though

@nanaya
Copy link
Collaborator

nanaya commented Aug 22, 2023

This looks like non trivial to deploy with docker?

Might as well create a separate service where osu-web just forwards all received requests to? It can then send back medal generation request to osu-web through interop interface.

@peppy
Copy link
Member

peppy commented Aug 22, 2023

I think the modularity (ie. file parsing) should be removed if we just want to get some new web-based medals implemented, since it's only there for hush-hush (which we don't even know if we need/want).

@cl8n cl8n marked this pull request as draft May 21, 2024 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants