Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

95 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Game of Thrones Inspired Card Game (Unity) ๐Ÿบ๐Ÿ‰

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. ๐Ÿ“œ

๐Ÿ—บ๏ธ Table of Contents

  1. ๐Ÿ“ Project Summary
  2. ๐ŸŽฏ What This Project Is About
  3. ๐Ÿงญ Repository Walkthrough from Root (Step by Step)
  4. ๐Ÿ“ Source vs Generated Folders
  5. ๐Ÿ—‚๏ธ Assets Folder Deep Dive
  6. ๐ŸŒŠ Scene Flow and Player Journey
  7. ๐Ÿ—๏ธ Gameplay Systems Architecture
  8. ๐Ÿƒ Card Model and Rules
  9. โœจ Effects Engine
  10. ๐Ÿค– AI Behavior
  11. ๐Ÿ› ๏ธ Custom Card Compiler (DSL) Pipeline
  12. ๐Ÿ“œ Full Script Map (File-by-File)
  13. ๐Ÿ”ง Technologies and Dependencies
  14. ๐Ÿš€ How to Open and Run the Project
  15. ๐Ÿ“ฆ How to Build the Game
  16. โš ๏ธ Troubleshooting and Maintenance Notes
  17. ๐ŸŒŸ Suggested Next Improvements

1) ๐Ÿ“ Project Summary

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

2) ๐ŸŽฏ What This Project Is About

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

3) ๐Ÿงญ Repository Walkthrough from Root (Step by Step)

The following section explains the repository from the root level, one item at a time.

Step 1 - Version control and repository metadata

  • ๐Ÿ“ฆ .git/
  • ๐Ÿ“‹ .gitattributes
  • ๐Ÿšซ .gitignore

Step 2 - IDE and local tool state

  • ๐Ÿ’ป .vs/
  • โš™๏ธ .vsconfig

Step 3 - Unity/C# solution and project files

  • ๐Ÿ“„ Assembly-CSharp.csproj
  • ๐Ÿ“‚ Gwent Pro 2D.sln
  • ๐Ÿ“‚ Gwent-Project.sln

Step 4 - Main source folder

  • ๐ŸŽฏ Assets/ โ†’ The most important source folder in Unity. Contains scenes, scripts, images, resources, fonts, and TMP assets.

Step 5 - Build output artifacts

  • ๐Ÿ“ฆ Builds/ โ†’ Already generated executable build output.

Step 6 - Supporting documents

  • ๐Ÿ“„ Decks.pdf
  • ๐Ÿ“„ READ_ME.pdf

Step 7 - Unclear or temporary root files

  • git commit -mVersion2.1
  • s

Step 8 - Unity generated project cache

  • ๐Ÿ—„๏ธ Library/, Logs/, obj/

Step 9 - Unity package and project configuration

  • ๐Ÿ“ฆ Packages/
  • โš™๏ธ ProjectSettings/
  • ๐Ÿ‘ค UserSettings/

Step 10 - Repository documentation

  • ๐Ÿ“ README.md โ†’ This file.

4) ๐Ÿ“ Source vs Generated Folders

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.


5) ๐Ÿ—‚๏ธ Assets Folder Deep Dive

๐ŸŽฌ Assets/Scenes/

  • ๐Ÿ  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:

  1. Main.unity
  2. ChosingDeck.unity
  3. Game.unity
  4. CreateCard.unity

๐Ÿ’ป Assets/Script/

Main C# codebase grouped by domains (core flow, cards, drag & drop, effects, menus, compiler).

๐Ÿ–ผ๏ธ Other folders

  • Image/ โ†’ Card art and UI icons
  • Resources/ โ†’ Audio and runtime assets
  • game-of-thrones/ โ†’ Game of Thrones style font
  • TextMesh Pro/ โ†’ TMP shaders and fonts

6) ๐ŸŒŠ Scene Flow and Player Journey

Main journey:

  1. ๐Ÿ  Main menu
  2. ๐Ÿ›ก๏ธ Deck selection scene
  3. โš”๏ธ Game scene (full match)

Optional compiler journey:

  1. Open card compiler from main menu
  2. Write DSL code
  3. Compile successfully
  4. Use the compiler deck in game

7) ๐Ÿ—๏ธ Gameplay Systems Architecture

  • ๐Ÿ‘‘ GameManager โ†’ Global match coordinator
  • ๐Ÿง Player โ†’ Runtime player state and operations
  • ๐Ÿ“Š Panels โ†’ Row and panel management

8) ๐Ÿƒ Card Model and Rules

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


9) โœจ Effects Engine

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).

10) ๐Ÿค– AI Behavior

AI class IA controls automated turns using heuristics:

  • Prioritizes strong hero cards
  • Uses increase and climate cards strategically
  • Falls back to standard units

11) ๐Ÿ› ๏ธ Custom Card Compiler (DSL) Pipeline

The most advanced subsystem:

  • Lexer โ†’ Parser โ†’ Semantic Analysis โ†’ Execution
  • Supports effects, cards, loops, conditionals, selectors, and board context
  • Full UI in CreateCard.unity scene

12) ๐Ÿ“œ Full Script Map (File-by-File)

Core gameplay:

  • GameManager.cs
  • IA.cs

Card & Player:

  • Card.cs
  • Player.cs
  • CardDisplay.cs
  • DeckManager.cs

Drag & Drop:

  • Drag.cs
  • Drop.cs
  • DropCard.cs

Effects:

  • Effects.cs
  • EventClick.cs

Menus & Panels:

  • MainMenu.cs
  • Chose.cs
  • Panels.cs
  • KeepMusic.cs

Compiler:

  • ProgramCompiler.cs
  • Button_Run.cs
  • Lexer/, Parser/, Card/, Effect/, Expression/, Scope/, Utils/

13) ๐Ÿ”ง Technologies and Dependencies

  • ๐ŸŸฆ Unity 2022.3.15f1
  • ๐Ÿ’ป C#
  • TextMesh Pro, UGUI, and other Unity packages

14) ๐Ÿš€ How to Open and Run the Project

Prerequisites:

  • Unity Hub
  • Unity Editor 2022.3.15f1

Steps:

  1. Open the project in Unity Hub
  2. Open Assets/Scenes/Main.unity
  3. Press Play ๐ŸŽฎ

Recommended test:

  • Start game โ†’ Choose decks โ†’ Play with drag & drop

15) ๐Ÿ“ฆ How to Build the Game

  1. Open Build Settings
  2. Verify the 4 scenes are added and enabled
  3. Select Standalone Windows 64-bit
  4. Build

16) โš ๏ธ Troubleshooting and Maintenance Notes

  • 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.1 and s

17) ๐ŸŒŸ Suggested Next Improvements

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.Load with Addressables

โœจ Closing Notes

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! ๐Ÿƒ

About

๐ŸŽฒ Card game, inspired by the rich and complex universe of 'Game of Thrones.' It is a strategy game that features an interpreter capable of converting lines of code into physical cards with powers.

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages