Coming Soon to IOS and Android!
(Almost) Shipped Game!
I was contracted by Jason Anarchy Games to create a mobile game version of his popular card game Cheese Factory! This was a solo project that I took on and it is now in playtesting, set to launch on the Google Play Store and Apple app store soon!
Check out the physical card game here:
How I Created It - Decks
The game has many different cards, some which function similarly to each other, and some with unique abilities. I decided to create a simple ScriptableCardData class which would be the base class for all of the cards, and contain all of the necessary data that each card would always have, and could be edited in the Unity Editor window. I then created children for each of the types of cards, and put each into it’s own List of that type to create the decks:
Craft Deck - The ingredients the player can use to craft recipes
Recipe Deck - The cards that give you points to win the game
Machine Deck - Unique cards that have abilities to help speed up your win or slow your opponents down.
I created methods for each action the player could do with each the deck:
Shuffle
Draw
Discard
Look at discard pile
Remove card from discard pile
Reshuffle discard into deck
Alpha v1.0.0 market
How I Created It - Market
The market is the shared pool of cards that the player can take from on their turn. There are 3 rows, one for each deck, and four cards are flipped face up next to each one. If there is a duplicate, it will stack on top and a new card is flipped until there are four unique cards. In addition, their is a special machine card called the conveyer, which removes the right most card stack, and flips new cards until one is unique to replace it on the far left.
This presents a few unique challenges for coding. First, the stacking mechanic means that the cards should probably not be unique GameObjects on top of one another, since they are functionally the same, and it could cause problems with adding specific ones to the player’s hand, and issues with destroying them when they are no longer needed. Instead, I opted for creating a linked list of Market Entries, which is just the card data, and the number of cards in the stack. This allows me to simply add and subtract an integer when a new card is flipped or taken from the market. I can also remove the stack from the market when there are no more cards. I have the market information stored in both a dictionary and a linked list, so the existence of the card can be easily determined, as well as adding and removing cards in the right spot.
How I Created It - Events
The game has many different events that can happen, everything from touching a card to using Curd Foam to discard an entire market row! I used two classes for the events, one the GameContext, declared them and made them accessible from anywhere in the code, and the other, EventHandler, managed what would happen whenever the events fired.
-
Turn Started
Turn Ended
Last Chance
Game Over
-
Draw From Deck
Take From Market
Touch Card
Discard To Hand Size
Use Character Ability
Scavenge
Trade
Market Trade
Steal
Stomp
Select Card
-
Update UI
Clear Popup
Discard
Open Discard
Open Cheese View
Open Machine View
Open Curd View
Open Mecha Craft
Open Cheazo Craft
Change Market
-
Use Ability
Get Discarded
Destroy Cheese
Destroy Machine
-
Successful Block
Use Curd Foam
Partial method for getting the materials for crafting given a recipe card. It checks many different situations and edge cases to make sure it is behaving how the player expects.
The player class contains all of the properties of the individual player, what they can do on their turn, and anything that changes about them as the game progresses. They have 3 action points each turn, and different actions cost a different amount. The turn manager class handles which player is active, and makes sure the UI is correct. There are a ton of different player actions and unique problem solving that I did, to get it all working, so feel free to reach out if you want to know more!
How I Created It - Player Class
-
Start Turn
End Turn
Change Remaining Actions
Add card to hand
Costs 1 AP for drawing from the top of the craft deck.
Costs 2 AP to take from the market.
Free if added from the Catapult machine or with certain character abilities.
Remove card from hand
Added to discard pile when used to craft a recipe.
Not added to discard pile when traded to another player or stolen.
Buy Machine
Only works if the player has enough AP remaining.
Triggers on buy effects of certain machines.
Remove machine
When it is destroyed by another player, try to block it if applicable
Remove constant effects
Add available material
Remove available material
Add scored card
Remove scored card
Is Cheese craftable
Helper function to determine if a recipe card can be crafted from the player’s cards in hand and owned machines.
Is cheazo craftable
Specific for one recipe that behaves differently.
Craft cheese
Get materials for crafting
Has Fire Block
Add selected card to discard
Remove selected card to discard