Do you ever get the urge to program a deckbuilding game?
-
Do you ever get the urge to program a deckbuilding game?
Because it'd be such an interesting challenge to architect! A good deckbuilding game is full of cards/item/units that essentially alter the rules for that one card, and that's gonna be very interesting to implement.
-
Like you have
* the Rat: 1 damage 1 health
* the Wolf: 3 damage 2 health
* the Armadillo: only takes damage on even numbered turns
* the Oxpecker: the card to the left has +2 health -
How do you implement that without this becoming a nightmare of endless difficult-to-test specialized code?
That's the challenge
-
Graham Sutherland / Polynomialreplied to Foone🏳️⚧️ last edited by
> the Rat
> the Wolfgenuinely thought you were going to describe a Stronghold Crusader deckbuilding game there
-
Foone🏳️⚧️replied to Graham Sutherland / Polynomial last edited by
@gsuberland I was actually thinking more Inscryption!
-
Xavier Ashe :donor:replied to Foone🏳️⚧️ last edited by
@foone Ever play Munckin? There are the rules, then all the cards break the rules. Then they released a whole bunch of sets. We would combine the decks, which would double the rules, and then the cards break the rules even worse.
https://munchkin.game/ -
Of course you could always just pull a Nethack and make every line of code endless ternary conditions like the very idea of OO is an insult to K&R themselves.
damage=weapon_damage*strength+(lane>0 && playfield[lane-1]==CARD_OXPECKER)?2:0)
-
That times a billion. You can't do anything in the engine without checking 8 different conditions that only happen when you have some other rare item and it's in the right place
-
Foone🏳️⚧️replied to Xavier Ashe :donor: last edited by
@Xavier oh yeah. But that's a game for human, who are a bit better at free form play than computers
-
@foone That's horribly fragile. There must be a way to abstract that properly.
-
@static there is, but Nethack is too far down this tar pit to consider it now
-
@foone I vaguely recall that the Balatro code contains a massive switch / case statement covering every joker individually.
-
Inscryption has a neat bit of abstraction: cards have attack/health/cost and then some number of sigils.
There's no rules on the cards themselves, but each sigil has associated rules, which you can look up at any time. -
So instead of having the Ouroboros card have rules on it saying that it always returns to your hand when killed, it has an Unkillable sigil.
-
And you look up the Unkillable sigil in the in-game rulebook, and it says:
"When a card bearing this sigil perishes, a copy of it is created in your hand" -
So they don't have to test the card individually, just all the sigils.
This also enables the game to modify cards mid-game: with special events you can copy the sigils from one card to another, making new combinations of sigils.
-
✧✦✶✷Catherine✷✶✦✧replied to Foone🏳️⚧️ last edited by
@foone i feel like this is a perfect application for prolog
-
So you're effectively rewriting the rules written on a card as part of gameplay.
A very neat mechanic and you can see how the sigils-instead-of-rules made it possible
-
Sorry I'm having to make really short posts because my mastodon client tends to crash and lose half-finished posts every time I tab over to Firefox
-
I've been wondering about this sort of thing ever since Sid Meier's Colonization. It's not a deck builder (it's a 4x a la Civilization) but it has a "founding fathers" mechanic where you periodically recruit historic figures, and they have similar game-rules-changing effects