interface SocketIOOpts
socketOpts?
was changed from any
to ioNamespace.SocketOptions
. Unfortunately, this means I can no longer initialize my Client
with multiplayer: SocketIO({ server: server_url, socketOpts: { path: '/sub/socket.io' } })
because path
is no longer accepted. Any ideas?
Hi, its me again 😅
I am currently having a weird issue (I probably had it before, but did not realize it).
Inside my game definition I set a seed for randomization. The seed is being generated by a call to nanoid().
However I noticed that the seed will only be set once for the game, not for each match instance I create.
Therefore each match will have the exact same randomization output.
I noticed this issue from 2018 boardgameio/boardgame.io#233 - however if I interpret it correctly, this has long been resolved.
Now I am wondering what I should be doing differently. I haven't found a way to tell the server to use a new seed when a new match is being created via the lobby API.
What am I missing here? :)
AHHHH nvm. I missunderstood how the seed works. The server already generates a new seed for each match. Overriding the seed is only necessary, if I want to use a specific seed (e.g. for testing etc.)
var activePlayersValue = {};
activePlayersValue[ctx.currentPlayer] = 'pickup'; //store up the current player to put into the pickup stage.
ctx.events.endTurn();
ctx.events.setActivePlayers({ currentPlayer: Stage.NULL, value: activePlayersValue, maxMoves: (6 - cardCount) }); //let them draw back to 6?
multiplayer: Local({
bots: {
0: MCTSBot,
1: MCTSBot,
},
}),
NODE_ENV
environment variable is 'production'
. Maybe double check process.env.NODE_ENV
is set to something else during development.
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