Do you ever get the urge to program a deckbuilding 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
-
Like if you recruit Hernando de Soto, the goody huts on the map only return positive results, and every unit's scouting radius increases
-
Paul Revere makes it so that if a city is attacked when it had no army but it has muskets in the storehouse, it'll temporarily promote a non-soldier unit to soldier and have them defend
-
@foone Point of order: some cards have intrinsic abilities beyond what the sigils provide, and your chosen example - Ouroboros - is one of them. Other cards can get the Unkillable sigil (I had it on Squirrels once!), but only Ouroboros, as its description says, "gets stronger forever" each time it dies. (And when they say "forever", they mean it!)
-
That sort of thing.
These sorts of "every option involves changing the game rules" things are always fascinating to me, both as a gamer and a game developer. -
@foone you might enjoy Balatro, which has a fair deal of multi-level stacked effects / interactions
-
@eta sadly I'm allergic to playing cards, but otherwise it looks fun