Making of a "TCG"-styled game.

Started by
0 comments, last by LorenzoGatti 12 years, 4 months ago
I'm very interested of making a "TCG"-styled game much like Pokemon, Magic the Gathering and Yu Gi Oh.
I feel like I'll need a solid and well planned design for it to work since well most of the cards "overrides" all the core rules.

So I'm turning to the more experienced users, how does one achieve that? And keeping abstraction and generics.
My first though is: "Scripting", like LUA. That way you can keep it flexible and expandable without making the code look like a horrible piece of fudge.
Advertisement
  • Design simple rules, easy to understand and without loopholes and special cases: the mess you'll have to deal with through good code design will be greatly reduced.
  • In particular, cards shouldn't be allowed to override the actual rules in arbitrary ways and throw the integrity of the game out of the window: they should only modify the "normal" way to do things within the framework of rules that define everything that can happen.
    For example, in Magic: the Gathering creatures with the standard "first strike" and "double strike" abilities do not alter the normal process of combat: they simply make use of the first strike damage step during which, if the combat includes only "normal" creatures, nothing happens.
  • Some form of scripting is necessary, because you are supposed to reuse the same engine, and even the same AI, regardless of the set of available cards, and to load card definitions from some kind of database.
  • Arbitrary pieces of Lua code are unlikely to be easy to handle, for lack of metadata about what they do. For example, suppose you want to make a card like Momir Vig, Simic Visionary Avatar: how can your AI know that its activated ability might put a creature on the battlefield? If you implement its hand and life modifiers as a piece of script that runs at the beginning of the game, how do you ensure that the script doesn't do anything apart from altering hand size and starting life?
  • Instead, I suggest flags, data and objects that reflect the rules: in the previous example, Vanguard cards might be a class, hand and life modifiers its numerical attributes, and the rather unique activated ability an "activated ability" instance containing a cost (a composite of "X mana" and "discard a card", which would probably be two classes or constants), a timing restriction ("sorcery speed") and an effect (a sequence of "randomly produce a creature card with a given CMC from nowhere", presumably a class or function coded ad-hoc for this single card but reusable in principle, and "put a token that's a copy of a given creature card onto the battlefield", a very basic and fairly common operation that might be further broken down into "create a token copy of a given creature card" and "put a given new creature onto the battlefield under the control of a given player").

Omae Wa Mou Shindeiru

This topic is closed to new replies.

Advertisement