8000 GitHub - MYounesDev/HexaClash: A turn-based battle simulator featuring a hexagonal grid, dynamic unit interactions, and epic clashes between Humans and Orcs
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

A turn-based battle simulator featuring a hexagonal grid, dynamic unit interactions, and epic clashes between Humans and Orcs

Notifications You must be signed in to change notification settings

MYounesDev/HexaClash

Repository files navigation

HexaClash - Battle Simulation Project

Overview

HexaClash is a battle simulation project that simulates a turn-based battle between two teams: the Human Empire (insan_imparatorlugu) and the Orc Legion (ork_legi). The project includes a graphical interface built with SFML (Simple and Fast Multimedia Library) and uses JSON files to define unit types, heroes, monsters, and research levels. The simulation calculates damage, critical hits, and other battle mechanics, and logs the results to a file.


Features

  • Turn-Based Battle Simulation: Simulates battles between two teams with attack, defense, and critical hit mechanics.
  • Graphical Interface: Renders a hexagonal grid with unit images, health bars, and main characters (heroes and monsters).
  • Dynamic Unit Placement: Units are randomly placed on the grid based on their team.
  • Health Bars and Stats: Displays health percentages and unit stats in real-time.
  • Interactive UI: Click on units to enlarge or shrink their images.
  • Sound Effects: Plays background music during the welcome screen.
  • Logging: Logs battle results to a file (savas_sim.txt).

Prerequisites

Before running the project, ensure you have the following installed:

  1. C/C++ Compiler:
    • GCC (Linux/Mac) or MinGW (Windows).
  2. SFML Library:
  3. CURL (for downloading scenario files):
    • Ensure curl is installed on your system.
  4. Windows API (for sound and system commands):
    • Required for PlaySound and system commands.

Installation

Step 1: Clone the Repository

git clone https://github.com/your-username/HexaClash.git
cd HexaClash

Step 2: Install Dependencies

On Windows:

  1. Download and install SFML.

  2. Add SFML's include and lib directories to your compiler's search paths.

  3. Ensure sfml-audio-2.dll, sfml-graphics-2.dll, and other SFML DLLs are in the bin/Debug or bin/Release folder.

On Linux/Mac:

Install SFML using your package manager:

sudo apt-get install libsfml-dev  # For Ubuntu/Debian
brew install sfml                # For Mac

Step 3: Compile the Project

Using GCC:

g++ -std=c++11 main.c gameInterface.cpp -o HexaClash -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio

Using Code::Blocks

  1. open HexaClash.cbp using Code::Blocks
  2. click "Build and run" or press F9

Usage

  1. Run the Program

  2. Enter a Scenario Number:

    • The program will prompt you to enter a scenario number (1-10).

    • The scenario file will be downloaded automatically if it doesn't exist locally.

  3. View the Battle:

    • The graphical interface will display the battle grid, units, and health bars.

    • Click on units to enlarge or shrink their images.

  4. Battle Simulation:

    • The battle is simulated automatically, and the results are logged to savas_sim.txt.

  5. Replay or Exit:

    • After the battle, you can choose to replay the simulation or exit the program.

Project Structure

HexaClash/
├── bin/                  # Compiled binaries and SFML DLLs
├── fonts/                # Font files (e.g., Arial.ttf)
├── images/               # Unit, hero, monster, and background images
├── json/                 # JSON files for unit types, heroes, monsters, and research
├── music/                # Background music (music.wav)
├── obj/                  # Object files (generated during compilation)
├── src/                  # Source code files
│   ├── classes.h         # Data structures for units, heroes, monsters, and teams
│   ├── fightFunction.h   # Battle simulation logic
│   ├── functions.h       # Utility functions for file handling and user interaction
│   ├── gameInterface.cpp # Graphical interface implementation
│   ├── main.c            # Entry point of the program
├── README.md             # Project documentation

JSON File Format

The project uses JSON files to define scenarios. Here's an example structure:

{
  "insan_imparatorlugu": {
    "birimler": [
      {"isim": "piyade", "sayi": 100},
      {"isim": "okcu", "sayi": 50}
    ],
    "kahramanlar": [
      {"isim": "Alparslan", "bonus_turu": "saldiri", "bonus_degeri": 10, "etkilenen": "piyade"}
    ],
    "canavarlar": [
      {"isim": "Ejderha", "etki_turu": "savunma", "etki_degeri": 5, "etkilenen": "okcu"}
    ],
    "arastirma_seviyesi": {
      "isim": "savunma_ustaligi",
      "seviye": 1,
      "oran": 10
    }
  },
  "ork_legi": {
    "birimler": [
      {"isim": "ork_dovuscu", "sayi": 120},
      {"isim": "trol", "sayi": 30}
    ],
    "kahramanlar": [
      {"isim": "Goruk_Vahsi", "bonus_turu": "kritik", "bonus_degeri": 15, "etkilenen": "ork_dovuscu"}
    ],
    "canavarlar": [
      {"isim": "Tepegoz", "etki_turu": "saldiri", "etki_degeri": 8, "etkilenen": "trol"}
    ],
    "arastirma_seviyesi": {
      "isim": "elit_egitim",
      "seviye": 2,
      "oran": 20
    }
  }
}

ww

ww


Collaborators

  • MYounes: JSON file parsing and unit data management.

  • Merve Sevim: SFML integration and UI design.

Enjoy the HexaClash simulation! 🎮

About

A turn-based battle simulator featuring a hexagonal grid, dynamic unit interactions, and epic clashes between Humans and Orcs

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  
0