Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Chris Swithinbank
    @delucis
    Some searches suggest the socket.io client is supported in React Native, but I don't know if we are making any assumptions in the transport code that won't work on React Native. If that's important, I might suggest trying to add it to that example app first to double check multiplayer support.
    Chris Swithinbank
    @delucis

    @/all We’ll soon be releasing v0.50 which will come with a breaking change in how game moves and other functions are written.

    You can see details of the change and migration instructions at this PR: boardgameio/boardgame.io#891

    If anyone’s feeling like a brave early adopter, an alpha release is available today, you can get it by installing the alpha release tag:

    npm i boardgame.io@alpha

    Let me know how migration goes. It would be helpful to know about any particular points before launching this as the main release.

    SylvanSign
    @SylvanSign
    Is there a simple way to hook into the Server's SocketIO to create a separate namespace & other Sockets for custom logic?
    Specifically, I'm interested in using socket.io for custom lobby management before my game is ready to start. Was curious if there were any code examples of something like that
    3 replies
    Lucas Connors
    @RevolutionTech

    Hey all, I've been using boardgame.io over the past year or so for a side project and I love it so far. Thank you for creating it!

    I'm seeing some behaviour in the server that I find a bit strange and wanted to ask some folks closer to the project for their thoughts on it in case I'm misinterpreting what's going on.

    I'm not currently using any form of persistence on my server, so when the server restarts any active games are lost. What's strange to me is that if a client from an old game is still active when the server restarts, the server seems to create a new game with the minimum player count (in my case, 2) and then tries to handle requests from the old clients on that new game.

    In my case, this is causing my server to crash when the old game has more than the minimum number of players because my playerView code is being called for a playerID of "2" (or higher) for a new game that was setup for only 2 players. I could write more defensive code in the playerView code to handle missing playerIDs the same as spectators, but it seems strange to me that this new game would get created in the first place. Is this intentional behaviour and should my code be accounting for playerIDs that don't exist in the active game, or is this a bug?

    5 replies
    fladrif
    @fladrif

    Hi all, I had a question regarding multiplayer client behavior. According to this doc https://boardgame.io/documentation/#/secret-state?id=disabling-moves-that-manipulate-secret-state-on-the-client clients will default to resolving moves on their own whereas we would need to specify that we only want the server to resolve the move due to gamestate incompatibility. Is there a doc regarding how/why clients behave in contrast to a non-multiplayer/local multiplayer state, and the tradeoffs?

    I have a situation where my test server uses local multiplayer whose moves seem to have access to the hidden gamestate, but the deployed server doesn't. I figure the easiest way to solve this is to have all my moves execute as non-client, but I'm wondering if there's some optimization I'll be giving up (this is assuming the server also resolved the move to ensure the client is correct).

    Chris Swithinbank
    @delucis
    @Fladrif not sure I understand completely but the only optimisation you give up is that the client will have to wait for the server to respond before updating once the move completes, so that can theoretically introduce a visible delay depending on connection speeds and server latency. You may not need to set every move not to run on a client. If a move only impacts the player making the move's own secret state then that can run on the client safely.
    2 replies
    Grzegorz Pociejewski
    @pociej
    Hi all, i have a question i had game running on with bgio and after last build it stopped working very strange way
    so
    i create Client with multiplayer: SocketIO({ server: bgServer })
    it was working ok but now i see error that it tries to connect
    to bgioServer:80/socket.io/?EIO...
    it should be and was
    bgioServer/socket.io and everything was working fine but suddenly somethign started adding por :80 to the url
    do you know why it is like this ?
    5 replies
    Francisco Alamino
    @JOYBOY-0
    Hi! I have a question. I'm trying to achieve a Yugioh like monsters, wich effects can include something like an event listener, for example: 'when this card is destroyed...'. Is there any efficient way to do this?
    8 replies
    Francisco Alamino
    @JOYBOY-0

    Hi! I'm trying to deploy my app (front end on my server and server on heroku) and I'm getting this error in the frontend

    arena:1 Access to XMLHttpRequest at 'https://ws-game-master.herokuapp.com/socket.io/?EIO=4&transport=polling&t=NwXsM7G' from origin 'https://www.world-seekers.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    and this error in the server log

    2022-01-28T18:00:24.286135+00:00 app[web.1]: Server `origins` option is not set.
    2022-01-28T18:00:24.286148+00:00 app[web.1]: Since boardgame.io@0.45, CORS is not enabled by default and you must explicitly set the origins that are allowed to connect to the server.
    2022-01-28T18:00:24.286149+00:00 app[web.1]: See https://boardgame.io/documentation/#/api/Server
    2022-01-28T18:00:24.323597+00:00 app[web.1]: server running 11469
    2022-01-28T18:01:22.967180+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
    2022-01-28T18:01:23.026541+00:00 heroku[web.1]: Stopping process with SIGKILL
    2022-01-28T18:01:23.057766+00:00 app[web.1]: Error waiting for process to terminate: No child processes
    2022-01-28T18:01:23.175484+00:00 heroku[web.1]: Process exited with status 22
    2022-01-28T18:01:23.242359+00:00 heroku[web.1]: State changed from starting to crashed
    If it helps, this is how my server looks like
    const { Server } = require('boardgame.io/server');
    const { WsGame } = require('./Game');
    
    const port = process.env.PORT || 8000
    
    const server = Server({games: [WsGame]});
    
    server.run(8000, () => console.log('server running ' + port ));
    Francisco Alamino
    @JOYBOY-0
    Including origins property doesn't fix it
    const { Server } = require('boardgame.io/server');
    const { WsGame } = require('./Game');
    
    const port = process.env.PORT || 8000
    
    const server = Server(
      {games: [WsGame],
      origins: ['https://www.world-seekers.com/'] });
    
    server.run(8000, () => console.log('server running ' + port ));
    Chris Swithinbank
    @delucis
    Hmm, the origins setting would have been my first bet. Just in case it helps, does removing the final / from the origin help?
    Ah wait. But the second part of the server log looks like something else is wrong, no? “Web process failed to bind to $PORT within 60 seconds of launch”
    I’m not familiar with Heroku myself, but maybe you need to get the port from the environment like in the code snippet included there:
    const PORT = process.env.PORT || 8000;
    
    server.run(PORT, ...);
    Francisco Alamino
    @JOYBOY-0
    Sure, I'm following that guide
    Oh! I think I'm missing the procfile
    Chris Swithinbank
    @delucis
    I think that’s optional if your start script in package.json is correct.
    I think it’s that you’re still using port 8000:
    server.run(8000, () => console.log('server running ' + port ));
    If you see the logs, they read server running 11469
    So the process is providing you a port number 11469 but you’re actually using 8000 as the argument to server.run.
    Francisco Alamino
    @JOYBOY-0
    OH MY GOD
    Chris Swithinbank
    @delucis
    :tada: :tada: :tada:
    Francisco Alamino
    @JOYBOY-0
    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