Show HN: Card game where players write their own cards that get parsed into code (app.wordbots.io)
It's an online tactical card game (inspired by games like Hearthstone and Magic: the Gathering), where players write their own cards in natural language, that gets parsed down to JavaScript. The English-to-JavaScript translation is handled by a semantic parser operating on a hand-crafted CCG grammar – kind of an “old-school” approach in this age of LLMs but one that performs quite well on the very constrained language of Wordbots cards.
The resulting game gets pretty wacky as players can create all sorts of cards, though there are some game formats that try to produce more balanced gameplay as well (e.g. one format in which both players shuffle their decks together, and various draft formats).
If you're curious about how it all works, I made a write-up about it here: https://app.wordbots.io/how-it-works
And if you want to chat about Wordbots beyond this thread, please don't hesitate to join our discord at https://discord.wordbots.io/ . I'd love to hear any and all feedback.
-Alex
27 comments
[ 3.6 ms ] story [ 71.1 ms ] threadI would also recommend linking to https://github.com/wordbots/wordbots-core/blob/v0.20.0-beta/... since the app.wordbots.io version seems to boot up some horrific amount of javascript or something, because the gears just sit there for about 15 seconds before the content finally shows up
Separately, do you know if the vocabulary for wordbots would tolerate the vocabulary for M:TG? IOW, is it possible to "port-over" some of the cards?
Some of the cards that people have been making so far in Wordbots are rough reinterpretations of cards from other games (M:TG, Hearthstone, Faeria, etc). Of course, many cards from these games wouldn't be possible to reimplement in Wordbots, as it doesn't have anywhere near the breadth of mechanics that these more-sophisticated games do. But also, there are some mechanics that are only possible in a game like Wordbots – such as https://app.wordbots.io/card/cnrssvyxfsp: > Replace "1" with "2", "2" with "4", "3" with "6", and "4" with "8" on all cards in your hand.
(I also appreciate the "old-school" approach in this case; I suspect it actually makes it easier to determine that the intended card is invalid.)
Edit: I tried, and I guess it is able to understand that. Nothing which seems to tie that to a cost, though. That makes sense as you'd effectively have to define a game system while this is crowdsourcing that to the community. I imagine the intention for play (if there really is one) is to have players agree on a set of cards to use.
Wordbots doesn't have a built-in mechanism to enforce cards being at a "fair" power level. We initially had a few ideas for how to do it: some kind of machine-learning approach to determine how much "energy" a card should cost to play based on its text and stats, or having a server constantly simulating games between AI players with various cards to see how effective cards are in practice, or even a market-based mechanic where cards could be traded for in-game currency and how valuable a given card was would determine it's a "fair" card or not.
All of these approaches were ultimately abandoned as too complicated. Instead, we opted to just prioritize game formats where both players are equally likely to have access to any given card in-game:
This way, overpowered (and underpowered) cards can still be created by players, but at least in these game formats, both players would be equally likely to draw said overpowered cards.What I figured was to make there be a cost for using any card, pinned to the number of targets affected, amount of "force" applied, and one or more resources (life, energy, time, space).
Or an equivalent-exchange/extreme-couponing system of some kind. "To destroy the universe, you must first destroy something of equal or greater value." This can deadlock the game though.
After "heat death of the universe" cost too much to play, the workaround ended up being "wait for all other players to die of natural causes" (hadn't implemented time cost yet).
Then you’ve got a 1/60th chance of your opponent using it.
But creating your own cards is an INCREDIBLY frustrating experience. This is a robot I tried to create (sumbot):
"This robot's attack, speed, and health are the sum of the attacks, speeds, and healths respectively of all other robots in play."
It didn't understand the words: "are", "sum", "speeds", "healths", "respectively".
Very restrictive dictionary and grammar. It pissed me off at a deep level and I probably will step away from this game.
Maybe integrate with an LLM (such as GPT4) to accept card descriptions?
It seems I can set an arbitrary cost for my cards? How do you balance the game when it involves custom cards?
One strategy would be to give each player a deck consisting of their cards and the opponents cards. So if someone made a really imbalanced card, they would have a 50-50 chance of having it used on them.
Re: frustration of writing cards – yeah, I definitely feel you on that. The grammar is fairly restrictive and there's generally just one way to make a given card action parse (you could say it's more like Python than Perl). One affordance that we've put in to at least make writing cards a little easier is the Dictionary/Thesaurus feature in the Workshop, that lets you see all the words and phrases recognized by the parser and examples of how each of them has been used in practice.
Re: sumbot – You can do something like "Startup: Set this robot's attack to the total attack of all robots, and set this robot's speed to the total speed of all robots, and set this robot's health to the total health of all robots."
> It seems I can set an arbitrary cost for my cards? How do you balance the game when it involves custom cards?
> One strategy would be to give each player a deck consisting of their cards and the opponents cards. So if someone made a really imbalanced card, they would have a 50-50 chance of having it used on them.
The author actually addressed this by doing exactly that
"At the end of your turn, destroy this robot unless it moved this turn" or "At the end of your turn, destroy this robot if it didn't move this turn" are definitely phrases that ought to parse correctly, and there's already in-game support for these mechanics (it's purely a parser issue).
Use the LLM to turn English into the subset understood by sumbot and it slowly teaches the player the formal language!
"Praction" comes after the comma in that phrase, apparently?
P.S. Discord (https://discord.wordbots.io/) or GitHub (https://github.com/wordbots/) would be the best place to report issues like this at the moment.
The Discord link is timing out for me. Hopefully you don't mind a brain dump here.
He had one feature request - the ability to restrict the number of Rare/Uncommon cards to be included in a deck built off of a given set (if that makes any sense).
Also, we hit a few bugs. One time we had a major state desync - on one player one team was entirely wiped out with a given card play, whereas on the other it had no/limited effect. From that point, the games diverged in their entirety - including the log. It was only because we were sat next to each other we even knew.
Some form of hashing of the engine state and comparisons every play could ensure that at least a desync identified (which would hopefully lead to a fix).
Another time, the 'End Turn' button was unresponsive for one player, and we instead had to force a draw.
He had an issue with a card he created that read "when you draw a card, ...", which was triggering when the opponent drew too.
The final thing is more of an irritation, which is the 'Activation' overlay can make it hard to move/attack to the hex immediately to the right.
Otherwise, great game and it's obviously a labour of love. Jist hope for a bit more interest and player activity.
Glad that you and your son have had fun playing it! He's definitely made the most cards in Wordbots of any user so far, so that's pretty cool :-)
I'll respond to each issue in turn:
Re: decks and card rarity – I hadn't thought of this when implementing card rarities (which right now take effect only in draft mode), but it's a good idea. I'll make an issue for it.
Re: state desync – I've never noticed this issue in testing, but I will admit that the multiplayer code is pretty sloppy (this part isn't exactly my strong suit). In theory the game should be fully deterministic (and the RNG is seeded identically for both players and the server), but it's possible that either a socket message got lost somewhere or there's some nondeterminism in some card behavior that I neglected to notice. If you encounter this again, please let me know what happened right before the desync – it'll help us narrow down the issue. And hashing the state and checking it periodically seems like a good measure to take for now; I'll make an issue for it.
Re: End Turn button unresponsive – This is a bug we've had in the past, and it was caused by an error occurring during combat, resulting in the game state thinking that an attack animation was still happening (so the turn couldn't end yet). I'm pretty sure that it's fixed now, but if you encounter it again, check the game debug log and JS console to see if anything weird happened right before.
Re: card draw trigger – Oops, this looks like an issue with how `afterCardDraw` is being triggered, should be an easy fix on my end. I'll take a look.
Re: Activate popover – Yeah, this is feedback we've gotten in the past, and we're looking into what a better UX for object activation could look like.