Manual

From CCG Kit
Jump to: navigation, search

Fundamental concepts

Stats

Stats are a fundamental concept in CCG Kit. They represent integer values that can change over the course of a game and are used in both players and cards. For example, a player could have life and mana stats and a creature card could have cost, attack and defense stats. Stats are transmitted over the network, which means you should only use them to represent values that can actually change over the course of a game in order to save bandwidth.

Stats have the following properties:

  • Base value: The initial value of the stat.
  • Original value: A copy of the initial value of the stat (useful as the base value may change over time).
  • Minimum value: The minimum value of the stat.
  • Maximum value: The maximum value of the stat.
  • Modifiers: The modifiers that affect the current value (+3, -1, etc.). They can be permanent or temporary (i.e., have a duration of X turns). A modifier will never change the effective value of the stat in a way that makes it lower than its minimum value or higher than its maximum value. A modifier with a duration of 0 means it is permanent.
  • Effective value: The current value of the stat with all its modifiers applied. Game code will mostly use this to retrieve the actual value of a stat at a given moment in time.

Stats are implemented by the Stat class, which you can find in the Core/Scripts/Foundation folder.

Keywords

You can think of keywords as enum-like stats. They are particularly useful if you need cards to have a field with a specific subset of possible values (like a static ability, which could take values such as "taunt" or "hexproof"). Just like stats, keywords are transmitted over the network.

Keywords are implemented by the Keyword class, which you can find in the Core/Scripts/Foundation folder.

Properties

Properties are card values that are constant. Because they never change, they are never transmitted over the network (which helps saving bandwidth). Common examples of properties in a CCG are the card's name, its picture, its collector number, etc.

Properties are implemented by the Property class, which you can find in the Core/Scripts/Foundation folder.


The editor

CCG Kit was born with extensibility in mind. Central to this idea is the CCG Kit editor, which allows for easy manipulation of the game configuration files that store the fundamental properties of a game and its cards. We are going to walk you through the available options in the CCG Kit editor using the accompanying demo game's configuration as a reference. To open the editor, select the Tools/CCG Kit Editor menu option:

ccg_kit_editor.png

You can open an existing game configuration by clicking on the Open button (your selection will be remembered in future sessions for convenience). The accompanying demo game's configuration is located in the CCGKit/Demo/Resources folder.

Game configuration tab

editor_game_configuration.png

The game configuration tab allows you to modify the following general settings of your game:

  • Turn duration: The duration of a turn in seconds.
  • Minimum deck size: The minimum number of cards a deck must have.
  • Maximum deck size: The maximum number of cards a deck must have.
  • Game start actions: The actions that happen automatically when the game starts.
  • Turn start actions: The actions that happen automatically when a turn starts.
  • Turn end actions: The actions that happen automatically when a turn ends.
  • End game conditions: The conditions that cause the game to end.

The game/turn actions and end game conditions are a convenient way to script automatic behavior for your game without the need of programming. For example, the accompanying demo game uses the following actions:

  • Game start: The player decks are shuffled and 5 cards are drawn from them to form their hands.
  • Turn start: The mana stat is set to the turn number and 1 card is drawn from the deck into the hand of the active player.

And the following end game conditions:

  • If a player reaches 0 life, he automatically loses the game.
  • If a player reaches 0 cards on his deck, he automatically loses the game.

The actions are executed in the same order they have in the editor (from top to bottom).

Game zones tab

editor_game_zones.png

The game zones tab allows you to define the game zones available in your game and their settings:

  • Name: The name of the game zone.
  • Owner: The owner of the game zone (possible values are Player for personal zones and Shared for shared zones).
  • Type: The type of the game zone (possible values are Static for static zones and Dynamic for dynamic zones). A static zone is a zone that contains cards whose attributes never change (e.g., cards in a deck will usually never change so we can just store their unique identifiers internally). A dynamic zone is a zone that contains cards whose attributes can change (e.g., cards on the board will usually change as the game progresses so we need to store their complete, most up-to-date state internally).
  • Owner visibility: The visibility of the game zone for its owner player (possible values are Visible for visible zones and Hidden for hidden zones).
  • Opponent visibility: The visibility of the game zone for the opponent player (possible values are Visible for visible zones and Hidden for hidden zones).
  • Has maximum size/Maximum size: The maximum number of cards this game zone can contain (if any).

Player tab

editor_player.png

The player tab allows you to define the stats that players in your game will have:

  • Name: The name of the player stat.
  • Base value: The initial value of the player stat.
  • Minimum value: The minimum value of the player stat.
  • Maximum value: The maximum value of the player stat.

Card types tab

editor_card_types.png

The card types tab allows you to define the stats, properties and destroy conditions that cards in your game will have.

Card stats have the following properties:

  • Name: The name of the card stat.
  • Base value: The initial value of the card stat.
  • Minimum value: The minimum value of the card stat.
  • Maximum value: The maximum value of the card stat.

Card properties have the following properties:

  • Name: The name of the card property.
  • Default value: The initial value of the card property.

Keywords tab

editor_keywords.png

The keywords tab allows you to define the keywords available in your game and their values.

Card collection tab

editor_card_collection.png

The card collection tab allows you to define the cards available in your game and their settings:

  • Name: The name of the card.
  • Usually one or more stats and properties: These are based on the stats and properties you defined previously in the card types tab.
  • Costs: The costs of playing this card.
  • Keywords: The keywords of this card.
  • Abilities: The abilities of this card.

There are two types of abilities:

  • Triggered abilities: They are abilities that are resolved when their associated trigger takes place (e.g., "when the card enters the board", "at the beginning of the turn", etc.).
  • Activated abilities. They are abilities that are resolved when their associated cost is payed for (e.g., "when the player pays 2 mana").

These abilities always have an effect, which is the actual gameplay of the ability ("deal 1 damage to enemy player", "heal all player creatures", etc.).

Additionally, you can use keywords to implement static abilities. Static abilities require additional, custom programming for implementing their specific gameplay (e.g., see the impetus and provoke keywords in the accompanying demo).

Please note that the accompanying demo game does not currently have any examples of cards with activated abilities. This is something we might tackle in a future update (as it requires additional UI work); in the meantime you can also implement your own system because the underlying code exists and is functional. In order to activate an activated ability, you simply need to call the ActivateAbility method in the Player class with appropriate arguments (the zone of the card, the instance identifier of the card and the index of the ability you want to activate). Most likely, you will want to do this from within the DemoHumanPlayer class (if you are taking the demo game as a reference).

The target of an effect can be a player or a card. The target conditions list allows you to specify one or more conditions that need to be true for the target in order for the effect to be triggered. If more than one condition is specified, all of them will need to be true.