AntDX316 commited on
Commit
227e0d8
·
1 Parent(s): 3917e9e
Files changed (4) hide show
  1. .dockerignore +23 -0
  2. Dockerfile +12 -0
  3. README.md +83 -1
  4. docker-compose.yml +11 -0
.dockerignore ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Git
2
+ .git
3
+ .gitignore
4
+ .gitattributes
5
+
6
+ # Docker
7
+ Dockerfile
8
+ docker-compose.yml
9
+ .dockerignore
10
+
11
+ # Node.js (if you later add npm packages)
12
+ node_modules
13
+ npm-debug.log
14
+
15
+ # IDE files
16
+ .idea
17
+ .vscode
18
+ *.swp
19
+ *.swo
20
+
21
+ # OS files
22
+ .DS_Store
23
+ Thumbs.db
Dockerfile ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nginx:alpine
2
+
3
+ # Copy the application files to the nginx html directory
4
+ COPY index.html /usr/share/nginx/html/
5
+ COPY styles.css /usr/share/nginx/html/
6
+ COPY script.js /usr/share/nginx/html/
7
+
8
+ # Expose port 80
9
+ EXPOSE 80
10
+
11
+ # Start Nginx server
12
+ CMD ["nginx", "-g", "daemon off;"]
README.md CHANGED
@@ -7,4 +7,86 @@ sdk: docker
7
  pinned: false
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  pinned: false
8
  ---
9
 
10
+ # Battle Simulator
11
+
12
+ An interactive battle simulation where red and blue forces fight on a dynamic battlefield. The application features different unit types, automatic combat AI, and an interactive interface that lets you inspect units during battle.
13
+
14
+ ## Features
15
+
16
+ - **Multiple Unit Types**: Infantry, Tank, and Artillery units with unique stats and abilities
17
+ - **Dynamic Combat**: Units automatically seek targets, attack, and respond to battlefield conditions
18
+ - **Interactive UI**: Click on any unit to see its detailed stats and status
19
+ - **Auto-respawn**: Units respawn after being defeated, maintaining continuous battle
20
+ - **Visual Effects**: Attack lines, health bars, and status indicators provide visual feedback
21
+
22
+ ## Running the Application
23
+
24
+ ### Standard Method
25
+
26
+ Simply open the `index.html` file in any modern web browser:
27
+
28
+ ```
29
+ # Windows
30
+ start index.html
31
+
32
+ # macOS
33
+ open index.html
34
+
35
+ # Linux
36
+ xdg-open index.html
37
+ ```
38
+
39
+ ### Using Docker
40
+
41
+ This application can also be run using Docker, which ensures consistent behavior across different environments.
42
+
43
+ #### Prerequisites
44
+
45
+ - Docker
46
+ - Docker Compose (optional, for easier management)
47
+
48
+ #### Using Docker Directly
49
+
50
+ 1. Build the Docker image:
51
+ ```
52
+ docker build -t battle-simulator .
53
+ ```
54
+
55
+ 2. Run the container:
56
+ ```
57
+ docker run -p 8080:80 battle-simulator
58
+ ```
59
+
60
+ 3. Open your browser and navigate to:
61
+ ```
62
+ http://localhost:8080
63
+ ```
64
+
65
+ #### Using Docker Compose
66
+
67
+ 1. Start the application:
68
+ ```
69
+ docker-compose up
70
+ ```
71
+
72
+ 2. Open your browser and navigate to:
73
+ ```
74
+ http://localhost:8080
75
+ ```
76
+
77
+ 3. To stop the application:
78
+ ```
79
+ docker-compose down
80
+ ```
81
+
82
+ ## How to Use
83
+
84
+ - **View Unit Info**: Click on any unit to see its details in the info panel
85
+ - **Close Info Panel**: Click the "Close" button to dismiss the unit info panel
86
+ - **Watch the Battle**: Observe as units automatically engage in combat across the map
87
+
88
+ ## Technical Details
89
+
90
+ - Built with pure JavaScript, HTML5, and CSS3
91
+ - Uses HTML5 Canvas for rendering
92
+ - No external dependencies required
docker-compose.yml ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3'
2
+
3
+ services:
4
+ battle-simulator:
5
+ build: .
6
+ ports:
7
+ - "8080:80"
8
+ volumes:
9
+ - ./index.html:/usr/share/nginx/html/index.html
10
+ - ./styles.css:/usr/share/nginx/html/styles.css
11
+ - ./script.js:/usr/share/nginx/html/script.js