6 ms·
Boardgame.io: an engine for creating turn-based games using JavaScript
- downThePipe 2y agoThen what, print it out to play on the kitchen table?
- tardibear 2y agoIt supports multiplayer over the network.
- ramon156 2y ago> multiplayer networking Its in the description
- vasco 2y agoPut the screen on the kitchen table and sit around it, call it CounterTop Surface, have a little imagination man.
- thaumasiotes 2y agoYou say this like a joke, but that would bring a lot of usability and convenience improvements compared to a physical board game. Just moving stuff out of and back into the box can take a lot of work. It's easy to overlook rules that a computerized game automatically handles for you, though. For example, I'm part of a group that plays Heat ( https://boardgamearena.com/gamepanel?game=heat https://boardgamearena.com/gamepanel?game=heat ) every week. An important part of that game is moving the game-controlled cars, and since the platform handles that, only one person in the group. This is potentially quite bad for strategy, depending on the rules you don't know. Another issue that comes up in the same game is people losing track of the size of their deck. The game is very generous about the allowable timing of deck-manipulation effects, but if you're not actively paying attention you can draw through your deck and trigger a reshuffle, wiping out your discard pile, when you wanted to do something special before the reshuffle. This isn't a mistake it's possible to make while using a physical game.
- jz67 2y agoHey sorry if this is not the place for it but I play heat a lot too and I was looking for a group like this on bgm since the random matches have a lot of people rage quiting etc. can I ask to join this group?
- azemetre 2y agoDo you play live or turn based games? I never had an issue of people rage quitting, I also tend to set the games to one turn per day which is reasonable for most people.
- thaumasiotes 2y ago> and since the platform handles that, only one person in the group. This should read "only one person in the group knows how it works".
- sethammons 2y agoa tad further: a central phone or tablet as a main board that you interact with via touch and where you can then transfer over to your handheld device over the network to manage your hand. I've not seen this yet, and it would be a pretty great experience I think. No clean up
- dalmo3 2y agoThis is basically how Jackbox games work.
- brudgers 2y agoLooks like it might originally have been from Google based on this discussion https://news.ycombinator.com/item?id=15946425 https://news.ycombinator.com/item?id=15946425
- ErrantX 2y agoThe original author looks to have been at Google till 2020. https://nicolodavis.com/ https://nicolodavis.com/
- nicolodavis 2y agoboardgame.io was created as a personal open-source project while I was employed at Google. It is not an official Google product.
- ferd 2y agoLooks very interesting. Somewhat related: I've recently wrote a code-walkthrough (in Clojure) of modeling chess-like games. https://neuroning.com/boardgames-exercise/ https://neuroning.com/boardgames-exercise/ It's very basic and intended for teaching/learning functional programming, not a real library or engine like the OP.
- nicolodavis 2y agoOriginal creator of boardgame.io here. A pleasant surprise to see this here after many years. More recently, I've been working on https://boardgamelab.app/ https://boardgamelab.app/, which uses a visual programming language to model game rules while also taking care of the UI layer.
- jfengel 2y agoOh, thank you. I've used your library a few times for personal projects, and it does exactly the thing that I needed. I really appreciate you having created this.
- thih9 2y agoThe boardgamelab.app looks like a stealth, proprietary project; at least at the moment its T&C[1] says: "under this license you may not (...) use the materials for any commercial purpose, or for any public display (commercial or non-commercial)". Do you have any plans for the business model? [1]: https://boardgamelab.app/terms-and-conditions https://boardgamelab.app/terms-and-conditions
- fourside 2y agoWhat do you mean by stealth? I looked at the website and nothing about it makes it look like it would necessarily be free or open source.
- jzig 2y agoStill needs clearer language IMO.
- eklavya 2y agoI just checked and it says MIT licensed. What am I missing?
- nicolodavis 2y ago
- fleabitdev 2y agoThis engine uses a Redux-like architecture. You have a State type (containing data like "the position of the black kingside rook") and a stream of in-game actions (like "knight to F3"). Each action is handled by a pure function which converts the current State to a new State. You can either transmit State deltas from the server to the client, or just transmit the actions themselves (https://longwelwind.net/blog/networking-turn-based-game/ https://longwelwind.net/blog/networking-turn-based-game/). This design makes it easy to implement optimistic updates, rollback, replays, automated testing, and recovery after a disconnection. It's a surprisingly good fit for UI, too; you can render simple games as a React component which takes the current State as one of its props. However, a stream of context-free actions can be a really inconvenient representation for some games. The rules of a board game are often like the control flow of a computer program: you'll see branching, iteration, local variables, function calls, structured concurrency, and sometimes even race conditions and reentrancy. When you try to represent all of this logic as a State object, you're basically maintaining a snapshot of a "call stack" as plain data, and manually resuming that "program" whenever you handle an action. It doesn't seem ideal. I've been sketching a board game engine which would represent the game logic as normal code instead. It seems promising, but it really needs a couple of language features which don't exist in the mainstream yet, like serialisation of suspended async functions.
- NathanaelRea 2y agoCan you explain more what type of game would need a call stack snapshot? I've never developed a game, but it seems like as long as you store like the initial state and prng you could always get the current state by replaying the full history. All the other logic would be stored outside the state, and only added when "committed". As long as prng is stable and you start from the clean state every time, you'd get the same outcome.
- yojo 2y agoI think I have a good example from Magic: the Gathering. There’s a card called “Fact or Fiction”. You reveal the top five cards of your deck. Then your opponent splits the cards into two piles. Then you pick one of the two piles to take into your hand. You’ll need to store structures representing the choices that are intermediary steps (split cards, pick stack) in your state, which is basically function calls and their params (a call stack). This example could get hairier - Magic also features cards with branching logic “choose 1: do a or b”. I can imagine designing cards with large and convoluted possible execution paths. You could have the card define a schema for state transitions/params and represent all these choices as JSON encoded POJOs, but as a developer it sounds a lot nicer to just be able to suspend an async function every time a choice is made.
- billnreed 2y agoI've seen this engine before and thought it was really cool! I've been playing around with writing my own turn-based game engine with TypeScript: https://github.com/snowbillr/turn-based-game-engine https://github.com/snowbillr/turn-based-game-engine It's a WIP still, but what's really been the struggle for me is coming up with a data structure and traversal algorithm for the turn order. I wanted that to be extremely configurable by whoever uses the library. ``` engine.defineFlow((f) => { f.node({ actions: f.actions(WelcomeMessage), }) f.node( { actions: f.actions(RoundStart), cleanups: f.cleanups(RoundEnd, TestLog), }, players.map(player => f.node({ playerId: player.id, actions: f.actions(TurnStart), cleanups: f.cleanups(TurnEnd), })), ) }); ``` This example shows a TicTacToe game defined like this: ``` - welcome - round - player 1 turn - player 2 turn ``` What I ended up with was essentially a tree that's traversed depth-first to enter each node, and then goes back up the same traversal path until a sibling node is found to dive into. That lets the user define rounds/turns/phases as children of each other in whatever shape they want. It's been a real fun project!
- DominikPeters 2y agoIs there a simple demo that one can test? I see a tutorial about tic tac toe, but the result doesn't seem to be hosted anywhere.
- freetonik 2y agoThe tutorial page[1] has a link to open an interactive sandbox with a TicTacToe example. The link is titled "Edit in CodeSandbox". 1. https://boardgame.io/documentation/#/tutorial https://boardgame.io/documentation/#/tutorial
- tasuki 2y agoIt's really cool that it has a MCTS bot built-in!
- throw94838211 2y agoI tried to use this before, but many parts didn't really work right, lots of conflict between dependencies, especially the server parts. I had to abandon what I wanted to do with it. Shame because many ideas were interesting, but felt it was a bit untested.
- mvolfik 2y ago10 months ago, there was also Boardzilla (https://www.boardzilla.io/ https://www.boardzilla.io/) posted here: https://news.ycombinator.com/item?id=39180953 https://news.ycombinator.com/item?id=39180953 . Curious to see how these two compare
- Lucasoato 2y agoIf anybody knows of any reference, article, book to study and implement turn-based engines like this, please add them under this thread.
- david_bai 2y ago[dead]
- Feathercrown 2y agoOoh this is neat, I've been working on something similar. I'll have to check it out and see if they're using the same abstractions as I am. Could be enlightening!
- rendaw 2y agoAre there any finished games that use this? I'd like to see a showcase.
- voidmain0001 2y agoI’m quite ignorant of JS development with Node. This package really interests me so I followed the tutorial. On the second step, I used npm to install boardgame.io which triggered a barrage of error messages related to deprecated packages and 69 vulnerabilities. I ran npm audit and it displayed numerous high severity. I tried the npm audit —force which broke boardgame.io I don’t plan on trying to fix these problems so does it mean that I shouldn’t try boardgame.io?