Replies: 1 comment 1 reply
-
Great question! I’m curious to see if anyone’s already using these together. My guess is it would go something like this. Create a boardgame.io client alongside your Phaser game: import { Client } from 'boardgame.io/client';
import Phaser from 'phaser';
const client = Client({ /* ... */ });
client.start();
const game = new Phaser.Game({ /* ... */ }); Then either access the boardgame.io client from the Phaser scene methods, e.g. function update() {
const state = client.getState();
// display scene as necessary based on state
if (someCondition) {
// make a move
client.moves.playCard();
}
} Or you could subscribe to the client and update the scene when boardgame.io emits an update: client.subscribe(state => {
// use state to update some scene objects
}); Maybe there are some better ways to integrate, like only running I had a play around with a super basic set-up and ended up with this small example. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am looking to recreate this TAC boardgame as a multiplayer game. I started building the UI with Phaser, which worked pretty well. I now started to look into creating the logic and multiplayer functionality. I really like Boardgame.io but I am wondering how well it can be integrated with Phaser. I assume updating the client could be done event-based (and the server vice-versa) but I am not sure how do go about it.
Does anyone have experience with combining Boardgame.io and Phaser 3?
Beta Was this translation helpful? Give feedback.
All reactions