├── README.md └── index.html /README.md: -------------------------------------------------------------------------------- 1 | # Minecraft Clone Demo 2 | 3 | A simple Minecraft-inspired voxel game demo built using HTML, CSS, and Three.js. This project showcases procedural world generation, chunk loading, block interaction, a dynamic day/night cycle, and a handheld torch with particle effects, all running directly in the browser. 4 | 5 | ## ✨ Features 6 | 7 | * **Procedural World Generation:** Infinite terrain generated using Value Noise. 8 | * **Chunk System:** Loads and renders the world in manageable chunks based on render distance. 9 | * **First-Person Controls:** Standard WASD movement, mouse look (using PointerLockControls), jumping, and flying. 10 | * **Block Interaction:** 11 | * Left-click to break blocks. 12 | * Right-click to place selected blocks. 13 | * **Block Types:** Includes basic blocks like Grass, Dirt, Stone, Wood, and Leaves. 14 | * **Procedural Textures:** Block textures are generated on the fly using the Canvas API, reducing the need for external image assets. 15 | * **Dynamic Day/Night Cycle:** 16 | * Simulated sun and moon movement. 17 | * Changes in sky color, fog density/color, and directional light intensity/color based on the time of day. 18 | * CSS-based starfield visible at night. 19 | * **Handheld Torch:** 20 | * ViewModel torch rendered in the player's view. 21 | * Dynamic point light attached to the torch. 22 | * Flame particle system using Three.js Points. 23 | * Subtle flickering effects on light and flame. 24 | * **Basic Collision Detection:** Simple Axis-Aligned Bounding Box (AABB) collision with world blocks. 25 | * **On-Screen Info:** Displays player position, current chunk, fly/ground status, and in-game time. 26 | 27 | ## 🛠️ Technology Stack 28 | 29 | * **HTML5:** Structure of the web page. 30 | * **CSS3:** Styling for the UI elements (blocker, crosshair, info text, stars). 31 | * **JavaScript (ES Modules):** Core game logic, rendering, and interactions. 32 | * **Three.js:** A powerful 3D graphics library for rendering the voxel world, handling camera, lighting, and geometry. Loaded via `importmap` from UNPKG. 33 | 34 | ## 🚀 Getting Started 35 | 36 | This project is designed to be simple to run. 37 | 38 | **Method 1: Direct File Access (Easiest)** 39 | 40 | 1. Download the `index.html` file from this repository. 41 | 2. Open the `index.html` file directly in a modern web browser (like Chrome, Firefox, Edge, Safari). 42 | 43 | *Note: While this often works for simple projects using external CDNs like UNPKG, complex browser security features (especially around file access or future local assets) might sometimes cause issues. If you encounter problems, try Method 2.* 44 | 45 | **Method 2: Using a Local Web Server (Recommended)** 46 | 47 | 1. **Clone the repository:** 48 | ```bash 49 | git clone https://github.com/Atlas8t/MinecraftClone.git 50 | cd MinecraftClone 51 | ``` 52 | 53 | 2. **Start a simple local web server** in the project directory. Here are a few ways: 54 | * **Using Python 3:** 55 | ```bash 56 | python -m http.server 57 | ``` 58 | * **Using Node.js (requires `http-server` installed globally):** 59 | ```bash 60 | npm install -g http-server 61 | http-server 62 | ``` 63 | * **Using VS Code:** Install the "Live Server" extension and click "Go Live" from the status bar. 64 | 65 | 3. Open your web browser and navigate to the local address provided by the server (usually `http://localhost:8000`, `http://localhost:8080`, or similar). 66 | 67 | ## 🎮 Controls 68 | 69 | * **W, A, S, D:** Move Forward / Left / Backward / Right 70 | * **SPACE:** Jump (when on ground) / Fly Up (when in Fly Mode) 71 | * **SHIFT:** Fly Down (when in Fly Mode) / Crouch (TBD) 72 | * **MOUSE:** Look Around 73 | * **LEFT CLICK:** Break Block 74 | * **RIGHT CLICK:** Place Block (selected type shown in bottom-left) 75 | * **F:** Toggle Fly Mode 76 | * **1-5:** Select Block Type to Place (1: Stone, 2: Dirt, 3: Grass, 4: Wood, 5: Leaves) 77 | * **ESC:** Release mouse lock / Pause 78 | 79 | 80 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Voxel World - Torch w/ Particles 7 | 60 | 61 | 62 |
63 |
64 |
65 |

Voxel World - Torch w/ Particles

66 | Click to Play

67 | W, A, S, D = Move
68 | SPACE = Jump / Fly Up
69 | SHIFT = Fly Down / Crouch (TBD)
70 | MOUSE = Look
71 | LEFT CLICK = Break Block
72 | RIGHT CLICK = Place Block (See bottom-left)
73 | F = Toggle Fly Mode
74 | 1-5 = Select Block Type 75 |
76 |
77 |
78 |
Loading...
79 |
Placing: STONE
80 | 81 | 89 | 308 | 309 | 310 | --------------------------------------------------------------------------------