Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Mohre
    @Mohre
    Is it possible to let all players do their last move on the last round of the game before the game over?
    3 replies
    Evandro Abu Kamel
    @evandroabukamel

    Hey, guys. I have a problem when moving to next stage when the current stage has reached its move limit. Here's my setup:

      activePlayers: {
          currentPlayer: {
            stage: 'getQuestion',
            moveLimit: 4,
            // After all question draws, it must go to this stage.
            next: {
              currentPlayer: 'playQuestion',
              moveLimit: 1,
            },
          },
          others: { stage: 'drawAnswers', moveLimit: 1 },
        },

    I also tried to set next on stages property but same result:

    stages: {
          // Main player must get a question card no more than 3 times.
          // And can also play it.
          getQuestion: {
            moves: { drawQuestionCard, playQuestionCard },
            moveLimit: 4,
            next: 'playQuestion',
          },
    
          // Main player must play the picked question card.
          playQuestion: {
            moves: { playQuestionCard },
            moveLimit: 1,
            // After that it must wait for the other players
            // to play their answers.
            next: Stage.NULL,
          },

    After the 4 moves in getQuestion, currentPlayer is removed from activePlayers and unable to move to playQuestion stage.
    I'm using only the server and my client is a Dart SocketIO implementation on Flutter.

    Can someone help me with this?
    I am doing something wrong?

    7 replies
    Eric Mun
    @DiZeroX

    I get typescript error Cannot invoke an object which is possibly 'undefined' when trying to call ctx.events.endPhase(). When I check the type definition for events, it is set as optional, which means it can be undefined in some cases.

    Is there a way around this? Also, I can't think of a scenario where events should be undefined?

    12 replies
    Chris Quamme Rhoden
    @chrisrhoden
    There's not some easy way to get the playerNames that are defined by the Lobby API in the context of a game, is there?
    3 replies
    Mohre
    @Mohre
    In debug panel i get index.js:1 ERROR: disallowed move: reserveCard when i try to switch to older states in log tab.
    can anybody help me?
    5 replies
    Sunny Matharu
    @sunnymatharuuk

    Hi guys, I am reasonably new to React, and web development (I am a Salesforce and Java dev that felt like trying something different in his spare time).

    I have been working on a short game project to help me learn.

    All was working well until I tried to run multiplayer in server mode.

    When executing npm run serve I always get the following error TypeError: Cannot read property 'processMove' of undefined

    I have seen a prior post by @jaydjohnson that looked to get solved but the solution did not work for me.

    I feel like something is wrong with my imports/references but cannot see what.

    I have since replicated the error in the TicTacToe tutorial (to make sure it was nothing hooky in my game code that was messing things up)

    Is anyone able to help?

    My tic-tac-toe repo is here: https://github.com/sunnymatharuuk/bgio-tutorial

    The steps seem pretty straightforward:

    • npm install esm
    • set multiplayer config to use SocketIO
      modify package.json to include a server start command
    • job done

    I am pretty technical, so am somewhat embarrassed to be asking a question that will likely have an obvious answer.

    Can anyone help? I have spent far too long trying to debug and gotten nowhere...

    22 replies
    W. Michael Shirk
    @wmichaelshirk
    Is there a spot in the docs where it details exactly what order all the "hooks" run in? I've gotten confused by "endIf"s in a phase happnening before "onBegin", and somehow I seem to have an "onEnd" getting called twice. :flushed:
    9 replies
    Rakesh Sharma
    @raxy_twitter
    hi guys, we are stuck in really a big issue while using the multiplayer option of boardgame, can you guys please help as our multiplayer server is at https://www.collaboration.tk/server but when we create a game it removes /server part from the socket.io requests
    14 replies
    Sunny Matharu
    @sunnymatharuuk

    Hi all, I am looking to add a Map type to G. However I noticed that the Map.get() and Map.set() methods are not recognised.

    I understand this is because you are using Immer to apply a mutable wrapper around the otherwise immutable G

    Is there any chance you could update bgio to also allow mutation of Maps and Sets in G?
    https://immerjs.github.io/immer/docs/map-set

    The docs say that Since version 6 support for Maps and Sets has to be enabled explicitly by calling enableMapSet() once when starting your application, however no matter where I add said line and related import (app.js, index.js), I get the following error:

    Attempted import error: 'enableMapSet' is not exported from 'immer’.

    If I import into Game.js, there is no initial error, but there is when I try to use Map.get(…) or Map.set(...)

    Without know the details, I assume this is because the enableMapSet plugin needs to be imported into bgio’s ImmerPlugin implementation?

    If I’m totally off base, can anyone recommend a way for me to mutate Sets and Maps inside G, without having to have a separate state to manage?

    8 replies
    Eric Mun
    @DiZeroX

    I'm trying to implement this

    playerView: (G, ctx, playerID) => { return StripSecrets(G, playerID); }

    I get Could not find name StripSecrets. I tried importing StripSecrets from boardgame.io and boardgame.io/core but those aren't in the .ts files.

    Is that functionality not ported over to TS yet, or is there something I'm missing?

    2 replies
    Ruslan Hydra
    @HydraOrc
    Hello, guys, is it possible to use the same connection that boardgame.io uses for it's purposes for my own purposes also so I do not have to create additional connections for each user? And if yes, what should be the correct way to do so?
    13 replies
    Stephen Shilale
    @sshilal1
    does anyone have a good method for have a single user action produce multiple moves? for example, a user clicks confirm when playing a card, and that card calls several different pre-defined moves that each do something different to the game state.
    2 replies
    cyberbeat
    @cyberbeat
    How can I see the connection status (websockets) for each player (server & client)? (that everybody knows the status of each other)
    4 replies
    Eric Mun
    @DiZeroX

    I'm having some trouble architecting a mulligan phase at the start of the game.

    There are two players and they both select 0+ cards from their hand to discard. They can do the SelectCard move as many times as they want. The phase ends when both players click a button that they are finished selecting their cards and those cards are mulliganed accordingly.

    This is my attempt:

    ...,
    mulligan: {
          onBegin: (G: GameInterface, ctx: Ctx) => {
            G.currentPhase = 'Mulligan';
          },
          moves: { SelectCard },
          turn: {
            activePlayers: ActivePlayers.ALL,
            onMove: (_, ctx: Ctx) => {
              if (ctx.activePlayers === null) {
                ctx.events?.endPhase?.();
              }
            }
          },
          onEnd: (G: GameInterface, ctx: Ctx) => {
            MulliganCards(G, ctx, CONSTANTS.PLAYER1);
            MulliganCards(G, ctx, CONSTANTS.PLAYER2);
          },
          next: 'play'
        },

    It would need a way so that clicking a button removes a player from ctx.activePlayers. Is there a way to do this without using moveLimit (SelectCard move can be done any number of times)? Or is there a better way to architect the structure of the phase?

    11 replies
    bignuts
    @bignuts
    Hello everyone, just started using the framework today, lovely. I need your help, i want to initialize some value before creating G and ctx, basically i need to choose wich one of the two player start first and initialize my deck list, what is the best way to do so? I'm using react, below some snippet of my code
    11 replies
    import React from "react";
    import { render } from "react-dom";
    import App from "./app";
    
    render(<App />, document.getElementById("root"));
    import { Client } from "boardgame.io/react";
    import TicTacToe from "./game";
    import Board from "./board";
    
    const App = Client({
      game: TicTacToe,
      board: Board,
    });
    
    export default App;
    Just simple tic tac toe game like the one in the tutorial
    jabza
    @jabza
    I finished my first bgio project! https://points4words.io a 4 player word builder game, thanks for creating this great project :)
    2 replies
    Sunny Matharu
    @sunnymatharuuk

    Hi team, can anyone let me know exactly when ctx.activePlayers is given a value.

    When I attempt to reference it, in some scenarios it has values, but in others it is null.

    It is causing me issues when rendering based on which stage a given player may or may not be in.

    Any ideas?

    6 replies
    Jay French
    @jfren484
    I'm just starting out with boardgame.io (and React), and I'm struggling with G. The documentation says G contains game state (managed by you) and ctx contains read-only metadata (managed by the framework).
    12 replies
    Randen Kelly
    @aowie1
    I'm confused about managing state in the moves functions. Why am I not able to return anything from these?
    19 replies
    Adit Jain
    @aditj
    Hey there! Is there any way we can extend the API capabilities of the Server Object? (i.e. can we have routes other than those mentioned in the Lobby API documentation )
    I am trying to implement User Authentication and also having profiles of users. ( so that they can view their earlier games etc. ). Is there any other way I can do this?
    3 replies
    W. Michael Shirk
    @wmichaelshirk
    Is there a standard pattern people use for the React/JS side "delaying" rendering changes so that everyone can see what's happened? I have the logic completed for a card game, and the winner of a trick takes the cards, and then can lead to the next. But because the state change of playing the last card is the same state change that determines the winner and takes the cards off the table, the other player can't see them. Besides the "present state" I am keeping a list of moves, so what was just played is available. I've thought about keeping a react state "copy" of the list - and only adding the "next" to it after a set delay - but if you, say, hit refresh - I wouldn't want you to necessary watch the entire game replay...
    5 replies
    Ruslan Hydra
    @HydraOrc
    I have a question. Is there a way to change game state from master at some timeout or event fired so none of the players made a move but still something changed?
    1 reply
    Jay French
    @jfren484
    I see in the reference that there is are events for turns and phases, but don't appear to exist for stages. In the game I'm working on, there are 12 stages for each turn. Some of those involve user action and some are just automatic (decreasing the amount of food remaining). For the action stages, I'd like to use an onBegin event that would determine if the current stage applies, and if not, end the stage and simply move to the next one. Would the alternative be, at the end of each stage, calculate which stage comes next? In other words, at the end of stage 1, if stage 2 applies next stage is stage 2, else if stage 3 applies, next stage is stage 3, etc. Is there a plan to add events to stages at some point?
    4 replies
    Sushil Kumar Dhayal
    @skdhayal
    Hi @all - I need a help regarding multiplayer join/unjoin via koa server. In my case two player are joining same role with their credentials. How can i know that who is the legal player? I know the game not allow to play the illegal player, but actually can i get some hint about his illegality during his turn ?
    3 replies
    Kevin Liu
    @kliuz
    I've created a game and clients have joined the game: is there a way for the leader (the person who created the room) to start the game for everyone? In other words, I'm wondering if it's possible for the game to start ONLY if the leader starts the game.
    3 replies
    Rakesh Sharma
    @raxy_twitter
    Hi Guys, I am struggling to get this running on SSL, I tried a lot, I even tried to set this multiplayer: SocketIO({ server: 'https://www.collaboration-game.tk/server' }) but it don't work, any help will be appreciated
    I have proxyPass the requests to /server for the port 8000
    zhale
    @ZhaleTaheri_gitlab
    Hello
    I have a problem
    this.props.G is not update after action
    zhale
    @ZhaleTaheri_gitlab
    Can anyone help me?
    1 reply
    Mohre
    @Mohre
    what is automatic: true in game logs?
    3 replies
    Mohre
    @Mohre
    In my game every player do a move in each turn. but in some rare situations the player should do an extra move for that turn. what it the best practice for implementing this game with boardgame.io?
    7 replies
    Camille Roux
    @camilleroux
    Hi ! I'd like to have some tips to know how to structure my game. I'm working on a game with the followings rules :
    • Each "turn", all the players program X action. They can do that at the same time.
    • When all the player programmed their actions, they are executed in the following order : Action 1 Player 1, Action 1 Player 2... Action 2 Player 1, Action 2 Player 2
      Have you got some tips to do that simply with this framework ?
    3 replies
    Ruslan Hydra
    @HydraOrc
    I try to write a mongodb multiplayer storage based on existing postgresql storage. The game inits on client side, calls a fetch function of my db class, but then there is no such game created yet and it runs into errors. How do I write a functionality so my storage creates and inits a new game automatically in this case in a correct way? Maybe call game setup function somehow?
    5 replies
    Ruslan Hydra
    @HydraOrc
    Does disableUndo work right now? I can not find it in the source and passing it still adds _undo to my database
    4 replies
    Mohre
    @Mohre
    Why lobby-view has inline style?
    <div id="lobby-view" style={{ padding: 50 }}>
    1 reply
    bignuts
    @bignuts
    I can't get my head around Stages, in my game usually a player can either take an action during his stage or pass to the other player, when both player decide to pass and not take any more action the turn end. So a small example would be, Player0 start the turn, he plays a unit and pass, Player1 plays two spell to take out Player0 unit and pass back to Player0, Player0 now is passing , Player1 play unit and pass, Player0 is passaing again and so il Player1, the turn end. So basically during a turn the players can take action back and forth until both passes. Rigth now i just end turn when a player is done taking action, and in G i have the actual turn counter, i know there are stages for this, but really can't make it working. Any help is appreciated. Thanks!
    3 replies
    Sheldon Chen
    @SheldonSChen
    This message was deleted
    Benny George Kenkireth
    @bgkiitg
    I am a newbie . I am at sea trying to design the UI for the player-related data. I can access the general data from G. The trouble I face is how to figure out the ID of the player. Thanks in advance.
    2 replies
    Emily Kolar
    @sheminusminus
    Hey! Cool framework. Two questions for anyone who might know:
    1) Can I configure to assign a player’s ID serverside? 2) How does one trigger a move that can only run on the server?
    7 replies
    Emily Kolar
    @sheminusminus
    (I understand I can set someMove.client to false, just not how to trigger that move from some clientside player action)
    zhale
    @ZhaleTaheri_gitlab
    Hi, I have another problem
    I do not want change current player with change phase
    5 replies
    does anyone have a solution?
    Solomon
    @nightfire445
    Hello! I've been taking a deep dive into the lobby component and the underlying koa api. One of the use cases for my project is to use the player name from the lobby inside the game that they join. My peek through the source seems to indicate that this is not possible since the join route appears to store the meta data with koa not with the game client, but I wanted to get confirmation that I'm not barking up the wrong tree with my assessment. Thank you in advance!
    2 replies
    Andrey
    @fxuniverse

    Hey folks. Huge props to @nicolodavis for a great framework.
    Wanted to share an adaptation for the classic Sequence game I made using it: https://sequence.cards
    It's in open beta, please feel free to test and share feedback on how I can make the game better.
    Also utilized - Angular 10, Angular Material, NgRx, Firebase for db.
    I plan to open source it, after cleaning up private keys and such.

    @nightfire445 to your question about using names in the lobby and later in the game - I bypassed the Koa app and just used Firebase directly, subscribing to the players array real-time

    5 replies
    Sushil Kumar Dhayal
    @skdhayal
    Hi, I have 8 players in multiplayer game mode. How do i allow each player with dynamic moveLimit ? Please help me.
    2 replies