Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Francisco Alamino
    @Franchax
    Oh I can't believe it this is a dream come true, next step is create a lobby with matchmaking! Thank you @delucis very much
    Chris Swithinbank
    @delucis
    :smile:
    Happy to help
    opollak
    @opollak

    @delucis I used your suggestion to convert classes to functions, and it works great! However, I I think I found another breaking change, which is this: "ERROR: events plugin declared action invalid:
    setStage, endStage & setActivePlayers are disallowed in a phase’s onBegin hook.
    Use setActivePlayers in a turn.onBegin hook or declare stages with turn.activePlayers instead."

    Another thing I'm noticing is that I have code for various invalid moves to tell players why the move was invalid, and it doesn't seem to work anymore (I see the invalid move message in the logs, but the player doesn't see the message). I was on 0.39.16 before and I'm now on 0.49.10.

    Example:
    if (!(lastChip.type==='white')) { G.players[p] = messageOne(G.players[p],"Invalid move."); return INVALID_MOVE; }

    Chris Swithinbank
    @delucis
    @opollak An invalid move isn’t able to mutate any state (this isn’t new, so I’m not sure how it could have worked previously). When you return INVALID_MOVE the framework rejects the whole update, so even if G was mutated, those changes are discarded. Our eventual aim is to allow something like return InvalidMove('reason…') and then allow the client to receive the reason message for this kind of thing, but that’s not supported yet.
    3 replies
    opollak
    @opollak
    After nearly two years, I am finally ready to share my take on Quacks of Quedlinburg, still definitely a work in progress!
    Code: https://github.com/opollak/quack-quacks
    Demo: https://quack-quacks.herokuapp.com/
    Chris Swithinbank
    @delucis
    Nice, glad you’ve got it working!
    Ghost
    @ghost~57fba30cd73408ce4f2d2c2c
    hello! I'm trying to use typescript with boardgame.io and I get stuck with this error:
    Uncaught Error: Move state is not JSON-serialiazable.
    See https://boardgame.io/documentation/#/?id=state for more information.
    debugging the code it seems than when defining the GameState:
    export interface GameState {
        cells: (string|null)[]
    }
    it seems to be trying to serialize the prototype functions
    anybody ever encounter this?
    Ghost
    @ghost~57fba30cd73408ce4f2d2c2c
    nevermind, I was adding a custom prototype to Array that I forgot about, talk about the dangers of extending native types :)
    Josh Wolf
    @Wolfasaurus1
    moves : {
      placePiece : (G, ctx, color, x, y) => { ... }
    },
    turn : {
      stages: {
        pieceNotPlaced : {
          moves : { placePiece }
        }, 
        piecePlaced : {
          moves : { commit, undo }
        }
      }
    }
    Hello! When I try to build, the moves : { placePiece } line gives a placePiece not defined error (the placePiece function works fine). Am I not using stages correctly here?
    Josh Wolf
    @Wolfasaurus1
    Ah I think I see, I'm probably supposed to actually define the move inside the stage lol
    2 replies
    Grzegorz Pociejewski
    @pociej
    Hi there, i just updated boargameio in my project from 0.43.2 to 0.49.10 because of critical vulnerability detected by npm audit. Now in place where i used to see my game board i see just the "connecting..." string without any errors. Seems that connection socket.io server works well but for some reason board is not rendered. Do you have any idea of what could be the problem?
    10 replies
    zplaced
    @zplaced
    hi all, totally new to writing web app and currently building up a board game to practice both react and boardgameio. I have a case when a player plays action A, they need to choose another player as target to execute. I think this is common but I am not sure how to implement that. Could anyone point me to an example (some existing project)? or provide some (even high level) directions how to do this?
    8 replies
    cheng93
    @cheng93
    If I want to use a boardgame.io client with a third party server, is this possible?
    Looking at the docs I would either have to implement a custom transport or do something with client ?
    7 replies
    Francisco Alamino
    @Franchax
    Hi! Question about the bgio-effects plugin. I found I cant use decimals, like 0.5 in the duration property of any effect config. Is this correct or it's just wrong on my project?
    Francisco Alamino
    @Franchax
    Also I was wodering why when I try to pass specific thing to the create callback of the effect I receive proxy, eg: ctx.effects.roll(G.dice) but in the front I receive proxy
    12 replies
    Francisco Alamino
    @Franchax
    Hi! I'm still trying to implement a lobby for my game but I have to admit I'm having a hard time trying to follow the docs. Is there any project that any of you recommend to check out as an example? I'm also wondering if it's possible to have a more 'simple' lobby, only click on something like 'search game' and join a game or create one if any other game is already created
    33 replies
    PerpetualPhoenix12
    @PerpetualPhoenix12
    I see it's possible to undo entire moves with client.undo(); but is it possible to undo phases within a move? e.g. a if move includes phase1 and phase2, can you undo from phase2 -> phase1?
    1 reply
    Jeffrey Gao
    @Jeffmagma
    When I console.log props it seems like there is an empty "name" property for a move, how would I set that?
    3 replies
    Michael Brinkley
    @mbrinkl
    any way to conditionally redact in a long form move? for example, redact during the game, but show unredacted logs if game is over - or redact based on the game state?
    Chris Swithinbank
    @delucis
    @mbrinkl Not currently, although I don't think there would be a hard reason this couldn't be supported. A feature request on GitHub issues would be a good place to track this if you could open one.
    Michael Brinkley
    @mbrinkl
    @delucis ok - on a similar note, is it possible to expose the random seed to the client when the game ends? Or would that also be a feature request
    Jeffrey Gao
    @Jeffmagma
    Is there a way to show the debug panel in multiplayer using the react lobby? or the lobby api in general
    Chris Swithinbank
    @delucis
    @mbrinkl That would also be a feature request and a more complex one too I suspect because of how the random plug-in is implemented. Out of curiosity, what's your use case for accessing the seed?
    8 replies
    Chris Swithinbank
    @delucis
    @Jeffmagma Yes, adding a debug prop to the component should behave the same way it does with the normal client. (With the plain JS lobby API client, it's up to you how you instantiate the game client so you can also pass debug there.)
    One thing worth noting is that some debug functionality will not work correctly in a multiplayer set up. If you just want the panel to have a look at the current state or dispatch a move, that should be fine, but save/restore or toggling player ID will usually break the connection to the server. For actually debugging game play, I generally recommend running a single-player client.
    Tanner Griffin
    @alfredoheights
    Is codenames.game written with boardgame.io? The websockets look very familiar but I don't know for sure
    4 replies
    Also, has anyone put BGIO into use on anything other than a web / react native app?
    Jeffrey Gao
    @Jeffmagma
    For some reason, it seems like my stages are not working. I opened my game in single player on the debug panel and the only available move is stage_1 and after entering stage1 no more moves become available
    image.png
    1 reply
    each move just moves you onto the next stage for testing purposes
    image.png
    fuenfundachtzig
    @fuenfundachtzig
    Hi! I updated from boardgame.io@0.42.2 to boardgame.io@0.49.10. One of the changes is that in interface SocketIOOpts socketOpts? was changed from any to ioNamespace.SocketOptions. Unfortunately, this means I can no longer initialize my Client with multiplayer: SocketIO({ server: server_url, socketOpts: { path: '/sub/socket.io' } }) because path is no longer accepted. Any ideas?
    13 replies
    Theo Salzmann
    @on3iro
    Hi, I am currently trying to build a docker-compose setup with a boardgame.io-client, boardgame.io-server and a caddy-reverse-proxy container. It seems to work in general, but I can't get the Socket.io setup right and the socket always hangs up. Does anybody have experience with this and could help me?
    13 replies
    Theo Salzmann
    @on3iro

    Hi, its me again 😅
    I am currently having a weird issue (I probably had it before, but did not realize it).
    Inside my game definition I set a seed for randomization. The seed is being generated by a call to nanoid().
    However I noticed that the seed will only be set once for the game, not for each match instance I create.
    Therefore each match will have the exact same randomization output.
    I noticed this issue from 2018 boardgameio/boardgame.io#233 - however if I interpret it correctly, this has long been resolved.
    Now I am wondering what I should be doing differently. I haven't found a way to tell the server to use a new seed when a new match is being created via the lobby API.

    What am I missing here? :)

    AHHHH nvm. I missunderstood how the seed works. The server already generates a new seed for each match. Overriding the seed is only necessary, if I want to use a specific seed (e.g. for testing etc.)

    1 reply
    captaindopey
    @captaindopey
    Hi All,
    I think i'm missing something simple. :) I have a game I've just updated from v0.44 - which used to work.
    Basically, it's the whole "you can pick up until the next player plays" scenario.
    I've implemented it as a stage that the current player goes into just after endTurn() is called... but it's not working any more.
    Code looks like so:
    var activePlayersValue = {}; activePlayersValue[ctx.currentPlayer] = 'pickup'; //store up the current player to put into the pickup stage. ctx.events.endTurn(); ctx.events.setActivePlayers({ currentPlayer: Stage.NULL, value: activePlayersValue, maxMoves: (6 - cardCount) }); //let them draw back to 6?
    Should I be doing this some other way now?
    1 reply
    PerpetualPhoenix12
    @PerpetualPhoenix12
    Is it possible to have a game's state only be modified by one client but also let other clients connect to the server to view the game's state but not be able to modify it? Sort of one person plays the game on their client and others can watch it happen in real-time.
    3 replies
    Ali Jaya Meilio
    @alijaya
    Hello, I'm using Vue and typescript. Need some direction here. When I use Client.subscribe(someFunc), how could I declare the type of someFunc? It seems I need to import the type of ClientState<G> but I don't know how.
    4 replies
    Andrew Zielinski
    @andrewzielinski
    Hi All,
    Does the AI run on the server or client? If only the client, is it possible to make it run on a server? Also, is it possible to have AI vs AI without a visual client?
    Chris Swithinbank
    @delucis
    @andrewzielinski The current simplest bot set-up is client-only. It is theoretically possible to use the MCTS bot class on the server but currently requires some custom server code. Here's the issue tracking adding this feature in a more friendly way: boardgameio/boardgame.io#383
    If you want to run AI vs AI matches on the client you can provide a bot for every player ID:
      multiplayer: Local({
        bots: {
          0: MCTSBot,
          1: MCTSBot,
        },
      }),
    1 reply
    PerpetualPhoenix12
    @PerpetualPhoenix12
    Is there a way to test whether my game data is JSON-serializable? Whenever I start a remote server and connect to it, one of the moves that modifies the game data returns this error (only when connected to the server): "TypeError: Cannot read properties of undefined (reading 'observeArray') at Proxy.mutator." So I feel I must have something I shouldn't in my game object?
    Chris Swithinbank
    @delucis
    Curious. We do have a check that should throw that error in versions 0.43.3 and higher (implemented in this PR boardgameio/boardgame.io#896)
    But it won't run if the NODE_ENV environment variable is 'production'. Maybe double check process.env.NODE_ENV is set to something else during development.
    Chris Swithinbank
    @delucis
    Searching for observeArray throws up mostly results for Vue. Is that what you’re using?
    10 replies
    Adam Gainer
    @againerdev
    Hey, Super excited to be here. I just completed the Tic Tac Toe Tutorial! As someone who has always kind of struggled with JS and react, I'm over the moon , I'm working on porting over one of my favorite boardgames to a web version so a friend and I can play across country.
    Chris Swithinbank
    @delucis
    :wave: Welcome, @againerdev!