File size: 4,492 Bytes
7a4812b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# DCE

# πŸ•ΉοΈ Dungeon-Crawler-Engine

Modular dungeon crawler simulation for **AI-driven gameplay**, **pathfinding experiments**, and **cryptographic save testing**.  
**Under development** by **YSNRFD**

---

## 🧠 DCE_ysnrfd – Procedural Dungeon Crawler Engine with AI & Secure Save System

[![Python](https://img.shields.io/badge/python-3.8%2B-blue.svg)](https://www.python.org/)
[![Game Engine](https://img.shields.io/badge/Engine-Modular-lightgreen.svg)]()
[![Save System](https://img.shields.io/badge/Saves-Cryptographically%20Signed-critical.svg)]()

---

## πŸš€ Overview

**DCE_ysnrfd** is an extensible, modular dungeon crawler simulation built in pure Python.  
It includes a secure save/load system using cryptographic HMACs, procedurally generated dungeons, an intelligent A\* enemy AI, and a structured turn-based system.  
Perfect for prototyping **game mechanics**, **AI behavior**, and **simulation loops**.

This project is for **educational purposes**, AI/ML pathfinding demos, and ethical development only.

---

## ✨ Features

- 🧱 **Procedural Dungeon Generation**  
  Uses recursive division with controlled randomness to generate interconnected dungeon layouts.

- 🧠 **A\* Pathfinding**  
  Enemies use a priority queue with Manhattan heuristics for navigation and targeting.

- βš™οΈ **Component-Based Entity System**  
  Players, enemies, and items are all modeled with clean, modular class structures.

- πŸ”’ **Cryptographic Save/Load**  
  Uses HMAC-SHA256 to verify save integrity. Saves are rejected if tampered.

- ⏱️ **Turn-Based State Machine**  
  Robust finite state system for clean transitions (menu β†’ gameplay β†’ endgame).

- πŸ§ƒ **Inventory & Items System**  
  Supports armor, weapons, potions, and quest items with metadata and effects.

- πŸ“œ **Type-Hinted & Extensible**  
  Fully annotated for IDE support and future expansion.

- πŸ““ **Verbose Logging System**  
  Game states and events are logged to `dungeon_crawler.log`.

---

## πŸ“¦ Installation

**1. Clone the repository**

```bash
git clone https://github.com/ysnrfd/DCE.git
cd DCE-main
```

**2. Run the program**

Linux:
```python
python3 dungeon_crawler.py
```
Windows:
```python
python dungeon_crawler.py
```




## πŸ”§ Usage Examples

**Run the main game loop**
```python
python dungeon_crawler.py
```

**Use the map generation module alone**

```python
from dungeon_crawler import DungeonGenerator
map_data = DungeonGenerator(width=40, height=20).generate()
print(map_data)
```

**Save and verify game state**

```python
from dungeon_crawler import SaveSystem, GameState

state = GameState(...)
SaveSystem.save(state, "game_state.encrypted")
verified = SaveSystem.load("game_state.encrypted")
```


## πŸ“‚ Project Structure
```structure
dungeon-crawler-engine/
│── dungeon_crawler.py        # Main game engine
│── #dungeon_crawler.log       # Log output
│── #game_state.encrypted      # Cryptographically signed game save
│── README.md                
│── LICENSE
```


## πŸ” Save System Details
- **Based on HMAC-SHA256 with secret key**  

- **Includes timestamp and anti-replay protection**  

- **Invalid or tampered saves are automatically discarded**  


## 🧠 Algorithms & Internals
- **Pathfinding: A with open/closed sets, priority queues (heapq)**  

- **Dungeon Generation: Recursive division + random room linking**  

- **State Machine: Enum-based game states and transitions**  

- **Secure Save: JSON serialization + hmac + secrets**


## πŸ›£οΈ Roadmap
**βœ… Cryptographic save/load system**  

**βœ… Procedural generation engine**  

**βœ… A pathfinding and enemy AI** 

**πŸ”² GUI version with Pygame or Pyxel**  

**πŸ”² Quest/dialogue system**  

**πŸ”² Plugin API for modding**  

**πŸ”² Fog of war and minimap**  



## ⚠️ Ethical Usage Notice
This engine is intended for learning, game prototyping, and academic experiments only.  
You are not permitted to use this code in unethical simulations or closed-source game repackaging without preserving attribution.

## πŸ“ License
This project is licensed under the **YSNRFD License.**  
You are free to fork and build upon it with proper credit and within ethical guidelines.  
Redistribution without credit is strictly forbidden.  

## πŸ‘¨β€πŸ’» Author
**Developer: YSNRFD**  
**Telegram: @ysnrfd**

## ⭐ Support This Project
**If you enjoyed this project or learned something useful, please star it on GitHub and share it with others!**