DeckStacker v1.0
A card manager plugin for Unity games.
 
Loading...
Searching...
No Matches
DeckStacker Concepts

This page is dedicated to high level concepts.

What does DeckStacker do?

DeckStacker primarily takes care of 3 things:

  1. Basic card behavior
  2. Basic card organization
  3. Manages a queue of commands (called DSActions)

Let's breakdown what all that means.

Basic Card Behavior

I'm defining "card behavior" fairly broadly, here. Let's list out all the different things that DeckStacker cards do:

  1. Movement
  2. Flipping to face up or face down
  3. Rotating
  4. Scaling
  5. Updating basic card art (traditional card art by default)
  6. Tinting the card
  7. Fading the card (transparency)

That's a big list! Generally speaking, these are all behaviors that you may want to utilize for a card game.

Some of these behaviors are very obvious (like card movement and flipping), but some of them are less obvious (like tinting cards and fading them). I've been using this system for a few years, now, and gradually building up its capabilities. I've found that all of these different behaviors come in handy in just about any kind of game using cards.

Basic Card Organization

Another staple of card games is how you are going to group and display cards to players.

In a typical card game, you can have cards arranged in a lot of different ways.
To name a few:

  • Face down deck
  • Face up splay (horizontal or vertical)
  • A fan of cards in a player's hand
  • Cards can also be free, placed around the table without a particular anchor-point

To account for the most common ways cards can be grouped and displayed, DeckStacker organizes cards into stacks.

Stacks

These stacks have the following settings to change the way cards are arranged:

  • Is the card arrangement "Loose" or "Tight"
    A Loose Stack

    A Tight Stack
  • What card spacing and direction will they be arranged?
    • Pile (classic deck)
    • Row
    • Column
    • Fan (best for player hands)
Stacks Demo Scene

These stack categories will cover nearly any card arrangement you need for most games. Theoretically, you can arrange cards in an infinite number of ways, but the defaults provided in this system should cover most of what you want to do.

Important Note: All Cards Should Belong To A "Stack"

If there is one concept that should be kept in mind when using DeckStacker, it's that all cards need to be a part of a stack at all times. The system uses this assumption fairly frequently. If you don't want a card (or cards) to be strictly organized, there is an option called the "Undefined" stack type, which doesn't explicitly arrange cards in any particular way, allowing you as the developer to enforce your own card placement.

Additionally, if you feel up to it, you can extend the restack code to accomodate more stack types.

The Action Queue

As previously stated in the Intro page, DeckStacker was built with the idea that card games generally have 1 thing that happen at a time.

To help facilitate this, a DSAction List is kept in DSActionQueue that allows the developer to add actions to it, and these actions will be executed in the order they appear in the List. This allows the developer to queue up several events ahead of time and let them play out.

Within this setup, you can add timing DSActions, such as DSDelayAction or DSWaitForCardsToStopAction, to allow for the game state to catch up to a particular point before the DSActionQueue continues with its work. (Optionally, you can make your own Custom Actions if you want the queue to pause for some other game state be present, before continuing)

An example of how this can be utilized:

  1. A table of cards and stacks is loaded into the scene
  2. Immediately, we want to set the table
  3. All cards are shuffled in a Main Deck
  4. Main Deck cards are then evenly distributed between 2 Player Decks
  5. Those individual Player Decks are then shuffled
  6. A hand of cards is dealt to each player from their respective Player Decks

With the exception of #1, the order of operations here are all supported by default DeckStacker DSActions. DeckStacker can only take you so far, though, so a framework is setup for you to make your own Custom Actions fairly easily.

More detailed info about how this works can be found in the DSActionQueue page and DSAction Guidelines and Use.