This repository contains a complete Unity card game inspired by Gwent, with a Game of Thrones theme and one major custom feature: a built-in DSL compiler that lets players create their own playable cards with scripted effects. โจ
If you want to understand this project from the root folder down to every gameplay and compiler module, this document is the full step-by-step guide. ๐
- ๐ Project Summary
- ๐ฏ What This Project Is About
- ๐งญ Repository Walkthrough from Root (Step by Step)
- ๐ Source vs Generated Folders
- ๐๏ธ Assets Folder Deep Dive
- ๐ Scene Flow and Player Journey
- ๐๏ธ Gameplay Systems Architecture
- ๐ Card Model and Rules
- โจ Effects Engine
- ๐ค AI Behavior
- ๐ ๏ธ Custom Card Compiler (DSL) Pipeline
- ๐ Full Script Map (File-by-File)
- ๐ง Technologies and Dependencies
- ๐ How to Open and Run the Project
- ๐ฆ How to Build the Game
โ ๏ธ Troubleshooting and Maintenance Notes- ๐ Suggested Next Improvements
Project Type:
- ๐ฎ Unity 2D Card Strategy Game
Core Idea:
- โ๏ธ Two players (human vs human or human vs AI) battle with faction decks in rounds.
- ๐ Cards have types, positions, power values, and effects.
- ๐จ๏ธ Includes weather, boosts, bait mechanics, leader effects, and cemetery interactions.
Unique Feature:
- โจ A custom compiler lets players define new cards through a mini language (DSL).
- ๐ Compiled cards are added to a special custom deck that can be selected in deck selection.
Engine and Language:
- ๐ฆ Unity 2022.3.15f1
- ๐ป C# scripts
At gameplay level, this is a tactical card battle game where each player manages:
- ๐ A deck
- โ A hand
- ๐ก๏ธ Three combat rows (Melee, Range, Siege)
- โญ Boost slots
- ๐ฉ๏ธ Weather slot
- โฐ๏ธ Cemetery
Players take turns placing cards and activating effects. At the end of each round, row power is calculated and the match concludes when a player wins enough rounds. ๐
At engineering level, the project combines:
- ๐ฎ Traditional Unity game systems (scene flow, UI, drag and drop, audio, turn manager)
- ๐ Data-driven card creation with ScriptableObject-like structure
- ๐ง A custom lexer-parser-semantic-runtime pipeline for user-generated card logic
The following section explains the repository from the root level, one item at a time.
- ๐ฆ
.git/ - ๐
.gitattributes - ๐ซ
.gitignore
- ๐ป
.vs/ - โ๏ธ
.vsconfig
- ๐
Assembly-CSharp.csproj - ๐
Gwent Pro 2D.sln - ๐
Gwent-Project.sln
- ๐ฏ
Assets/โ The most important source folder in Unity. Contains scenes, scripts, images, resources, fonts, and TMP assets.
- ๐ฆ
Builds/โ Already generated executable build output.
- ๐
Decks.pdf - ๐
READ_ME.pdf
git commit -mVersion2.1s
- ๐๏ธ
Library/,Logs/,obj/
- ๐ฆ
Packages/ - โ๏ธ
ProjectSettings/ - ๐ค
UserSettings/
- ๐
README.mdโ This file.
Primary source-of-truth folders:
- โ
Assets/ - โ
Packages/ - โ
ProjectSettings/
Usually generated or local-only:
- โ
Library/ - โ
Logs/ - โ
obj/ - โ
.vs/ - โ
UserSettings/ - โ
Builds/
Practical rule: Focus on Assets/, Packages/, and ProjectSettings/ when modifying gameplay or content.
- ๐
Main.unity- Main menu scene - ๐ก๏ธ
ChosingDeck.unity- Deck and player setup scene - โ๏ธ
Game.unity- Main battle scene - ๐งช
CreateCard.unity- Custom card compiler scene
Build order:
Main.unityChosingDeck.unityGame.unityCreateCard.unity
Main C# codebase grouped by domains (core flow, cards, drag & drop, effects, menus, compiler).
Image/โ Card art and UI iconsResources/โ Audio and runtime assetsgame-of-thrones/โ Game of Thrones style fontTextMesh Pro/โ TMP shaders and fonts
Main journey:
- ๐ Main menu
- ๐ก๏ธ Deck selection scene
- โ๏ธ Game scene (full match)
Optional compiler journey:
- Open card compiler from main menu
- Write DSL code
- Compile successfully
- Use the compiler deck in game
- ๐
GameManagerโ Global match coordinator - ๐ง
Playerโ Runtime player state and operations - ๐
Panelsโ Row and panel management
Main card fields:
- Name, Faction, Power, Description, Artwork, Card type, Position constraints, Effect
Card positions: M, R, S, combinations (MR, MS, RS, MRS), and special zones (I, C, L)
Card kinds: Golden, Silver, Climate, Clear, Bait, Increase, Leader
Predefined decks: Stark ๐บ, Targaryen ๐, Dead โ๏ธ, and deckCompiler
Effects implemented in the static Effects class:
- Row buffs, weather damage, remove max/min cards, draw cards, power multipliers, row clear, bait return, and leader-specific effects (Jon Snow, Daenerys, Night King).
AI class IA controls automated turns using heuristics:
- Prioritizes strong hero cards
- Uses increase and climate cards strategically
- Falls back to standard units
The most advanced subsystem:
- Lexer โ Parser โ Semantic Analysis โ Execution
- Supports effects, cards, loops, conditionals, selectors, and board context
- Full UI in
CreateCard.unityscene
Core gameplay:
GameManager.csIA.cs
Card & Player:
Card.csPlayer.csCardDisplay.csDeckManager.cs
Drag & Drop:
Drag.csDrop.csDropCard.cs
Effects:
Effects.csEventClick.cs
Menus & Panels:
MainMenu.csChose.csPanels.csKeepMusic.cs
Compiler:
ProgramCompiler.csButton_Run.csLexer/,Parser/,Card/,Effect/,Expression/,Scope/,Utils/
- ๐ฆ Unity 2022.3.15f1
- ๐ป C#
- TextMesh Pro, UGUI, and other Unity packages
Prerequisites:
- Unity Hub
- Unity Editor 2022.3.15f1
Steps:
- Open the project in Unity Hub
- Open
Assets/Scenes/Main.unity - Press Play ๐ฎ
Recommended test:
- Start game โ Choose decks โ Play with drag & drop
- Open Build Settings
- Verify the 4 scenes are added and enabled
- Select Standalone Windows 64-bit
- Build
- Scene references broken โ Reimport assets
- Text not rendering โ Import TextMesh Pro essentials
- Compiler errors โ Check field names and effect parameters
- Clean temporary files:
git commit -mVersion2.1ands
Short-term:
- Replace hardcoded effect lists with metadata
- Add unit tests for compiler
- Move card definitions to JSON/ScriptableObjects
Mid-term:
- Deck save/load system
- Localization support
- Replace
Resources.Loadwith Addressables
This codebase is an ambitious educational project that combines real-time Unity gameplay, tactical card mechanics, and a complete mini-compiler embedded into the game.
It is especially useful for studying game architecture, scripting language implementation, and integrating custom runtime logic into a playable experience. ๐ฅ
Enjoy building and creating your own legendary cards! ๐