_ClientImpl
that would mean defining and exporting an interface that it implements rather than simply exporting internal class
Hey folks! I'm building react app based on boardgame.io, I'm trying undo my last move, but stuck with the following error on:
ERROR: No moves to undo turn-order-0b7dce3d.js:451
errorfn turn-order-0b7dce3d.js:451
error turn-order-0b7dce3d.js:456
CreateGameReducer reducer-07c7b307.js:1104
dispatch Redux
LogMiddleware client-fa36c03a.js:256
TransportMiddleware client-fa36c03a.js:300
SubscriptionMiddleware client-fa36c03a.js:311
TransientHandlingMiddleware reducer-07c7b307.js:927
undo client-fa36c03a.js:239
onClick Board.jsx:106
React 23
js index.js:24
factory react refresh:6
Webpack 3
Moves configured as undoable
. Any thoughts how I could debug that?
I have been making a board game with pieces that I would like to animate after each move is made, but I can't find any functionality that lets me look at the actual move being selected by the bot rather than seeing every move the bot considered, not knowing if its the one that will be selected... the bot is allowed to make multiple moves before the turn ends, but I want to animate the board after each move.... is there any way to do this?
Thanks in advance! I am happy to explain more if my questions dont make sense
To summarize my main question:
As a MCTS bot calls the various move methods while enumerating through the list of moves I provide it, is there any field on G or ctx or otherwise that I can check in the move function (or onMove(), onEnd(), etc) that tells me the move is the one that was selected by the bot?
Hey folks,
What would be the correct way to import boardgame.ios server/utils? (if there currently is any)
I currently need this, because I have a custom join-match route, which needs access to bgios createMatch-function.
I can import utils via
import {
createMatch as bgioCreateMatch,
getFirstAvailablePlayerID,
getNumPlayers,
} from 'boardgame.io/src/server/util'
However this will make typescript typecheck these files and I get tons of errors. As soon as we us an import from 'src', an exclude inside the tsconfig will no longer work.
Also I would prefer to import these from dist, but they currently don't seem to be part of the dist bundle.
Hey all, I'm having trouble with implementing remote multiplayer functionality. I've validated the game logic and behavior in local multiplayer and am trying to now port to remote. The issue I have is my client is having issues communicating with the server. When I run with a React LobbyClient
component on my app, the game
name and min/max players
correctly populate in the boilerplate code, but when I try to create a new game, I get the response failed to create match for Azul (Error: HTTP status 404)
. When I use the plain JS LobbyClient
implementation and call listGames()
, the server returns undefined
and a POST
request to server:PORT/games/<game-name>/create
also returns a 404 (Not Found)
status code.
Here is my client and server code. index.js is located in base directory/src. server.js is located in base directory.
index.js (client)
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import { LobbyClient } from 'boardgame.io/client';
import { Lobby } from 'boardgame.io/react';
import Azul from './Game';
import AzulBoard from './Board';
async function lobbyStuff() {
const lobbyClient = new LobbyClient({ server: 'http://localhost:3001' });
const { matches } = await lobbyClient.listMatches('Azul');
const { games } = await lobbyClient.listGames();
console.log(matches);
console.log(games);
console.log(lobbyClient);
const { matchID } = await lobbyClient.createMatch('Azul', {
numPlayers: 4
});
console.log(matchID);
}
lobbyStuff();
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<div>
<Lobby
gameServer={`http://${window.location.hostname}:3001`}
lobbyServer={`http://${window.location.hostname}:3001`}
gameComponents={[
{ game: Azul, board: AzulBoard }
]}
/>
</div>
);
const { Server, Origins } = require('boardgame.io/server');
const Azul = require('./src/Game');
const PORT = 3001;
const server = Server({
games: [Azul],
origins: [Origins.LOCALHOST],
});
server.run(PORT);
Hi guys. I use flat-file to save the game's state. Sometimes things go sour, and I need a process to clean periodically zombie games. I'm trying to call directly the flat files methods but I can't figure it out. This code:
const { FlatFile } = require('boardgame.io/server');
const matchesDB = new FlatFile({
dir: './db/matches/',
logging: true
});
console.log("Attempting List Matches");
matchesDB.listMatches().then(
(result,error) => {
console.log(result);
}
).catch((error) => {
console.log("List Marches Error");
console.log(error);
}
);
Will throw an error :
TypeError: this.games.keys is not a function
at FlatFile.listMatches (/AbakIO/abak-evolution/node_modules/boardgame.io/dist/cjs/server.js:2710:39)
at Object.<anonymous> (/Abak/Development/AbakIO/abak-evolution/src/assets/js/server/utilities.js:9:11)`
Can someone help me to understand what I'm doing wrong?
In the debug panel, I can select different player to change who a move is submitted by. I'm using this to test simultaneous stages. Is there any way to see which player is "active" in the context? playerId
doesn't seem to get set, and currentPlayer
is always set to the player whose turn it is.
I'd like to know the currently selected debug player so I can update the UI to show their state
Hello!
I'm trying to implement a card game with a "pass" mechanic. If a player passes, they're removed from the turn order until all but one player passes. Once that happens, the board is cleared and the remaining player starts a new round, with all the players added back into the turn order of course.
What tools do I have to manipulate the turn order in board game.io? It's not immediately obvious how I can do this, since I know I can't modify the ctx object.
{ '1': 'some-stage' }
and call setActivePlayers
to set { currentPlayer: 'another-stage' }
expecting ctx.activePlayers
to be { '0': 'another-stage'}
, then calling ctx.events.endStage()
and going to {'0': 'last-stage'}
, but instead after everything executes, I find myself in {'0': 'another-stage'}
. Is there something fundamental I'm missing with how setActivePlayers
and endStage
works with regards to the current player not being an active player? Thanks!
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.
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.
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?
setActivePlayers
that shold be in ctx.events.
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