Made with:
Unreal Engine (C++ and Blueprints)
Cards System (2024)
Introduction
Using a combination of Blueprints and C++, this card system recreates the popular card game Trash. Players must complete a layout of face-down cards by drawing and swapping cards according to their positions. Wildcards (Jacks) can be placed in any position, and the round ends when a player's layout is fully revealed. You can find the full rules of Trash on bicycle's website.
Notable Problems Solved
- C++-Driven Player Logic and Game Architecture
- AI Card Player
- Delegates to Indicate the Player's Turn
C++-Driven Player Logic and Game Architecture

Part of the important 'Interact' function.
Every object the player can interact with (the stock pile, each card in their layout, and the discard pile) has an actor component attached called the 'InteractComponent'. This component sets up all the interactions based on the current state of the game (player's turn or computer's turn, has the player drawn a card yet, etc.).
C++ is extensively used to manage all player interactions that influence game state and surrounding actors. This ensures efficient gameplay flow by handling critical mechanics with clear, reusable functions.
AI Card Player

Behavior tree of the AI.
The player competes against an AI opponent, developed using Unreal Engine's Behavior Tree system. The AI's behavior is structured into a series of tasks, such as drawing, placing cards, or discarding.
The Blackboard system in Unreal is used to allow the AI to make decisions based on the game's current state (is the card drawn a wildcard?, is it the computer's turn?, which cards are still face down in the AI's layout?, etc.). The Blackboard is an efficient place for the AI to store data relevant to its decision-making process.
Delegates to Indicate the Player's Turn

White highlight around the layout to indicate the turn.
To handle turn transitions efficiently, I implemented delegates in C++. After each discard, a delegate triggers a function that updates the game state and visually highlights the current player's layout.
This approach is a quick, efficient way of communicating to the player when it is their turn to play without the need for a busy HUD. By using delegates I was able to encapsulate the state-specific code, ensuring the card piles don't need to directly manage or be aware of the layout highlight logic.