Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    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!
    Pablogomez98
    @Pablogomez98
    Hello everyone!! I have a issue building the app in the serverless option...As it says in the documentation, I've included "build": "parcel build index.html --out-dir build", in the scripts section of the package.json. When I build the project, it builds it self great, but when I open index.html in my browser, it gives me the error "Failed to load resource: net::ERR_FILE_NOT_FOUND". I've searched it on the internet and all I could find is to add "homepage": "./" in the package.json, but still not working. I've tried every file reference possible as well, but I didn't find any solutions. I have my index.html in the root folder and all the js scripts in a src folder. Hope somebody can help me out! Thanks!!
    1 reply
    Theo Salzmann
    @on3iro

    Hey folks,

    I am currently a bit confused on how multiplayer credentials work.
    My setup looks like this:

    • I have a react client
    • and I have the boardgame.io koa server
    • I want to authenticate via JWT
    • I have a custom login route, where user POST their username + password
    • the server will then issue a JWT and put it into an HttpOnly cookie, which will be used to authenticate all following requests

    Now as far as I understand the docs I need three things:

    1. A generateCredentials function which retrieves some unique key (the username in my case)
    2. An authenticateCredentials function which checks if the credentials provided are valid
    3. I need to set the credentials prop on the GameClient-react component

    I assume that the authenticateCredentials function takes whatever I put into the React-Components credentials prop as its first parameter. Is that correct?
    This means I would not be able to use an HttpOnly-cookie because I won't be able to access it via JS from the client, so that I can hand it to the GameClient.
    Is there anything I am missing? There does not seem to be a way to access the koa app.ctx inside the authenticateCredentials function, so that I could get the cookie from there.

    3 replies
    Grzegorz Pociejewski
    @pociej
    Hi, Im on boardgama io 0.49.10 instead of game board i see 'connecting'
    where my game server is running
    i see this from socket.io
    {
    "code": 5,
    "message": "Unsupported protocol version"
    }
    Do you have idea of what is wrong ?
    1 reply
    Sky
    @skyplor_gitlab
    Hi have you guys encountered issues relating to websocket e.g one of the players not getting updated of the state and because the game is a turn-based game, the player only get the state at the last few seconds and couldn't make a move. Any idea how we can simulate that to test and fix it?
    17 replies
    SamyGarib
    @SamyGarib

    I'm looking for a freelance JS developer to help me finish and maintain my VueJS + BoardGameIO project.

    The second version of my game (www.abak.me) is built on vueJS (3) + boardgame.io + expressJS. I wrote almost entirely the UI and a huge part of the server-side methods. Still, I need a lot of testing, debugging, and implementing some functionalities, messages, and server-side tools to monitor and manage server-side behavior.

    Here you can see the production version (#1): https://www.abak.me Here you can see the new version I'm working on (#2): http://54.213.212.155/

    The issue is I'm not in the mood to keep programming. I'm an old guy with a job and a family and, to do this, I need heavy inspiration, which I had six months ago (while I was learning to use vue), but I'm laking right now. But I really want to upgrade my game version, so I need help and decided that this might be the best place to look, given the engine I have used, and yet the boardgame.io part is done.

    These are the tasks needed to finish it; most of them are server-side:

    • Order and unify server APIs: Some are on Koa's internal server; others are in a different express server (a consequence of the learning process).
    • Test and debug P2P invitation system. It is working but barely tested. Some border cases or unexpected scenarios (network loss) might create a problem. (Implemented, barely tested).
    • Test and debug statistics storage (at the end of the game, make some calculations and save to the DDBB (implemented, with bugs).
    • Implement a medal system. Based on statistics. (Nos implemented)
    • Implement firebase auth with google account, Facebook and Twitter (not implemented, A simple cookie-based method is currently implemented).
      • I have an android and iPhone webview app that, when loads the page, uses the native SDK. I want to conserve that.
      • Implement logout and account deletion (not implemented).
    • Improve API security. (Implement a JWT based solution).
    • Create API methods for getting statistics:
      • Games actives.
      • Games today.
      • Games this month.
      • etc.

    I think the code is reasonably well arranged and easy to follow. It is not really commented, though, but I can be your wiki.

    I would love to work with a talented programmer who likes the game and aligns itself with my objectives. I can pay with Paypal and cryptos. We can define payment for each task, and we should need to have an induction session to explain the components.

    Please get in touch with me (abakevolution@gmail.com or @abakevolution) if you are interested.

    I'm sorry I used formatting. I wasn't expecting it to be so extravagant. And I'm sorry if I'm misusing this chat.
    1 reply
    Richard L
    @richardl62
    Hi, The home page says, BGIO supports game logs with the ability to time travel (viewing the board at an earlier state). But I did find any documentation about how to do this. Could someone point me in the right direction? Thanks - and apologies for what is probably a beginners question.
    4 replies
    Jeffrey Gao
    @Jeffmagma
    Hi, how would you retrieve the id of the player who made a move? If i put everyone into a stage so they can all make a move in real time, where in G or ctx is the playerID? I can see it in props when rendering the board as props.playerID. Would I need to pass it back from there into the move parameters?
    1 reply
    Richard L
    @richardl62
    Hi. Is it possible to (temporally) abandon turn order and allow an arbitrary player to make the next move? There are a few occasions when this would be useful for my games. Thanks.
    4 replies
    Colin
    @cuken
    Hello all =) Is anyone using boardgame.io for CCG's? I didn't see any prebuilt deckbuilding functionality but I may not be looking in the right area.
    16 replies
    captaindopey
    @captaindopey
    Hi All - quick one - I'm implementing a trick taking type card game - and it's all working well, I'm just trying to work out the best way to handle the 'end of trick' - in reality I want to update the state (play the card to the table), wait a couple of seconds (to display who won the trick) and then update the state again (score / clear the table etc). At present it's all working with them in a combined update. I've tried using bgio-effects to animate (which I'm finding very cool) - but that means I have to calculate the intermediate state in the display, or pass then entire intermediate state as payload to the animate method? [I only seem to be able to access the initial state or the final state] Or should I be handling it some other way, like some other additional move with gets triggered on one of the clients?
    4 replies
    Xwilarg
    @zaeazea:matrix.org
    [m]
    Hey, I'm trying to make a simple board game with boardgame.io and I have a mechanism where I select a piece and it displays where I can move it but I have no idea where to place this, on the tic tac toe example everything is done on "moves" but if I place something here to turn automatically ends
    Any hint on how to do that?
    1 reply
    Kevin Chen
    @kevinddchen
    If I want to make a player-viewable game log, is it OK to include it in G? For concreteness, suppose the log is an array of strings that gets longer the game goes on, maybe to ~1000 lines maximum. Will I run into memory issues? I am asking because I don't know if the game state G is copied every move in order to implement the undo functionality, in which case the memory consupmtion grows quadratically? I hope this is not the case, but I just want to double check
    4 replies
    Leo Trubach
    @leotrubach
    Hi! How to subscribe to "opponent made move" event on client side?
    5 replies
    Theo Salzmann
    @on3iro

    Hi,

    is there a way to access match specific data on Game.onEnd()?
    The reason I am asking is the following:
    We have a user section, where the user can see their archived games (so games where they took part in and where the game has ended).
    However it might sometimes happen, that a player is not connected while gameOver is being triggered.
    We want to display a notification inside the archived section in that case.
    What we currently do is, to send an API request updating a column in our DB to our server, from our React-client (inside an useEffect-Hook, which checks if the game has ended and if the user is currently connected).
    However because of this, if a user enters the game afterwards and another player is no longer connected, the notification will be set for the other player. And this will go on and on and on...

    Therefore I would like to send the request inside Game.onEnd, so that it gets triggered once at max.
    Related to this is the question if it is possible to only run onEnd() or certain parts of it on the server?
    This would eliminate the need to send an API-request, as I could simply update the database.

    Ofcourse there are lots of ways to work around this, by setting flags inside the DB. But it would be quite nice if there was an easy way to solve this.

    Thanks in advance :)

    6 replies
    Kuta2kuma
    @Kuta2kuma

    Hi all,
    I am sort of a newbie and trying to figure out how to let the user submit values via a form with moves:

               <form onSubmit={() => moves.selection()}>
                  <label>Check card values and press "Submit" to start:</label>
                  <input type="text" name="userInput" defaultValue={G.fibonacci} />
                  <input type="submit" value="Submit" />
                </form>

    Though I am sort of confused what goes wrong, when I try to update G.fibonacci and change G.started

    phases: {
        setCards: {
          start: true,
          next: "voteNumbers", 
          onBegin: (G, ctx) => {
            G.started = false;
            G.fibonacci = [0, 1, 2, 3, 5, 8, 13];
          },
          endIf: (G) => G.started == true,
          turn: {
            activePlayers: {
              all: "selection",
              moveLimit: 1,
            },
            stages: {
              selection: {
                moves: {
                  selection: (G, ctx, selection) => {
                    selection.preventDefault();
                    fibonacci = selection.target.userInput;
                    G.started = true;
                  }

    I am also getting this error:
    ERROR: move not processed - canPlayerMakeMove=false - playerID=[0] - action[selection]
    I am fairly new to everything – can someone maybe give me some pointers on how to change the value of Fibonacci and change Started?

    9 replies
    Nick Jordan
    @nickcjordan
    Hi all, does anyone have any good examples of using MCTS bot with heuristics? Or really just how to provide a little more logic to the AI more than just giving a list of possible moves
    Nick Jordan
    @nickcjordan

    I have found a small example defiing objectives in ai.test.ts after coming across this thread: boardgameio/boardgame.io#7

    but I can't get the objective checkers to fire... the example in the thread shows defining a custom Bot derivative class that gets passed into the Client's "multiplayer: Local ( bot: CUSTOM_BOT ) " but I dont know how to define objectives for the "ai" section of the Game, and dont know how to pass in a custom Bot class implementing objectives for single player mode.

    any help would be appreciated!

    Nithiwat Sirirattanachaikul
    @nitsirs
    This message was deleted
    Nithiwat Sirirattanachaikul
    @nitsirs

    Hi all, I'm new to boardgame.io - I'm trying to run the game on a remote master by following the docs, but the Client just simply says: "Connecting..." without any error. (Same as this codesandbox)

    here's my server.js

    import next from "next";
    import { Server, Origins } from "boardgame.io/server";
    import { ThaiCrossword } from "./game/game";
    import Router from "@koa/router";
    
    const appPort = 3000;
    const apiPort = 8000;
    const dev = process.env.NODE_ENV !== "production";
    const app = next({ dev });
    const handle = app.getRequestHandler();
    
    app.prepare().then(() => {
      const server = Server({
        games: [ThaiCrossword],
      });
      const router = new Router();
    
      router.all("(.*)", async (ctx) => {
        await handle(ctx.req, ctx.res);
        ctx.respond = false;
      });
    
      server.app.use(async (ctx, next) => {
        ctx.res.statusCode = 200;
        await next();
      });
    
      server.app.use(router.routes());
      server.run({
        port: appPort,
        lobbyConfig: { apiPort },
      });
    
    });

    Client side:

    import { Client } from "boardgame.io/react";
    import { ThaiCrossword } from "../../game/game";
    import { SocketIO } from "boardgame.io/multiplayer";
    import ThaiBoard from "../../game/thaiBoard";
    import { useRouter } from "next/router";
    
    const ThaiBoardClient = Client({
      game: ThaiCrossword,
      board: ThaiBoard,
      multiplayer: SocketIO({ server: "http://localhost:8000" }),
      debug: false,
    });
    
    const App = () => {
      const router = useRouter();
      const { playerID } = router.query;
      return (
        <div>
    
          <ThaiBoardClient playerID={playerID}/>
        </div>
      );
    };
    
    export default App;

    Is there something wrong?

    5 replies
    Theo Salzmann
    @on3iro

    Hi,
    I am trying to add a middleware to the 'match/join' route, which also reads the playerName from the body.
    However if I also add the koaBody()-middleware I get a "stream is not readable"-error (after my middleware ran).
    I assume that this is because the join-route itself also includes the koaBody-middleware, but the body has already been parsed (and somehow koaBody seems to throw on that).
    If I don't use koaBody I can't access the playerName.

    Any idea what I could do here?

    Thanks in advance

    2 replies
    andrscyv
    @andrscyv
    Hey guys! I'm interested in using bots in multiplayer games with remote master server and would like to contribute for this feature. I made a high level description of my proposal here https://github.com/boardgameio/boardgame.io/issues/383#issuecomment-1107711313 . I would appreciate any feedback and guidance you could provide ! @delucis
    Kuta2kuma
    @Kuta2kuma

    Hi, it's me again, one quick question (though it's not directly in regards to bgio; I do apologize):

    I try to deploy the game app with the bgio lobby to a nginx web server but keep getting 404 errors when trying to create a game.
    Does someone have experience with setting up the lobby on nginx web servers and could provide some advice on how to get the game finally online.

    On localhost everything's working like it should though and so it seems the server configuration is not as needed by the lobby component.

    Nuno Balbona
    @NiciusB
    This engine seems perfect for my needs, but being unable to use classes is a non-starter
    Has anyone here had luck implementing serialization of the game state in some way?
    I'm wondering if I should bother working on that or if it's not gonna be worth it
    2 replies
    itsjesseyo
    @itsjesseyo
    Hello. I've been playing with BGIO for a couple of weekends now and love it. I've tried reading back as far as December but didn't see anything that might help me with my question, which is as follows: I am trying to allow a user to join a match via a 4 character code like with jackbox games. I was thinking I would add a custom route to save and retrieve a lookup from the 4-letter code to a matchid but cannot seem to find how to store additional data in the server storage. Is there a BGIO-centric way to do this or does anyone here know how to storage/retrieve key/values on the existing server storage? Also... how do i get a matchid from within the react components? Looks like I am going to have to use the API to create a game and store the matchid myself, but the tutorials do not go into this. Thanks and... where do i donate to the cause?
    12 replies
    iamevn
    @iamevn:matrix.org
    [m]
    would love for more of the types to be importable
    1 reply
    iamevn
    @iamevn:matrix.org
    [m]
    the two above are what I've hit so far but personally I think any type that one can get a reference to should be available to import
    maybe for cases like _ClientImpl that would mean defining and exporting an interface that it implements rather than simply exporting internal class
    happy to have a go at putting a PR together
    Chris Swithinbank
    @delucis
    I think if you do something like import type { _ClientImpl as ClientClass } from ...
    And then export that, we can even expose the full type.