Skip to content

Coffee-deve/MysticFlow_

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MysticFlow – Algorithm Visualization Game (Unity)

MysticFlow is an ** Unity game** created using design patterns and taking SOLID rules under consideration.

The application introduces key algorithms used in computer science by integrating them into a game environment where players can explore, discover, and complete tasks related to algorithm execution.

The project is implemented in C# using the Unity game engine, leveraging strong typing and modular architecture to maintain code reliability, maintainability, and separation of responsibilities.


Table of Contents

  1. Overview
  2. Game Features
  3. Technologies Used
  4. Project Structure
  5. Core Systems
  6. How the Game Works
  7. Running the Project

Overview

MysticFlow focuses on making algorithm learning visual, interactive, and engaging, while having a clean code architecture.

The game currently implements visualizations of the following algorithms:

Graph Traversal Algorithms

  • Breadth-First Search (BFS)
  • Depth-First Search (DFS)

Sorting Algorithms

  • Merge Sort
  • Insertion Sort
  • Bubble Sort

Once a challenge is completed, the algorithm becomes marked as discovered in the task list.

The system allows players to:

  • Observe algorithm execution visually
  • Track their progress through a task list
  • Discover algorithms through gameplay

Game Features

  • Modular architecture using interfaces and desing patterns ( Singletons, State and Command design patterns)
  • Interactive algorithm visualization
  • Gamified learning experience
  • Scene-based state management
  • Persistent UI task tracking system
  • Algorithm discovery mechanics

Technologies Used

  • Unity Game Engine
  • C#
  • Object-Oriented Design Patterns
    • State Pattern
    • Command Pattern
    • Interface-based architecture

Project Structure

interfaces/
│
├── IGameState.cs
├── ICommand.cs
└── IInventoryState.cs

state_machine/
│
├── SceneController.cs
├── GameManager.cs
├── GameState.cs
├── MenuState.cs
├── DuringGameState.cs
├── BFS.cs
├── DFS.cs
├── Merge.cs
├── Insertion.cs
├── Bubble.cs
└── FinishState.cs

movement/
│
├── DirectionManager.cs
├── GeraltMovement.cs
├── GeraltMovementMap.cs
├── TransformFlipper.cs
└── FlipController.cs

commands/
│
├── MoveCommand.cs
└── JumpCommand.cs

algorithms/
│
├── SortingManagerBubble.cs
├── SortingManagerInsertion.cs
├── SortingManagerMerge.cs
├── BFSCode.cs
└── DFSCode.cs

ui/
│
├── PersistentUI.cs
└── TextMoverTMP.cs

Core Systems

State Machine

The game uses a state machine architecture to control transitions between gameplay states.

Main states include:

  • MenuState – main menu
  • DuringGameState – active gameplay
  • FinishState – end of gameplay
  • algorithm-specific states (BFS, DFS, sorting)

The GameManager and SceneController coordinate state transitions and manage scene loading.


Command Pattern

Player actions are implemented using the Command Pattern, improving modularity and scalability.

Commands implemented:

  • MoveCommand
  • JumpCommand

Each command encapsulates a specific player action, making the system easier to extend and maintain.


Algorithm Visualization System

Dedicated scripts manage algorithm visualization and execution logic.

Implemented algorithms:

Graph Algorithms

  • BFS (BFSCode.cs)
  • DFS (DFSCode.cs)

Sorting Algorithms

  • Bubble Sort (SortingManagerBubble.cs)
  • Insertion Sort (SortingManagerInsertion.cs)
  • Merge Sort (SortingManagerMerge.cs)

Each algorithm script handles its own visualization and execution behavior within the game environment.


Persistent UI System

The PersistentUI component manages a user interface that remains available across multiple scenes.

Key responsibilities:

  • Display the Task List showing discovered algorithms
  • Track player progress
  • Update task completion status dynamically

Interface behavior:

  • Visible only in the TaskList scene
  • Hidden in gameplay scenes to avoid interference
  • Completed tasks change text color to indicate progress

The system provides methods to:

  • Update task progress
  • Reset UI state when the game restarts

This ensures a clear separation between UI state management and gameplay logic.


How the Game Works

  1. The player explores the game environment.
  2. Algorithm-related challenges are discovered.
  3. Completing a challenge marks the algorithm as solved.
  4. The Task List UI updates automatically.
  5. Players can review discovered and undiscovered algorithms.

Running the Project

1. Clone the Repository

2. Open the Project in Unity

3. Run the Game

or

1. Link to download the build: https://coffee-deve.itch.io/mystic-flow

Educational Purpose

MysticFlow was created as an educational tool to demonstrate computer science algorithms through interactive visualization and gameplay. The project combines game development techniques with algorithm education to create a more engaging learning experience.


Created as part of a final enginering project: software design and game development focused on using computer science knowledge.

About

Game written in C# on Unity Game Engine

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors