boardgame.io: Curious Flow: Second phase's onTurnBegin() is not calling
Hello, I’d like to use your impressive framework, but I met a strange situation.
Here’s my simplified code: https://github.com/ybbarng/boardgame-io-test/blob/master/src/App.js
In phase1, each turn is automatically ended because endTurn() is called in onTurnBegin(). Because the phase1’s TurnOrder is ONCE, the phase will be moved to next phase2. At this time, onTurnBegin() of phase2 is not calling. I hope someone figure out my mistake or explain why this happens.
Context when it stuck,
The log of console:
phase1 onPhaseBegin
phase1 onTurnBegin 0
phase1 onTurnEnd 0
phase1 onTurnBegin 1
phase1 onTurnEnd 1
phase1 onPhaseEnd
phase2 onPhaseBegin
The debug pannel:
G: {}
ctx: {
"numPlayers": 2,
"turn": 2,
"currentPlayer": "0",
"actionPlayers": [
"0"
],
"currentPlayerMoves": 0,
"playOrder": [
"0",
"1"
],
"playOrderPos": 0,
"stats": {
"turn": {
"numMoves": {},
"allPlayed": false
},
"phase": {
"numMoves": {},
"allPlayed": false
}
},
"allPlayed": false,
"phase": "phase2",
"prevPhase": "phase1",
"allowedMoves": null
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 19 (11 by maintainers)
If you ever want to subdivide a turn into multiple “phases”, you should use
stages.phasesare for general game phases inside which multiple turns are played.stagesare different parts of a single turn.npm run prepackwas what I was missing, thanks.FWIW here is the error I was seeing trying to reference the git branch directly. This was after installing cross-env globally:
@delucis You can use
moveLimit: 1for the “main” phase to make the code more idiomatic:@gadamgrey What errors are you seeing when you run
npm -i git://..?@delucis that snippet is very helpful. I don’t have code to share at the moment but if I still get stuck I will prepare an example. Thank you!
I’m working on this presently, so it should be fixed in the next couple of weeks or so.
This is a bug that will be fixed as part of the Phases overhaul described here.