oasislabs / game-box

A Truffle box for a barebones Oasis Game
4 stars 3 forks source link

`can_make_move` not skipping turns #9

Closed andrewosh closed 5 years ago

andrewosh commented 5 years ago

We need to provide a flow method that makes it simpler to select some subset of the players who are allowed to make the next move.

Boardgame.io supports with with the set_action_players event, but we don't currently support that, and adding it as an event seems unnecessary.

Instead, after a conversation with @clementfung, we decided to add the following method, which simply takes in the current game state, and returns a Vec<u16> of all players that are allowed to move:

fn get_current_players(&self, state: &UserState<T>) -> Option<Vec<u16>>

If get_current_players returns None, then the standard round-robin approach is used. Otherwise, the resulting Vec is assigned to ctx.action_players.

andrewosh commented 5 years ago

Added a first pass at get_current_players here https://github.com/oasislabs/oasis-game-core/commit/9dc706e35412c8bf2f8819be1c556b63fe25304e. @clementfung can you give this a try in the poker demo to see if it fixes your issue?

clementfung commented 5 years ago

Looking good now! Closing.