Hey folks,
I am currently a bit confused on how multiplayer credentials work.
My setup looks like this:
Now as far as I understand the docs I need three things:
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.
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:
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.
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
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 :)
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?
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!
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?
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
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.
_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?