Two Cat Games


Perang: 3 Card Battle

Choose a class below to learn about

The Deck Classes

Picture of the Perang Deck of Cards

See the full Java Deck Classes by clicking the buttons below.

Java Full Deck Class Java Player Deck Class

The Java Edition has two Deck classes, Full Deck and Player Deck. As titled, the Full Deck class stores the entire deck of Perang cards while the Player Deck is only filled with Cards the player started with or has earned. The Decks are built with information stored in the Game Data class. In both decks, the Cards are stored as an Array List.

Picture of the Player Deck and Full Deck Class variables.

To keep multiple instances of the Full Deck from being created, the single_instance variable is used in conjuction with a getInstance method. There is no need to do this for the Player Deck because there are two players and therefore two player decks get created during a session. Or at least, that was the plan. Both the Java and Unreal editions only create a single Player Deck. During a battle, the AI's cards are pulled from the Full Deck. This process is only for the stand-alone edition. When this gets inserted into the main game, non-player characters will be given an AI deck which will combine a set of static cards, which the AI NPC will always carry, and some random cards.

Deck Struct

Perang Deck Struct Blueprint

In order to import the card data, a Blueprint Structure (Struct) had to be created. This tells Unreal Engine how to define the various parts of the table.

Deck Data Table

Perang Deck Data Table Blueprint

The Full Perang Deck of cards is kept in a .csv table. This makes it easier to update. I can add, subtract, or modify card data in the table and click the 'Reimport' button to update it in Unreal Engine. Quick and easy. The Level Database Actor is where these accessed. I'll talk about those on that page.

Choose a class below to learn about

Card Card Slot Deck Board State Machines
Project Outline Button Widgets Level Database