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.
- 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
).
Before running the project, ensure you have the following installed:
- C/C++ Compiler:
- GCC (Linux/Mac) or MinGW (Windows).
- SFML Library:
- Download and install SFML from SFML's official website.
- Make sure SFML is properly linked to your project.
- CURL (for downloading scenario files):
- Ensure
curl
is installed on your system.
- Ensure
- Windows API (for sound and system commands):
- Required for
PlaySound
andsystem
commands.
- Required for
git clone https://github.com/your-username/HexaClash.git
cd HexaClash
-
Download and install SFML.
-
Add SFML's
include
andlib
directories to your compiler's search paths. -
Ensure
sfml-audio-2.dll
,sfml-graphics-2.dll
, and other SFML DLLs are in thebin/Debug
orbin/Release
folder.
Install SFML using your package manager:
sudo apt-get install libsfml-dev # For Ubuntu/Debian
brew install sfml # For Mac
g++ -std=c++11 main.c gameInterface.cpp -o HexaClash -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio
- open
HexaClash.cbp
using Code::Blocks - click "Build and run" or press F9
-
Run the Program
-
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.
-
-
View the Battle:
-
The graphical interface will display the battle grid, units, and health bars.
Click on units to enlarge or shrink their images.
-
-
Battle Simulation:
-
The battle is simulated automatically, and the results are logged to
savas_sim.txt
.
-
-
Replay or Exit:
-
After the battle, you can choose to replay the simulation or exit the program.
-
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
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
}
}
}
-
MYounes: JSON file parsing and unit data management.
-
Merve Sevim: SFML integration and UI design.