Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Kim Kyeseung
    @kimkyeseung
    we put the meta data to first User to joined array like this
    {
      playerID: userId,
      credentials,
      data: { started: false}
    }
    and after start button click, we gonna change of firstUser's meta data started: true
    cwatsonc
    @cwatsonc
    anybody have some general knowledge about the debug console? It doesn't appear to work in remote server configurations was curious if this is a documented limitation? I am developing a fbgio hosted game and discovered this behavior.
    sorry, last post was re: debug LOG tab... which appears to only work in local games.
    Larry Wang
    @larry801
    "Does no work" is too vague, please describe your issue in detail
    aflorj
    @aflorj
    Hey! Are there any projects that use playAgain API that I could check out? My "solution" works but feels really clumsy. I was searching through repos that have bgio as a dependency but wasn't able to find an example.
    cwatsonc
    @cwatsonc
    @larry801 you want me to open an issue for a general question? or explain here in full with tests as shown in boardgameio/boardgame.io#810? When using the debug console in remote game mode, no history for moves is being accumulated in the debug > Log? Is this expected?
    Chris Swithinbank
    @delucis
    @cwatsonc The next release should improve the debug panel’s Log tab quite a bit for server games with any luck (there were a bunch of issues with both state and rewind). That said, I would still expect the move history to accumulate with the current version — just potentially with some weird gaps.
    cwatsonc
    @cwatsonc
    @delucis thanks, I think I found my issue I am deploying in freeboardgames implementation and was having issues exposing their config as a service on my local workstation. I can see now that the messages should accumulate in this mode. can you identify which release contains the improvements you describe? I'll watch that thread and track when it arrives in FBG's implementation.
    Chris Swithinbank
    @delucis
    @cwatsonc Ah, OK. The fixes are currently unreleased, but will be included in a release within a week or so (might take longer than that for freeboardgames to update to the latest release though). Guess it’ll be either v0.40.1 or v0.41.0.
    Rakesh Sharma
    @raxy_twitter
    I am facing a problem when people join and leave game, it removes the game file if everyone leaves the game, I want the game to be always there, even if all the players had left, as they can join again and play
    4 replies
    Adrian Gaudebert
    @adngdb
    Hey all! I would like to implement a "Concede" button in my game. Making the move is easy (ctx.events.endGame({ winner: opponent })), but I would like players to be able to concede at any moment. By default, moves cannot be executed while a player is not active, and thus my players can only concede during their turn. Is there a way to declare that a move can be called at any time, in any phase or stage?
    3 replies
    James Rushford
    @JamesRushford_twitter

    Hi!
    I'm making a card game, you can can see it in action here and the code here

    I'm having trouble with the AI.

    I'm building a practice mode for single player where the AI makes a random move. The possible moves are listed out fine, problem is, I don't know how to tell it to make a move.

    My idea was to to put the function in the general onEnd attribute. I found a function makeMove in boardgame.io/src/core/action-creators.ts tat might do the trick, but it is not exported. Are there currently any ways I can do this?

    2 replies
    cwatsonc
    @cwatsonc
    I'm trying to upgrade to v0.41.1 and am getting failures from the game property 'flow' something changed in the API?
    cwatsonc
    @cwatsonc
    is there somewhere in the docs describing this change? In all your examples I see them unwrapping nested props of game.flow is that appropriate for games.flow.movesPerTurn also?
    2 replies
    Siddharth Vaghela
    @artineering
    Hello everyone! I am almost never able to run the examples in the repository - I keep getting unresolved errors for various components of Boardgame.io. Any suggestions?
    2 replies
    Trung Pham
    @trung2012

    Hi everyone! First of all, I want to thank the creators of this library. It is super awesome.

    My question is: I'm trying to reuse some moves function already defined for the moves object in stages. I have 2 files: moves.ts and stages.ts

    When I define the stages in stages.ts with moves imported from the moves file, I got this "cannot access [move name] of undefined" error. When I copy the move from moves.ts to stages.ts, it works fine. Why is this happening? I don't have a lot of moves I'm planning to use in stages but if I had hundreds of moves, copy and pasting doesn't really makes sense

    3 replies
    Kyle G Sessions
    @kage23

    Hi everyone! I'm trying to implement a server version of my game, per the Multiplayer instructions in the documentation, but when I try to run the server, I get this error:

    Error: Cannot find module './Game/Game'
    Require stack:
    - /Users/kylegsessions/projects/ww-ttg/src/server.js
        at Object.<anonymous> (/Users/kylegsessions/projects/ww-ttg/src/server.js:2:24)
        at Generator.next (<anonymous>) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [ '/Users/kylegsessions/projects/ww-ttg/src/server.js' ]
    }

    My server itself is very simple:

    const { Server } = require('boardgame.io/server')
    const { WeedWizard } = require('./Game/Game')
    
    const server = Server({ games: [WeedWizard] })
    
    server.run(8000)

    and here's the game it's trying to access:

    import { Game } from 'boardgame.io'
    ...
    export interface IPlayer { ... }
    export interface IGameState { ... }
    export const WeedWizard: Game = { ... }

    Does anyone have any ideas what might be going on? (If it makes a difference, the server file is .js, but the rest of the project, including the Game file, is .ts/.tsx.)

    Larry Wang
    @larry801
    backend is not compiled to js
    You can follow this example
    Kyle G Sessions
    @kage23
    @larry801 OMG, thank you so much, that was exactly what I needed! :D
    Kyle G Sessions
    @kage23

    Is it possible to access/modify game state in anonymous callback functions within moves? I'm getting the following error when I try to do so:

    TypeError: Cannot perform 'get' on a proxy that has been revoked

    I'm trying to do something like this:

    const moves = {
      moveName: (G: IGameState, ctx: Ctx) => {
        const onSelect = (value:number) => {
          // modify game state in here
          // close modal here
        }
    
        // open modal here
        const modal = Modal.info({
          // modal properties where I gather info from the player
          // modal contains a button that calls the above onSelect method
        })
      }
    }

    If I modify the game state directly within the move itself, it's fine, but when I try to modify it within a callback method like this, I get the above error.

    Kyle G Sessions
    @kage23
    I solved it by opening the modal and gathering info from the player before I call the actual move.
    jfengel
    @jfengel

    I was trying to figure out how to get a hold of the player's name via React. Turns out it's in matchData, which doesn't turn up anywhere in the documentation. It's an array of Server.PlayerMetadata, indexed by the player order. So the current player name is:

        const playerIx = ctx.playOrder.indexOf(playerID);
        const name = matchData[playerIx].name

    (I'm not sure if that's the best way to determine the player index).

    Kyle G Sessions
    @kage23
    Oh cool! I was looking for player names and couldn't find them anywhere within the Game, but I am seeing them in matchData on the gameboard.
    However, whenever I try to use the Lobby (in a React app), all of a sudden endTurn no longer ends the player's turn, so we're just stuck on the first player, in the first phase, forever. But when I use the Client interface instead of Lobby, I don't have this problem. Has anyone else had this experience, or know a workaround?
    Chris Swithinbank
    @delucis
    @kage23 That sounds like the client isn’t successfully connecting to the game server. For multiplayer games, events like ending turns and phases only run on the server, so if the server doesn’t respond, the turn will appear not to end.
    Kyle G Sessions
    @kage23
    @delucis Thanks, that makes sense. Any ideas why it might not be connecting? I'm running a local server, and the Client seems to be connecting to it just fine; it's just the Lobby that's having problems. Here's my current App code, with the working Client in place, and the not-working Lobby commented-out. Do you see anything obvious that I'm missing?
    const NUM_PLAYERS = 3
    
    const WWClient = Client({
      // debug: false,
      game: WeedWizard,
      board: PlayerBoard,
      numPlayers: NUM_PLAYERS,
      multiplayer: SocketIO({ server: 'localhost:8000' })
    })
    
    const App = () => {
      const playerID = window.location.pathname.split('/')[1]
    
      return (
        <WWClient playerID={playerID} />
        // <Lobby
        //   debug
        //   gameComponents={[
        //     { board: PlayerBoard, game: WeedWizard }
        //   ]}
        //   gameServer="http://localhost:8000"
        //   lobbyServer="http://localhost:8000"
        // />
      )
    }
    
    export default App
    3 replies
    Chris Swithinbank
    @delucis

    @jfengel You can look up a player’s metadata something like

    const playerMetadata = matchData.find(player => player.id == playerID);
    const { name } = playerMetadata;

    matchData is documented in the list of React board props in the client docs.

    jfengel
    @jfengel

    Thank you @delucis . It didn't show up in the search.

    There is a small problem with that find code; PlayerMetadata.id is a number, but playerID is a string. It works with == but not ===.

    Karan Sharma
    @karan1276
    Hello Folks, anyone knows any good UI components/frameworks i can use with boardgame.io ?
    Kyle G Sessions
    @kage23
    @jfengel I've been casting the playerID as Number(playerID) or parseInt(playerID) for that reason.
    @karan1276 I'm using Ant Design (https://ant.design) for mine, and it's pretty decent. The main reason I picked it is because it's what we're transitioning to in the frontend code at my office, so I thought I'
    Typing on my phone, sorry! I thought I'd just get more acquainted and familiar with Ant Design!!
    Karan Sharma
    @karan1276
    @kage23 nice! Ant design is a good general UI framework. I wanted sth more specific to boardgames, like make flippables stackable cards, sticky boards etc
    Chris Swithinbank
    @delucis
    @karan1276 There are some old components in this repo that used to come bundled with boardgame.io that might be a reference point: https://github.com/nicolodavis/bgio-react-component-toolkit
    Karan Sharma
    @karan1276
    @delucis this is good!
    JonRSargent
    @JonRSargent
    This message was deleted
    JonRSargent
    @JonRSargent
    Hello, a few questions: I'm trying to implement a small card game as a warm-up for bigger projects, and I have some difficulties with the game flow (see thread).
    11 replies
    Chase Ingebritson
    @ChaseIngebritson
    Is there a way to pass the result of a move to a component? I would like to add some validation within the component that's calling the move.
    1 reply
    Kim Kyeseung
    @kimkyeseung
    Is it Possible to playgame with 3 player at sametime??
    2 replies
    Gastón Ezequiel Durand Vadas
    @gdurandvadas
    Hello! I'm trying the REACT Lobby implementation and it seems that the whole game is loaded inside of the Lobby, which is really inconvenient. Would is it possible to make this render a redirection to the game's URL?
    https://github.com/boardgameio/boardgame.io/blob/master/src/lobby/react.tsx#L356-L361
    6 replies
    clicksilver
    @clicksilver
    whenever I try to rename the G object to have a different name like "gameState", I get typescript compilation errors from the Client
    TypeScript error in C:/Users/rawrjun/code/game-lobby-example/src/components/Game/multiplayer.tsx(30,10):
    Property 'gameState' is missing in type '{ matchID: string; playerID: string | undefined; credentials: string | undefined; debug: true; }' but required in typ
    e 'Pick<Pick<Readonly<Pick<ClientOpts<any, Ctx>, "matchID" | "playerID" | "credentials" | "debug"> & Pick<LocalBoardProps, "gameState">> & Readonly<...>, "mat
    chID" | ... 4 more ... | "children"> & Pick<...> & Pick<...>, "gameState" | "children">'.  TS2741
    
        28 |     <div className="row flex-center">
        29 |       <div className="col no-padding">
      > 30 |         <MultiplayerClient
           |          ^
        31 |           matchID={matchID}
        32 |           playerID={player}
        33 |           credentials={credentials}
    11 replies
    Vyacheslav Gusev
    @VjGusev

    Hello!

    Try to start server on Mac, as in tutorial:node -r esm src/server.js
    And get such error: TypeError: Cannot read property 'processMove' of undefined

    Try the solutions from this chat, but they doesn't work for me.

    Trung Pham
    @trung2012

    Hi @delucis, I'm trying to use bgio-effects and I got this error when I used the React Wrapper component:

    Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

    Everything was working fine before I added EffectsBoardWrapper. I tried to look into the code but couldn't figure out why that happened. Do you know what could be the problem? Here's what my Board component looks like:

    const GameBoard: React.FC<BoardProps<IGameState>> = ({
      G,
      ctx,
      moves,
      events,
      playerID,
      isActive,
      matchData: playersInfo,
    }) => {
      return (
        <GameContext.Provider
          value={{
            G,
            ctx,
            moves,
            events,
            playerID,
            isActive,
            playersInfo,
          }}
        >
          <ErrorProvider>
            <AnimationProvider>
              <GameTable />
            </AnimationProvider>
          </ErrorProvider>
        </GameContext.Provider>
      );
    };
    
    export default GameBoard;
    4 replies
    Kyle G Sessions
    @kage23
    When using the Lobby component, it seems that if I set debug={true}, the debug panel is available and is opened automatically upon launching the game and can be closed and reopened via the . key. If I set debug={false}, the debug panel is not available at all. Is it possible to set things such that the debug panel will be available, but closed by default until/unless I hit the . key? (For context, I'm using bgio to build a prototype of a game that I intend to make an actual physical version of. During playtesting, it would be nice if I have access to the debug panel, but other players don't have access to it, or at least, don't know that they do have access to it :P.)
    3 replies
    Bobby Basnet
    @bobbize_twitter

    Hi, I just discovered this framework and finding it so cool. And working on a project on this,

    However, I didn't find any documentation of how to store player data (in the multiplayer scenario) in the Game state.

    How do you recommend I do it? Is there any other projects that I can study from? I am coding the project in plain JS

    1 reply
    Trung Pham
    @trung2012
    Hi everyone - Is it possible to call endTurn in onBegin? At the beginning of the turn, I want to automatically check for some condition and if that condition is true then end the turn immediately. I checked and everything works, except the ctx.events.endTurn() call. It doesn't seem to do anything. My code looks something like this:
    turn: {
        onBegin: (G, ctx) => {
            if (condition) {
                // do something
               ctx.events.endTurn(); <--- Everything else but this works
            }
         }
    }
    7 replies