Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    rateforx
    @rateforx
    Hi, how can I check on which stage the current (client) player is on?
    I cannot see anything of sort in the G or Ctx objects.
    1 reply
    Francisco Alamino
    @JOYBOY-0
    Hey! long time working with other parts of my game. Glad to see a lot of activity :D. Is there any correct way to use Unity with boardgame.io? I was wondering if I can just use the boargame backend and use unity as the client. This would be a great way to make my game multiplatform, but I don't know if its viable. If anyone already made something like this please be welcome to comment :D
    2 replies
    Nicolas Castejon
    @nicolasca
    Hey ! I have checked the deployment part with an example with Heroku for backend and client.
    Anyone has already done it with Vercel ? And how to setup such a deployment ? Thanks ! (I could not find an answer here and in the Github issues)
    David Torres
    @david-torres
    hello, I've been working on implementing a card game design of mine in BGIO (0.49.12). I'm mainly interested in having an AI opponent to test against and playing around with the bot simulations to see what I can learn from those games. A few things I couldn't seem to figure out though:
    1. I have the turn structure broken out into 3 phases: a main phase where the bulk of the moves should happen, a cleanup phase where things are setup for the next turn, and a draw phase. Is this the right way to structure it?
    2. the AI never seems to progress to the next phase or pass the turn, despite returning an empty "moves" array (returning false throws an error)
    3. I cannot seem to figure out how to prematurely end the phase either. ctx.events as shown in the docs is an undefined property so I am unable to call ctx.events.endPhase() when my enumerate function runs out of moves. instead the bot just loops forever finding zero moves until it gives up.
    4. I'm only giving the AI valid moves, yet it still sometimes hits an invalid move (trying to access a card that isn't there). should I be looking harder for a bug in my logic or is this something that is expected to happen?
    5. currently my game only needs to do one move in the cleanup/draw phases so I would think specifying min/max moves to 1 would force those moves to happen. if there were multiple moves possible in a phase, how would the ai->enumerate method work in that case?
    5 replies
    thanks for any help in advance :)
    IvoryHoward
    @IvoryHoward
    When it opens in 2019, the casino will have several different types of slots and table games available. Variety of slot machines, progressive jackpots, and a live dealer casino are all available (look at https://njcasimile.com/real-money-casinos/ reviews). It also has flexible payment alternatives, including bitcoin, and responsive customer support. Users may get their feet wet without risking any cash.
    Nightingale181
    @Nightingale181
    Hello guys!
    Is there any way of changing current game stage with moves?
    2 replies
    apollov
    @apollov:matrix.org
    [m]
    Hey all. I've got a card game build on boardgame.io where many actions are automated and done in the background: decks shuffling, cards dealing etc. I have react native client dealing with all of this. On some of those actions I'd wish I can show players some animations to make them better understand what's going on in the app. I'm thinking some kind of websocket messages, some kind of events, sent from the server to clients while the state is changing. Is there a way of achieving this or something like that? Or am I going in a wrong direction and possibly I simply should add a field to a state that will say which actions happened since the last move? Thank you in advance :)
    3 replies
    Francisco Alamino
    @JOYBOY-0
    I'm trying to implement a maxMoves in my mage but with the possibility of save moves for the next turn. Eg: I have 2 moves per turn, but if I only use 1, the next turn I will have 3 moves, and if the next turn I don't use any, I'll have 5, etc. Is there any /correct/ way to do this? I was looking for something like moves property in my G object and then use something like endIf in my turn object.
    1 reply
    shashadmo
    @shashadmo
    There are so many awesome ideas that I would like to use in my project too! But for now, I draw experience from other challenging games and use other platforms as references. What games are you looking at and want to use cool features for yourself? I have a rather large list, so it's harder to implement this in one project but I think that watchfulness is the key issue.
    Ghost
    @ghost~62da82506da03739849a643e

    Hi, does somebody know how to programmatically dispatch a move. For instance when the user executes the "rollDie" move and it hits 6. I want the "Spawn" move to be executed automatically without any user interaction.

    EDIT: In other words: How can I execute/dispatch a Move<G, Ctx> object.

    1 reply
    ugiezzz
    @ugiezzz

    Related to @ilivss question, can I execute a move/action with no user interaction at all? An example - on the turn start (OnBegin) I would like to automatically roll a die and more based on the result. with out the user taking any action on his turn unless the die hit 6. then I would like to provide the user the option to take a move.

    My problem is that ctx.currentPlayer or ctx.playerID are not defined at this stage. so I can not refer to the relevant player.

    2 replies
    SamyGarib
    @SamyGarib

    I'm having trouble trying to run a client from node. I would like to simulate a client to run a bot, but I cannot accomplish that.
    This is my code:
    import { LobbyClient } from "boardgame.io/client"; let lobbyClient = new LobbyClient({ server: 'localhost:8000' }); lobbyClient.listMatches('AbakEvolution') .then((resp)=>{console.log(resp)}) .catch((error)=>{console.error(error)})

    And gives the following error:
    ReferenceError: fetch is not defined

    What puzzles me is that this runs perfectly in a web browser, but not node.

    Is there a package I should use that is missing?

    1 reply
    Markovictory
    @Markovictory
    Hello, I just followed the tutorial with react on my local and the board doesn't update after making a move or when the game ends. Is there anything obvious that I should be looking out for? I've played with this package before on glitch with no issues. Any help much appreciated :)
    6 replies
    Emil Elgaard
    @shivan2418
    Are the docs / typescript defs out of date?
    I tried to call an event via ctx.events but that is not undefined.
    However I see that there is an object called "events" in the props of the Game object that contains all the methods such as setActivePlayers that shold be in ctx.events.
    James Moon
    @mooniker
    Is there a built-in or preferred way to allow a player to move multiple pawns during a turn? I'm looking at the docs, specifically attributes like minMoves and moveLimit, but I'm not seeing how to end a turn when a player moves all of their pawns.
    3 replies
    Noé Bonnet
    @Neodark7
    Hi ! can anyone guide me on how to handle player disconnection ? is there an event or something in the game logic i can use to update my player state when someone leave the game ?
    8 replies
    Noé Bonnet
    @Neodark7
    I create an issue about this boardgameio/boardgame.io#1088 I hope someone can help me to achieve that
    Sickeygames
    @Sickeygames
    Any guide on forking and using the forked dependency? The way I've done it is giving me Module not found: Error: Can't resolve 'boardgame.io/react'
    Bjarke Felbo
    @bfelbo
    Hey everyone, boardgame.io looks awesome! Excited to play with it.
    Anyone know why what made it take off so dramatically in Dec 2017? :sweat_smile:
    https://star-history.com/#boardgameio/boardgame.io
    Most repos don't take off like that right after launch :smile:
    https://star-history.com/#boardgameio/boardgame.io&colyseus/colyseus&Date
    apollov
    @apollov:matrix.org
    [m]
    Hey! Is there any library for creating a client on, say, Unity3D, while still having the server on boardgame.io ?
    Alex Rod
    @Alex23rodriguez

    Hello! im having trouble fixing the "Error: failed to retrieve list of matches (TypeError: NetworkError when attempting to fetch resource.)"

    I'm attempting to host the backend in heroku and the client will be hosted separately, but I can't seem to get this to work even on localhost

    2 replies
    Sickeygames
    @Sickeygames
    If I want to have classes for my cards, I can't store them fully in the board state because it doesn't allow that. So I'm just storing the data (i.e. {...someCardClass} and then when I want to use the method having to look that up and use the state rather than this. That seems really hacky. What's the right way to implement something like that? Would I have to store every cards unique methods as moves? (I'm hoping not)
    1 reply
    Judie Thai
    @djoodi

    hi all, I'm having a lot of trouble deploying to heroku. I was able to follow the docs to get the game working with a lobby on local, but deployment has been rough.

    could someone check my project here and tell me what I'm doing wrong? https://github.com/djoodi/web-omok

    3 replies
    0|2
    @skullhood
    Good morning, boardgamers. Is there any good way to hook onto specific Game state changes to update the game state for all other players with animations?
    2 replies
    Desmond Rivet
    @drivet
    Hi there. This might be a stupid question, but I'm trying out the basic Tic-Tac-Toe React tutorial. I'm finding that the board doesn't update when I click on it. I'm not sure what I'm doing wrong. Is this a known issue?
    3 replies
    Noé Bonnet
    @Neodark7
    Hi ! just asking the community again, can someone helps me with this issue ? boardgameio/boardgame.io#1088
    Noé Bonnet
    @Neodark7
    For now i'm considering creating a new match each time a player leaves. For example for a match of 4 players, player 2 leaves, a second match is created using the first match players data of the 3 other players (points, board positions, etc..) and all the players in the first match are automatically connected to the new match. But it's not the ideal thing to do for our project... does anyone have another idea ? To add some precision, in my game players who leave the game are not allowed to come back.
    Noé Bonnet
    @Neodark7
    @apollov:matrix.org i tried using plugins to achieve that like you suggested, but the plugin methods are not called when someone leave the match
    Gabriele Castellano
    @gabrielecastellano

    Thanks for this amazing framework!

    I am encountering a possible limitations in triggering some actions whenever something happens. Indeed, the available Events API is only for predefined events and is only related to the ctx object.

    To my understanding, it is not possible to create a custom event, and trigger / handle it server side from multiple areas of the code. For instance, I could define an event "CardPlayed" that is notified within a move (every time a player plays a card). Then, if there are one or more handler registered for that event, they will be executed. Otherwise nothing would happen.

    Am I missing something?

    2 replies
    Yoav
    @YoavHortman
    is PlayerID on context optional when in a move?
    e.g.: ctx: {..., PlayerID: string | undefined} correct?
    Desmond Rivet
    @drivet

    Hi all. I have a couple of conceptual questions I'm hoping someone can help me out with.

    Let's say I have a game with two stages in the turn section:

    turn {
      stages: {
         doSomething: { 
              moves: { DoSomething }, 
              next: "selectCardsAndShowOne" 
         }
         selectOneCardToShow: {
              moves: { SelectOneCardToShow} 
         }
       }
    }

    Basically, each turn you do some move (the "doSomething" stage) and then you have to, let's say, pick two cards from a deck, show on on the board, and discard the other (the "selectOneCardToShow" stage).

    My issue is that the move in the second stage ("SelectOneCardToShow") consists of taking two cards into your hand from a deck and choosing one to display to everyone. In my mind, and maybe this is the wrong way to think about it, it's only the last part that's the actual move, because the only part where the player has to make a choice. The first part, where the two cards are picked from the deck, isn't really under the player's control. He has to do it, and he has to pick the top two cards.

    So how do you model that first part? What part of the framework runs the code which takes the two cards from the deck and puts them into the player's hand?

    One thought that occurred to me is that I could do it as part of the previous move, the "DoSomething". At the end of that move, I could transfer two cards into the player's hand. But that seems messy, especially since those cards have nothing to do with "DoSomething".

    Is there a "beginStage" hook I can run? That could work but I didn't see one in the docs.

    Another option is to treat the "Pick two cards" part as a separate move. That seems weird too, especially since the player doesn't really have anything to do except pick the cards. No choice to be made or anything. I guess one could do that, but I'm still not sure how I'd "enforce" the move, since it's basically mandatory now.

    Any thoughts or ideas? Thanks in advance.

    3 replies
    Quentin Cavenel
    @kavneluxedy

    Hello guys, i have a big problem since few days, when i start my script cmd to launch my server, i get an error which says :
    "[C:\Users\kavne\Desktop\cardgame\src\server.js:1
    Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\user\Desktop\cardgame\src\server.js not supported.
    Instead change the require of server.js in null to a dynamic import() which is available in all CommonJS modules.] {
    code: 'ERR_REQUIRE_ESM'
    }"
    It Strange because my package.json contains "type: 'module' "

    Anyone could help me please ??

    2 replies
    Christopher Magendran
    @Christo54861816_twitter
    Hi guys I am currently working on creating a poker game on html 5 and would need help building it. Looking to outsource and pay to anyone here in cash or blockchain. My game would inherently have blockchain integration but would need help mainly in the game logic and code
    4 replies
    Joselito Viveiros Nogueira Filho
    @joselitofilho

    Hi guys. I have a conceptual question. I am working on a game where for each turn, each player should execute some moves and then pass the turn to another player to do the same moves, for example:

    Turn 1:

    • Player 1: GetCard -> Attack -> Move -> Pass to Player 2
    • Player 2: GetCard -> Attack -> Move -> Pass to Player 3
    • Player 3: GetCard -> Attack -> Move -> End Turn 1

    Turn 2:

    • Player 1: GetCard -> Attack -> Move -> Pass to Player 2
    • Player 2: GetCard -> Attack -> Move -> Pass to Player 3
    • Player 3: GetCard -> Attack -> Move -> End Turn 2

    ...

    How can I create a game structure for that?

    3 replies
    David Chapman
    @d3chapma

    Hi there,

    I have added a button to my game to allow the player to undo their last action, but when I click the button nothing seems to happen. I have confirmed that the handler is setup correctly and props.undo() is getting hit. Is there something else that I need to do to utilize undo/redo?

    2 replies
    OlgaPech
    @OlgaPech_twitter

    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.

    My problem seems to be, that I'm adding an array of very primitive Objects to the state:

    export class Card {
      suit: string;
      rank: number;
      shortname: string;
    
      constructor(suit: string, rank: number) {
        this.suit = suit;
        this.rank = rank;
        this.shortname = this.suit + this.rank;
      }
    }
    
    export type Hand = Card[];
    ...
    
    export interface SpadesGameState {
      bids: string[];
      score: number[];
      hands: Hand[];
      currentTrick?: Trick;
      lastTrick?: Trick;
      dealer: number;
      isSpadesOpen: boolean;
    }
    
    ...
    
    return { ...G, isSpadesOpen: false, currentTrick: undefined, lastTrick: undefined, hands: [[new Card("d", 1),new Card("d", 4)], [], [], []] as Hand[]}

    Is it really true that I cannot have a GameState that has a typed ("classed") property inside or should I search for the error elsewhere..?

    2 replies
    Juliano Rocha Barbosa
    @Juliano-rb
    Hi, anyone have the same problem below?
    I have two players in a game, when I call the leave match endpoint in one of then, the player still listed in matchData object with isConnected: true
    I'm using this endpoint: https://boardgame.io/documentation/#/api/Lobby?id=leaving-a-match
    3 replies
    Daniel Lujan
    @dlujan
    Hello. I need help please. I'm making a game that has two players. I'm running into an issue where I HAVE to MANUALLY toggle the player in the debug console in order for the player turns to work. You know, click it so that the grey box has an orange outline. How do I get this to happen automatically so that I don't have to click it each time? Thanks.
    2 replies
    Joselito Viveiros Nogueira Filho
    @joselitofilho

    Hi all,

    Does anyone have a good example of using Bots?

    Farnebald
    @farnebald_twitter
    Hello, my board (for a card game) is composed by react components (e.g. player hand) and sub-components (e.g. cards). I don't see how to access the "moves" property from those sub-components. Is it automatically available from any (sub-)component (through props.moves) or do i have to pass it from parent to children ? My intention is to run a move function when I click on a card. Do you have some examples ? Thank you for your help !
    3 replies
    Nithiwat Sirirattanachaikul
    @nitsirs
    Hi all! I wonder if it's possible to create a game frontend using Phaser JS while using boardgame.io to control the game logic. I think it would be a great way to create a fun and interactive game that people could play online. If anyone has any thoughts or knows of any tutorials that could help me out, I would really appreciate it!
    1 reply
    Nathan Saritzky
    @nsaritzky

    Certain events are double-firing inappropriately, and I'm at a loss for why. I have a phase in which most turns are automatic. In the exceptions, I shunt players into a stage to make a move before ending the turn. An onEnd hook for the turn then fires. My problem is that, sometimes, that onEnd hook fires twice. It seems to happen when either the phase ends or the event needs to call another move function. At least in the latter case, the top of the call stack looks like: (my onEnd hook) > wrapFn > produce > wrapFn, where both wrapFns come from the Immer plugin. This seems weird, and calls to mind this old bug: boardgameio/boardgame.io#544. But I don't know how to fix or work around it.

    Appreciate any help you can give.

    Gabriele Castellano
    @gabrielecastellano
    Hello everyone!
    I am trying to deploy my game in a multiplayer fashion, using a simple server and the built in lobby. I am encountering a trouble I have no clue how to solve, as client side ctx.playerID is never set, hence I am not able to identify the player (for customizing the interface based on it). Server side, ctx.playerID seems to be set correctly. I think I am missing something big as I cannot find any reference to this error anywhere.
    Thank you very much for your help.
    Farnebald
    @farnebald_twitter

    Hello, I have an array (called 'selection') in my game state (G). I want a react component to refresh when an item is added/removed to/from this array. The problem is that my 'useEffect' function does not trigger.

    export function MyBoard({ ctx, G, moves }) {
    const [selection, setSelection] = useState([]);
    useEffect(() => {
    setSelection(G.selection);
    }, [G.selection]);
    ... }

    Here is the code (in my moves) that adds an element to the array (I avoid using 'push' as it does not change the array) :

    G.selection = [...G.selection, item];

    Thank you for your help !

    3 replies
    Noé Bonnet
    @Neodark7
    Hi ! i have issues with multiplayer (and only on my staging environment) where the game clients always disconnect and reconnect when the match begins. this is not happenning on localhost, does it happen to anybody else ?
    Noé Bonnet
    @Neodark7

    Hi i just posted a new issue here : boardgameio/boardgame.io#1100

    "Hi ! i have a custom lobby mechanism on my project which implement basic matchmaking between players.
    When sufficient players have joined the lobby i create the match from my api and send an event to all the players to redirect them to the match page.
    When the match page load, an http call occurs to log the user to the game server.

    It seems that the boardgame implementation cannot handle simultaneous connection changes properly.
    When someone logs into the match (https://github.com/boardgameio/boardgame.io/blob/main/src/master/master.ts#L400)
    the match metadata is fetched from my database, modified to include the new metadata, sent to all clients and then saved to the database.

    When 2 players joins the match simultaneously, this logic is called 4 times simultaneously and it looks like that some players are overriding the metadata changes of previous users.

    For example:

    Player 1 is redirected to match page
    Player 2 is redirected to match page

    Player 1 onConnectionChange method start and fetch metadata
    Player 2 onConnectionChange method start and fetch metadata

    Player 1 onConnectionChange method modify metadata and save it to the database
    Player 2 onConnectionChange method modify metadata and save it to the database

    as Player 2 fetched the metadata before Player 1 finished modifying and saving it to the database, when Player 2 modify and save the metadata into the database, the data is outdated and does not contain Player 1 isConnected and credentials values. Player 2 is correctly logged into the match but Player 1 stay on the "Connecting..." screen indefinitely and the match get stuck when his turn start...

    Sometimes everything plays nicely in the correct order but most of the time, for example in a 4 players match, a player stay on the loading screen and the match is blocked, this is really critical for my project, how can this be fixed ?"

    Does anyone has encountered the same behavior ? and maybe found a solution for it ?