Skip to content

Queue franken draft bags#3236

Draft
ninevra wants to merge 30 commits intoAsyncTI4:masterfrom
ninevra:queue-draft-bags
Draft

Queue franken draft bags#3236
ninevra wants to merge 30 commits intoAsyncTI4:masterfrom
ninevra:queue-draft-bags

Conversation

@ninevra
Copy link
Contributor

@ninevra ninevra commented Jun 21, 2025

Still working on this, but most of the functionality is there.

Goal

Pass bags as soon as players are done with them, and allow them to queue up for the next player.

Implementation

Game state

Player#currentDraftBag is now a queue of draft bags, the 0th of which is the current bag. Serializes as a list separated by semicolons. Player#readyToPassBag is removed.

Game behaviors

The core logic is moved from BagDraft#passBags() to a trio of functions, void passBag(Player), DraftBag dequeueBag(Player), and void enqueueBag(Player, DraftBag), which call eachother as necessary. A lot of the message-printing moves from the FrankenButtonHandlers into those functions as well, since the process is a bit more complicated now.

UI

Current draft looks something like:
image

Indicates how many bags are with each player.

Would it be helpful to display some information about each bag? An arbitrary name, or a count of remaining items?

Other stuff

The existing concept of "draft queues", referring to the items a player is in the process of choosing from their current bag, is renamed to "selections" throughout. This is for the sake of being able to read the code >_<

TODO

Open questions:

  • How to handle migration
    • Converting in-progress drafts to queueing requires very little code (just check at loading to see if a player is readyToPassBag and if so, pass it), but is confusing.
    • Allowing drafts to continue in both modes requires a lot of extra code/work, but is possible.

Remaining work:

  • Handle the error/edge-case where a bag exists with no draftables for anyone.
  • Test with more than 2 players. How to set up such a test game?
  • Clean up code a bit.
  • Automated tests? Maybe?

ninevra added 29 commits June 18, 2025 15:08
With draft bag queues, bags are passed as soon as players are done with
them. If there's no queued bags waiting for that player, then they
temporarily have no current bag at all.

Using Optional for getCurrentBag() so that the compiler catches this
change's downstream effects.
Haven't considered migration strategies. Probably going to have to
restore some of the old code to deal with that.
This shouldn't happen, unless an old button persisted too long or
something.
This eliminates the case where current bag is null but the queue is not
empty, which should never occur but required error handling code.
To disambiguate the "item queue" (items to be drafted from the current
bag) from the "bag queue" (bags to be drafted from).
This replaces the command to force pass all players' bags.
Fixes an issue where `/franken franken_edit` didn't print new bags or
update the status message after forcing a pass.
Avoids a race that could cause the new bag messages to display the old
selections.
Accidentally passed them to the left.
@ninevra
Copy link
Contributor Author

ninevra commented Jun 22, 2025

Experimenting with custom emojis

image

@ninevra
Copy link
Contributor Author

ninevra commented Jun 22, 2025

Implementing a choice of queueing or non-queueing drafts is complicated a little by the presence of the various BagDraft subclasses (FrankenDraft, OnePickFrankenDraft, etc.) The existing subclasses seem to represent draft policies, e.g. component category limits. Maybe move to composition for that (a BagDraft has a DraftPolicy which may be a FrankenDraftPolicy etc..) and use inheritance for QueueingBagDraft and NonqueueingBagDraft?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant