by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Solomon
    @nightfire445
    Hello! I've been taking a deep dive into the lobby component and the underlying koa api. One of the use cases for my project is to use the player name from the lobby inside the game that they join. My peek through the source seems to indicate that this is not possible since the join route appears to store the meta data with koa not with the game client, but I wanted to get confirmation that I'm not barking up the wrong tree with my assessment. Thank you in advance!
    2 replies
    Andrey
    @fxuniverse

    Hey folks. Huge props to @nicolodavis for a great framework.
    Wanted to share an adaptation for the classic Sequence game I made using it: https://sequence.cards
    It's in open beta, please feel free to test and share feedback on how I can make the game better.
    Also utilized - Angular 10, Angular Material, NgRx, Firebase for db.
    I plan to open source it, after cleaning up private keys and such.

    @nightfire445 to your question about using names in the lobby and later in the game - I bypassed the Koa app and just used Firebase directly, subscribing to the players array real-time

    5 replies
    Sushil Kumar Dhayal
    @skdhayal
    Hi, I have 8 players in multiplayer game mode. How do i allow each player with dynamic moveLimit ? Please help me.
    2 replies
    zhale
    @ZhaleTaheri_gitlab
    I want each phase to run with a delay time
    1 reply
    Zeb Ford-Reitz
    @zford-reitz
    Here comes yet another Heroku question: does anyone have a recipe for deploying both lobby and game when using React with Typescript? I tried ts-node to at least get it working, but those attempts also failed.
    1 reply
    Ram Agrawal
    @ramagr07
    Hey folks! Is there any way to get a client to join the game in spectate mode?
    1 reply
    Ruslan Hydra
    @HydraOrc
    Hey, guys, is there any way to fire a gameover event on the server side? Or do I have to check the database with some frequency for this?
    3 replies
    Sheldon Chen
    @SheldonSChen
    Hi, so I have two separate move functions with some lines in common that mutate G, and so I tried separating the common lines into a helper function, but I got UnhandledPromiseRejectionWarning: Unhandled promise rejection. Does anyone know how I can do this, or if it's even possible?
    1 reply
    David Friedman
    @Derongan
    Hello, I have a few questions
    1. Is there a way to set an initial stage like there is for phases? Or is it intended that the moves defined outside of turns are the "initial" stage?
    2. Do stages support an onEnd or any other triggers? It seems like it would be nice to be able to have multiple moves in a stage do the same cleanup automagically
    3. Is there any concept of temporary state for a phase? Say the furst move in a turn effects later moves in the same turn, but shouldn't affect the final state. Is the correct way to handle this just to clean up yourself using an onEnd trigger on the turn?
    5 replies
    Art Tosborvorn
    @artt
    Is there a way to delay the stage? Let's say a player rolls a dice and the token lands on some square... which happens to have some sort of modifier to it, so the token gets bumped elsewhere. Is there a way to have the two events separate by some delays? I tried setTimeout but seems like once the "move" function has returned, there's no way to refer to the Game object. Thanks!
    2 replies
    Nicolo John Davis
    @nicolodavis
    @HydraOrc I think I may have accidentally deleted your comment asking about bot objectives while trying to respond to it!
    To answer your question, there aren't any examples at the moment. I haven't looked at the bot API for a while now, and it's definitely not in the final state that I'd like it to be.
    1 reply
    zhale
    @ZhaleTaheri_gitlab
    Hi, I have a problem that ctx is not updated when the phase changes
    David Friedman
    @Derongan
    Is there a simple way to end a turn once a stage ends?
    1 reply
    I tried endIf once activePlayers was null, but it seems that endIf runs before the stage is changed
    Chris Swithinbank
    @delucis
    @Derongan endIf can work, but activePlayers is null when endIf is called at the start of the turn (not sure if there’s a good reason for this), so you need to also check if any moves were made:
    endIf: (G, ctx) => ctx.numMoves > 0 && ctx.activePlayers === null,
    Joao Lucas de Carvalho Arruda
    @jlcarruda

    Hello, I'm new using the boardgame.io and I have a strange error that happens when I try to use React with the Client.

    import React from 'react'
    import { Client } from 'boardgame.io/react'
    import { BrowserRouter, Switch, Route } from 'react-router-dom'
    
    import { GameJA } from '../game'
    import { Game } from '../pages'
    
    const GameClient = Client({
      game: GameJA,
      board: Game
    })
    
    export const Routes = () => (
      <BrowserRouter>
        <Switch>
          <Route
            path="/"
            exact
            component={GameClient}
          />
        </Switch>
      </BrowserRouter>
    )

    When I use the GameClient as the component prop for the Route, I get this error:
    Error: Function called outside component initialization

    Does anyone know why? D:

    2 replies
    Ruslan Hydra
    @HydraOrc
    Guys, how do you ensure that you do not run into race conditions when you allow both players to do moves simultaniously at the same turn or also if one player issues a couple moves at the same time (ERROR: invalid stateID, was=[11], expected=[13])?
    4 replies
    kamr
    @kamr
    image.png
    any ideas why my Lobby isn't working? the FE doesn't seem to hit the backend at all
    1 reply
    David Friedman
    @Derongan
    INVALID_MOVE is nice and all, but is there a way to return a reason with it that could be surfaced to the client?
    1 reply
    Art Tosborvorn
    @artt

    I created a clone of Camel Up (graphics is still a work in progress). Let's say the basic move is rolling a dice. The token gets advanced by the number on the dice. If the token lands on a tile with a modifying property, say, +1, then the token would get bumped by one. Let's say the roll is 3, the token gets moved to tile #3, and let's say the tile has +1 mod, the token would end up on tile #4. What I have right now is something like:

    moves: {
      roll: (..) => {
        roll()
        resolveMove()
      }
    }

    where resolveMove is the function determining if the token will need to be moved (if it lands on the tile with a modifying property, that is). So the client gets only the board state after everything is done, and only knows that the token got moved from tile #0 to tile #4.

    I'd like to create an animation in between, so that the client would see a roll of 3, see the token gets moved to tile #3, then (after a delay) gets bumped to tile #4.

    My question is, how should this be done?

    One way is to have the server send out multiple state changes (so the move would be roll (return token at #3) -> delay -> resolveMove (return token at #4).

    Another way is to provide the client with resolveMove logic, so the client could figure out the animation by itself.

    My intuition is that the latter way should work better. Just wanna confirm that. Thanks a lot!

    1 reply
    kamr
    @kamr
    image.png
    9 replies
    sorry @adngdb - I don't seem to be able to paste an image in a thread
    kamr
    @kamr
    image.png
    Corentin Dancette
    @cdancette
    Hi! I'm having an issue with boardgame.io. I noticed that when I return an INVALID_MOVE, for the current player which is in a specific phase, it ends the phase instead of doing nothing
    2 replies
    Is this an expected behaviour ? From reading the doc it seems that returning INVALID_MOVE should not change the state G or ctx
    Adrian Gaudebert
    @adngdb
    Hey @delucis, is https://github.com/delucis/bgio-effects in a usable state?
    3 replies
    kamr
    @kamr
    is there a way to change the "game" of a room? e.g. if I have 2 players in a room playing tic-tac-toe and I want them to be able to switch to chess?
    I guess I would need to create a new "chess" room, and have both players leave the current room and join the new one?
    1 reply
    rather than somehow just changing the game type of the current room
    Corentin Dancette
    @cdancette
    @delucis here's a codesandbox that reproduces the behaviour
    To reproduce: Click on the button "enter stage". This sends the current player in a specific stage. Then, click on the button "Invalid move". This shouldn't do anything, but it removes the current player from its stage (as seen in ctx.activePlayers , that goes to null)
    Oops, it seems that it actually has the desired behaviour
    Corentin Dancette
    @cdancette
    I'm not sure what happened in my app then, I certainly made a mistake somewhere, sorry !
    1 reply
    It works perfectly now :)
    1 reply
    Corentin Dancette
    @cdancette
    I have another question, about the "undo" action. I tried to add a button, but any time I press it, the server outputs "ERROR: playerID=[0] cannot undo / redo right now"
    same for the other player
    is there something to configure to make it work?
    Chris Swithinbank
    @delucis
    Ah, that’s probably due to this bug: nicolodavis/boardgame.io#565
    7 replies
    The logic accepting/rejecting undo actions is not very good with stages active at the moment.
    Corentin Dancette
    @cdancette
    Ah, yes, i'm using a lot of stages
    Thanks, maybe i'll implement my own undo if it's really needed!
    About stages, in the documentation, it says that they're mostly useful for non active players, but I'm using them a lot for active players, is this a bad practice ?
    I use them to restrict the range of actions that the current player can do
    Chris Swithinbank
    @delucis
    That sounds like a good use, sure! They’re helpful for both scenarios.
    (Also, rather than implementing a whole undo system, you may like to look at the underlying code linked in that issue — there could be some very small changes we could make to fix the undo system using stages.)
    Corentin Dancette
    @cdancette
    Okay, neat :)
    I really like boardgame.io btw, so thanks a lot @nicolodavis, @delucis and other contributors for your work ! It makes it so much faster to code a multiplayer game! I enjoy particularely not having to deal with networking and state synchronization..
    Chris Swithinbank
    @delucis
    Nice to hear!