Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Larry Wang
    @larry801
    Here is a minimal reproduce .
    4 replies
    Kumar Ayush
    @cheekujodhpur
    Hi. I am trying to do a card game where the players can fold. What is the best way to store player state? Is there anything the framework provides or I just do my own maintenance in the game state?
    activePlayers seemed logical, but it seems to do something entirely different
    3 replies
    Lee Matos
    @leematos
    Hiya! I'm looking to make a game where players each control 3 pieces at the start of the game, and through gameplay pieces may be removed from the board. What is the best way to represent associated actions with the pieces? For example, I'd like a turn to be roll die -> movie piece and then do it for any remaining pieces. Basically "optional stages" I think would allow for it, but wasn't sure if I was thinking about this wrong. Maybe I need to trigger the same stage multiple times, once,for each active piece?
    Kehino
    @Kehino
    Hello! I'd like to create a phase where every player can play once, whatever the order. I've used ActivePlayers.ALL_ONCE to let them play, then I set its endIf: (G, ctx) => (ctx.activePlayers === null), but the phase is skipped because setActivePlayers() is not immediately called. Could you suggest a clean way to do? For the moment, I added a ctx.numMoves > 0 condition to the endIf above, because it's at the beginning of the game.
    Larry Wang
    @larry801
    I have dealt with things like this, I added a flag for every player in G. Set flag to true in move code of
    each player. Check flags in endIf, if all player has moved then trigger end phase.
    Chris Swithinbank
    @delucis
    @Kehino ctx.numMoves represents the number of moves by the current player during the current turn, so ctx.numMoves > 0 && ctx.activePlayers === null should work later in the game too.
    Chris Swithinbank
    @delucis
    @/all Any Heroku users able to debug this question about deployment? boardgameio/boardgame.io#815
    Ruslan Hydra
    @HydraOrc
    Guys, I have published a free mobile Android strategy game based on boardgame.io called Steel Civilizations.
    You can find it here https://play.google.com/store/apps/details?id=com.hydra.steelcivs
    The AI is just a random bot, so do not expect much from it when launching the training mode. Playing vs AI works on any Android version.
    The focus was to create a multiplayer experience for players and you can try it if you have at least Android 9 (maybe 8 will also work, but I did not test yet).
    So if you login and start searching at the same time it should face you against each other.
    The multiplayer restriction on Android version is based on the fact that there are no timer events/moves in the framework and I had to workaround it with raf and it definitely does not work correctly on Android 7 or less.
    Thanks for your attention and thanks for a great framework :)
    1 reply
    Shawn Wilson
    @glassgiant
    I'm looking to create a multiplayer Connect4-type game, except each player is assigned a team of, say, up to 100. Alternating timed turns between teams. Each team member can vote for the column, in any order. When time's up, the most popular answer is chosen. Failure to vote doesn't hold up the game. Dropping out doesn't hold up the game. I have a multiplayer game working (not using React), but I am having trouble figuring out how to set the stages or phases to accomplish the team aspects, as the framework seems tied to individual player turns. Is there anything in my description that boardgame.io cannot do, on a conceptual level? From a high level, how would you implement this?
    3 replies
    Kehino
    @Kehino

    I have dealt with things like this, I added a flag for every player in G. Set flag to true in move code of
    each player. Check flags in endIf, if all player has moved then trigger end phase.

    Thanks @larry801 ! I thought about it, but instead -- in the meantime -- I opted for: (1) no endIf; (2) a call to endPhase() at the end of my onEnd() to ensure that everything is set up.

    @Kehino ctx.numMoves represents the number of moves by the current player during the current turn, so ctx.numMoves > 0 && ctx.activePlayers === null should work later in the game too.

    Thanks @delucis ! Duly noted!

    Kehino
    @Kehino
    Almost all my moves involve working with non-disclosable data -- part of the suggested G.secret and G.players -- and will thus be client:false moves: should I conceive them differently?
    Larry Wang
    @larry801
    @Kehino G.players of current player is disclosable
    4 replies
    Justin Daining
    @codequistador
    Greetings friends! I feel like I'm missing something obvious here! I'm getting the dreaded An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft. Error. This works just fine without the ... and return {} but I also need to remove the card from playerHand. I have that working but not included here.
    function discard(G, ctx, id) {
      let playerHand = [...G.players[ctx.currentPlayer].hand];
      const discardedCard = playerHand[id];
      const discardedCardColor = discardedCard.color;
    
      let discard = [...G.discard];
      discard
        .find((el) => el.color === discardedCardColor)
        .cards.unshift(discardedCard);
    
      return {
        ...G,
        discard,
      };
    }
    4 replies
    Kolja Kutschera
    @koljakutschera
    Hey, i need exactly the functionality of: https://github.com/delucis/bgio-effects but without react. I cant find something in the docs but i need something like useEffectListener for plain js... also it seemed when i tested the react version that effects are fireing on every move when used with Ai, so when Ai does its magic it is fired 1000x times not only for the move the Ai then realy does... whould be thankful for every help...
    5 replies
    Lachlan Kingsford
    @lkingsford
    Did typescript types end up getting implemented? I'm doing the tute in TS, and having to using 'any'. Is it a different import?
    2 replies
    Lachlan Kingsford
    @lkingsford
    What do most people do with the lobby? Looking at what auth and ids it offers, I implement auth somewhere else to keep track of what games players are in, run that on another service, and then create games using the REST API from the user service?
    Larry Wang
    @larry801
    @delucis Could you please release a new version of boardgame.io to include recent fixes?
    3 replies
    Kim Kyeseung
    @kimkyeseung
    is there any ways to get the game started or not???
    at lobby REST api..
    I just wanna make start button at the lobbyContainer
    Kim Kyeseung
    @kimkyeseung

    I got a good idea to solve that problem
    It's put the state of started or not to the first player's meta data
    Larry Wang
    @larry801
    @kimkyeseung Could you please explain your solution in detail? When and how to update that started state?
    Kim Kyeseung
    @kimkyeseung
    @larry801
    at the joined array, the first index of array is the game host.
    we put the meta data to first User to joined array like this
    {
      playerID: userId,
      credentials,
      data: { started: false}
    }
    and after start button click, we gonna change of firstUser's meta data started: true
    cwatsonc
    @cwatsonc
    anybody have some general knowledge about the debug console? It doesn't appear to work in remote server configurations was curious if this is a documented limitation? I am developing a fbgio hosted game and discovered this behavior.
    sorry, last post was re: debug LOG tab... which appears to only work in local games.
    Larry Wang
    @larry801
    "Does no work" is too vague, please describe your issue in detail
    aflorj
    @aflorj
    Hey! Are there any projects that use playAgain API that I could check out? My "solution" works but feels really clumsy. I was searching through repos that have bgio as a dependency but wasn't able to find an example.
    cwatsonc
    @cwatsonc
    @larry801 you want me to open an issue for a general question? or explain here in full with tests as shown in boardgameio/boardgame.io#810? When using the debug console in remote game mode, no history for moves is being accumulated in the debug > Log? Is this expected?
    Chris Swithinbank
    @delucis
    @cwatsonc The next release should improve the debug panel’s Log tab quite a bit for server games with any luck (there were a bunch of issues with both state and rewind). That said, I would still expect the move history to accumulate with the current version — just potentially with some weird gaps.
    cwatsonc
    @cwatsonc
    @delucis thanks, I think I found my issue I am deploying in freeboardgames implementation and was having issues exposing their config as a service on my local workstation. I can see now that the messages should accumulate in this mode. can you identify which release contains the improvements you describe? I'll watch that thread and track when it arrives in FBG's implementation.
    Chris Swithinbank
    @delucis
    @cwatsonc Ah, OK. The fixes are currently unreleased, but will be included in a release within a week or so (might take longer than that for freeboardgames to update to the latest release though). Guess it’ll be either v0.40.1 or v0.41.0.
    Rakesh Sharma
    @raxy_twitter
    I am facing a problem when people join and leave game, it removes the game file if everyone leaves the game, I want the game to be always there, even if all the players had left, as they can join again and play
    4 replies
    Adrian Gaudebert
    @adngdb
    Hey all! I would like to implement a "Concede" button in my game. Making the move is easy (ctx.events.endGame({ winner: opponent })), but I would like players to be able to concede at any moment. By default, moves cannot be executed while a player is not active, and thus my players can only concede during their turn. Is there a way to declare that a move can be called at any time, in any phase or stage?
    3 replies
    James Rushford
    @JamesRushford_twitter

    Hi!
    I'm making a card game, you can can see it in action here and the code here

    I'm having trouble with the AI.

    I'm building a practice mode for single player where the AI makes a random move. The possible moves are listed out fine, problem is, I don't know how to tell it to make a move.

    My idea was to to put the function in the general onEnd attribute. I found a function makeMove in boardgame.io/src/core/action-creators.ts tat might do the trick, but it is not exported. Are there currently any ways I can do this?

    2 replies
    cwatsonc
    @cwatsonc
    I'm trying to upgrade to v0.41.1 and am getting failures from the game property 'flow' something changed in the API?
    cwatsonc
    @cwatsonc
    is there somewhere in the docs describing this change? In all your examples I see them unwrapping nested props of game.flow is that appropriate for games.flow.movesPerTurn also?
    2 replies
    Siddharth Vaghela
    @artineering
    Hello everyone! I am almost never able to run the examples in the repository - I keep getting unresolved errors for various components of Boardgame.io. Any suggestions?
    1 reply
    Trung Pham
    @trung2012

    Hi everyone! First of all, I want to thank the creators of this library. It is super awesome.

    My question is: I'm trying to reuse some moves function already defined for the moves object in stages. I have 2 files: moves.ts and stages.ts

    When I define the stages in stages.ts with moves imported from the moves file, I got this "cannot access [move name] of undefined" error. When I copy the move from moves.ts to stages.ts, it works fine. Why is this happening? I don't have a lot of moves I'm planning to use in stages but if I had hundreds of moves, copy and pasting doesn't really makes sense

    3 replies
    Kyle G Sessions
    @kage23

    Hi everyone! I'm trying to implement a server version of my game, per the Multiplayer instructions in the documentation, but when I try to run the server, I get this error:

    Error: Cannot find module './Game/Game'
    Require stack:
    - /Users/kylegsessions/projects/ww-ttg/src/server.js
        at Object.<anonymous> (/Users/kylegsessions/projects/ww-ttg/src/server.js:2:24)
        at Generator.next (<anonymous>) {
      code: 'MODULE_NOT_FOUND',
      requireStack: [ '/Users/kylegsessions/projects/ww-ttg/src/server.js' ]
    }

    My server itself is very simple:

    const { Server } = require('boardgame.io/server')
    const { WeedWizard } = require('./Game/Game')
    
    const server = Server({ games: [WeedWizard] })
    
    server.run(8000)

    and here's the game it's trying to access:

    import { Game } from 'boardgame.io'
    ...
    export interface IPlayer { ... }
    export interface IGameState { ... }
    export const WeedWizard: Game = { ... }

    Does anyone have any ideas what might be going on? (If it makes a difference, the server file is .js, but the rest of the project, including the Game file, is .ts/.tsx.)

    Larry Wang
    @larry801
    backend is not compiled to js
    You can follow this example
    Kyle G Sessions
    @kage23
    @larry801 OMG, thank you so much, that was exactly what I needed! :D
    Kyle G Sessions
    @kage23

    Is it possible to access/modify game state in anonymous callback functions within moves? I'm getting the following error when I try to do so:

    TypeError: Cannot perform 'get' on a proxy that has been revoked

    I'm trying to do something like this:

    const moves = {
      moveName: (G: IGameState, ctx: Ctx) => {
        const onSelect = (value:number) => {
          // modify game state in here
          // close modal here
        }
    
        // open modal here
        const modal = Modal.info({
          // modal properties where I gather info from the player
          // modal contains a button that calls the above onSelect method
        })
      }
    }

    If I modify the game state directly within the move itself, it's fine, but when I try to modify it within a callback method like this, I get the above error.

    Kyle G Sessions
    @kage23
    I solved it by opening the modal and gathering info from the player before I call the actual move.