Whebon / dale-of-merchants

Board Game Arena adaptation of Dale Of Merchants
Other
2 stars 0 forks source link

Refactor open-information technique choices as client states #41

Closed Whebon closed 2 weeks ago

Whebon commented 1 month ago

Currently, all choice-based techniques are handled through a server-state. For some of them this is necessary because they involve hidden information (e.g. Spyglass, Dirty Exchange, Sabotage, etc).

However, some techniques (see affected cards below) involve choices based on open-information. These choices could be handled through a client state to reduce server interaction.

In this case, the client is responsible for locally scheduling the technique and making a choice. Then it sends the choice through an action. The server executes the action and notifies all players about a schedule. The current player ignores this notification, as it already locally

The sequence of events would look something like this:

  1. the client plays a choice-based technique
  2. the client opens a client state for the choice 2a. the client locally schedules the technique 2b. the client locally makes a choice for the technique 2c. the client sends the choice to the server (through an action)
  3. the server execute the action 3a. the server schedules the technique and notifies all players (the active player ignores this notification, as it already scheduled the card locally). 3b. the server executes all card effects and immediately fully resolves the technique, just like for 'instant' techniques such as Flashy Show (exception: Blindfold)

Affected Cards:

Whebon commented 3 weeks ago

Alternative Options for 2c:

  1. New server action for each technique type.

  2. Reuse "actPlayTechnique" with args. actPlayTechnique will have some optional string fields "arg1", "arg2",...,"arg5" that can be used to store any additional client state information. WARNING: some client args can be transformed chameleons. (e.g. rare artefact)