question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

reset behavior of activePlayers

See original GitHub issue

Spawning off a thread from a previous discussion at #442, which is talking about (among other things) what to do to activePlayers after it becomes empty (this is a new concept in the phases-overhaul branch).

Background

activePlayers is a map that keeps track of all the players that can make a move on the current turn. This is an evolution of the current concept actionPlayers. It also keeps track of what “stage” each active player is in. A “stage” is analogous to a “phase”, and basically restricts what moves the player in that stage can make. It can be manipulated using something like this:

setActivePlayers({ others: 'discard', once: true });

which does the following things:

  • put every player (other than the current player) in activePlayers.
  • sets the stages of those players to discard.
  • allows them to make one move before removing them from activePlayers.

This allows implementing cards that allow other players to take an action before reverting back to the current player (the Militia card in Dominion, for example).

Problem

Players are removed from activePlayers once they make a move. After activePlayers becomes empty, it is set to null (which means that only the current player can play, but they are not in any stage).

However, if the currentPlayer was in a stage to begin with (i.e. activePlayers was something like { currentPlayer: 'play' } before setActivePlayers was called), then this state is lost.

Proposals

  1. Reset activePlayers to the previous state before setActivePlayers was called once it becomes empty.

  2. Pass in the state to reset to in the setActionPlayers call itself.

Notes

  • Both proposals need to clearly define when to trigger the reset behavior. Is it sufficient to just assume that a reset is required when activePlayers becomes empty?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:28 (28 by maintainers)

github_iconTop GitHub Comments

1reaction
nicolodaviscommented, Sep 10, 2019

That’s a good point. Maybe we should just support moveLimit: 2 instead of the more verbose version.

1reaction
nicolodaviscommented, Sep 10, 2019

Yeah, let’s go for the bare minimum since this is a new API and add stuff as we encounter use-cases that are difficult to implement.

I’m working on setPhase / endPhase BTW.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reset behavior of activePlayers · Issue #445 - GitHub
Players are removed from activePlayers once they make a move. After activePlayers becomes empty, it is set to null (which means that only...
Read more >
players setting resets in new games - Blizzard Forums
D2R Behavior - /players setting is reset each game, regardless if you exit diablo 2 entirely or not. This is extremely annoying for...
Read more >
Reset Program: Reversing the Actions of Banned Players
These actions may include removing Resonator and Mods deployed, removing or restoring links/fields, and restoring ownership of the Portal to a legitimate player...
Read more >
How do I Reset double jump? - Construct 3
Yes, it's a simple addition to the Platform behavior. An action to set the "doubleJumped" boolean manually. Modifying an official behavior is ...
Read more >
Consumer Auto Offsets Reset Behavior | Learn Kafka with ...
Advanced Kafka Consumer tutorial about Auto Offsets Reset Settings such as ... Ensure the auto offset reset behavior is the one you expect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found