Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Grzegorz Pociejewski
    @pociej
    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
    Francisco Alamino
    @JOYBOY-0
    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
    @JOYBOY-0
    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
    @JOYBOY-0
    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