Advertisement Jump to content
Sign in to follow this  

Making of a "TCG"-styled game.

This topic is 2592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post

Link to post
Share on other sites
  • 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").

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!