Boardgame.io: State management and more for turn-based games
google.github.io
google.github.io
I've been working on a similar project for over a year now. It's essentially this exact concept turned into an entire platform for designing/creating board games and then publishing the game so others can play it directly on the platform. Think of heroku or squarespace for board games.
I have a very rough, working prototype of the editor and game engine. There is a ton left to do (I could write pages about what I'd like to implement/improve). But, I'm at least finally getting somewhere with it.
At the risk of utterly destroying my server... for anyone who is interested, I have a demo site for the game editor prototype. A game can be test played from the editor by clicking "game play tester" in the upper-left menu. There are no docs or anything. But there are several games already implemented on the demo server.
url: http://strat-city-demo.herokuapp.com
username: demo
password: password
Please be kind to the demo server. I just threw it up to show a few people -- it's not robust at all.I would love feedback! My e-mail is dwaltrip77@gmail.com.
Note: the interface for editing the "Game UI" is going to be completely redone so that it uses the same type of visual programming code-blocks as found in the "Core Logic" editing interface. Right now the game UI code format is simply javascript that becomes a react.js render function.
It's interesting how people think so similarly on their own in different parts of the country/world!
I have a project along these lines as well: https://github.com/zhaizhai/turnbase . That's a somewhat cleaned-up version that I put on github recently; I actually started it almost five years ago. You can see an example implementation of Battleship here: https://github.com/zhaizhai/turnbase/blob/master/games/battl...
I once had visions of a "code-blocks" interface like you're doing, but you've certainly gotten a lot farther than me on that front. I'd love to find out more about what you're doing and if any of my code can help (will send you an email). I don't actually have time to work on this project seriously, so I'm happy to share whatever experience I've gained so that it doesn't go to waste :).
But that is an interesting idea.. it probably wouldn't be super hard to generalize the engine and game specification format to enable single-player games. That's definitely something I will keep in mind for later.
When I launch the full working initial version, I will have a bunch of guides, tutorials, and documentation.
I haven't yet built any features to allow storing player data outside of individual games, but that does seem a very useful thing that fits nicely with the goals of platform. I would have to think about what that might look like. Thanks for asking!
If the person who made this is around: I'm the author of Fireplace (https://github.com/jleclanche/fireplace/), a Hearthstone simulator, and I worked a ton on the Hearthstone game state protocol (docs: https://hearthsim.info/docs/gamestate-protocol/). Hit me up by email (profile) or Discord (jleclanche @ https://discord.gg/hearthsim-devs), I bet we could have a really interesting knowledge exchange :)
This is making me want to try to implement a Hearthstone prototype in it to see if it's feasible. I've been dying to implement a copy-on-write Hearthstone simulator. Although this seems to tie the game logic with the protocol quite tightly, which hopefully is fixable or can be worked around; one of the designs I worked on with my simulator was a pluggable game state protocol to allow separation of a game state server that dispatches the gamestate data from the simulator itself that could then be implemented in any language. Incidentally, this allowed our Hearthstone replayer (written in React: https://github.com/HearthSim/Joust) to connect to "real" games and be a live client, in a way that is eerily similar to this project's showcase.
It would be an interesting experiment to replace the hearthstone mechanic with the MTG mechanic to see if it ends up with more interesting tactical situations.
However, it ended up being way harder than I expected. In fact, I tabled it indefinitely because I started to believe that it was just intractable. (That is, trying to conceptualize a game into a discrete rule set is often a lot more work than just implementing it in code.)
I'm glad to see others trying to tackle this. But, I hope they try to implement games that are significantly more complex and sophisticated than tic-tac-toe though. The current code is so simplistic that I can't imagine that it will help much. That is, if I used it, I'd still have to custom-code 99% of the logic. But, at least it's a start.
I think if one truly took this approach to the logical end, they would end up creating their own specialized board game programming language.
That's what I was planning on saying. A set of discrete rules detailed enough to represent most board games would end up looking a lot like an interpreted programming language.
There is a lot that goes into this - for instance offline notifications must be delivered to each user's preferred endpoints (in app notifications if they installed cordova app, sms and email fallbacks if they didn't), you need to fill templates, enforce access control (can I see a guy's last name or a particular game / chat / etc?)
If you look at https://qbix.com/platform/features you will see we went with Streams and Messages rather than syncing data structures. This allows us to reason about explicit "moves in a game" or other changes and whether they are authorized or not per Stream.
In short - I am happy to see others adopting similar goals. Most of what I have seen til now has been syncing static data structures.
It's all in browser, supports up to 6 player multiplayer card games, BYO cards (user uploads card images). YES you can spectate games if you want to have a look.
This has been a growing industry, i have noticed in the last 4 years people like the idea of being in control of their game, playing on the mistakes their opponents make and having the skill to think about the game with out the computer doing the work for you like in most digital card/boardgames from today.
Untap.in is a personal project, has about 100k registered users and 1600 daily active, its a big community. All of this is being serviced by a sole dev (myself) in my free time. The likes of these frameworks should make it extremely easy to get board games through prototype and playable, its a great thing.
It does similar things like server-time-synced animations across multiple browsers, except the state is all managed by the backend.
This was an exercise in a toy language that was deliberately not Turing complete, yet expressive enough for boardgame rules.
Interesting to see how things have moved on
[0] https://github.com/danielborowski/jsboard
[1] https://danielborowski.github.io/site/jsboard/demo/demo8/
[2] https://danielborowski.github.io/site/jsboard/demo/demo9/
Many things require a human in the loop -- judging whether a joke is funny, for instance, or clinical trials or educational apps.
What are some good AI learning things for that?
It's an interesting design and I wonder how well it works.
I'm skeptical about the design, but the only way to know whether it's effective is to measure it.
Carmack's great breakthroughs came from trying every logical possibility and then sticking with the ones that worked. There were dozens of dead Quake designs that no one knows about, e.g. beam trees.
One mistake I made in the early days was to go around asking people what to do or how to design something. The truth is, no one really knows the best way to design anything. The only thing you can do is think of possibilities, try them, and ruthlessly measure whether they're effective. Often the most effective designs come from unexpected combinations, which is why this dual websocket idea is worth taking seriously.
One nice property is that if it does work, it only costs 2x bandwidth. Realtime games' bandwidth grows as O(n^2) with the number of players (e.g. 90 players need updates about all 89 other players plus themselves). So doubling the bandwidth isn't a huge cost.
I wonder what the ideal number of connections would be. It could certainly be 2 of course; I've never thought about this problem before.
It seems unlikely to be as clear-cut as this, since two connections from the same host to the same endpoint will probably use the same route to get there. So why would using two connections avoid retransmission? But it's worth checking whether it works.
There's a great article way back about X-Wing vs Tie Fighter and all the pain they went through with TCP/IP[1].
[1] https://www.gamasutra.com/view/feature/131781/the_internet_s...
It's a nice idea but UDP is really the right solution. Games like SubSpace were doing this back in '97 on 200-400ms connections in a seamless manner.
https://google.github.io/boardgame.io/#/tutorial
Sometimes, turns are repeated. E.g. if a square is clicked and marked 0, then the next square that is clicked is also marked 0. Only happens sometimes though and I have only produced it on the first turn. I'm not sure what the cause is.
[1] https://github.com/google/boardgame.io/blob/master/examples/...
To have Google give you (the Google employee) full copyright of projects you work on while at Google, you need to go through a committee[0] that reviews the project to make sure it doesn't collide with some other project Google already is working on. As this is really hard to do for many projects, it's easier to just let Google keep copyright ownership of it and have it opensource under them.
We havn't gotten there but are exploring other services for the backend like Nakama [2] and Colyseus [3]. Right now we are just using Firebase for the multiplayer sync and building raw RN components with no library essentially and that's been working pretty good.
I'm gonna look into this library some more, looks promising :)
[1]: http://gameroom.co/ [2]: https://heroiclabs.com/ [3]: https://github.com/gamestdio/colyseus
Disclaimer: I work on Nakama. :)
are there any provisions for multiplayer games that have player-specific knowledge? like cards or tiles that other players can't see? right now all game state is sent over the wire every time... would you just only send pertinent data to each player on their turn?
http://www.cs.cmu.edu/~cmartens/thesis/
(or some of the shorter papers on her website)
[0] http://www.gtcenter.org/Archive/2015/Conf/Jimenez1880.pdf
[1] http://www.cs.ox.ac.uk/people/julian.hedges/papers/Thesis.pd...
One concrete cause of centralization in today's Internet is a difference in programming costs between a closed centralized solution and an open decentralized one. Let's say we're writing a tic-tac-toe app. In the centralized design, the game board is one data structure. Your score and mine are two variables. You'll be done in a couple of hours.
As an open decentralized solution, you're building a federated system. You need a standard protocol for communicating tic-tac-toe moves. Maybe you should work through the IETF to write an RFC for OTTTP: the Open Tic-Tac-Toe Protocol. You might be done in 2018. When solving a problem the wrong way takes two hours, and solving it the right way takes two years, it's going to get solved the wrong way.
https://www.youtube.com/watch?v=g1qroWiZF90
Note that I don't endorse the particular solution in this video - MirageOS is perhaps a more viable alternative.