1
1
# Minecraft Clone with Three.js
2
2
3
- A voxel-based Minecraft clone built using Three.js and TypeScript.
3
+ A voxel-based Minecraft clone built using Three.js and TypeScript. View demo [ here ] ( https://x.com/0xSamHogan/status/1895954338876703115 ) .
4
4
5
- ![ Minecraft Clone Screenshot] ( screenshot .png)
5
+ ![ Minecraft Clone Screenshot] ( /public/images/demo .png)
6
6
7
7
## Features
8
8
@@ -18,15 +18,15 @@ A voxel-based Minecraft clone built using Three.js and TypeScript.
18
18
19
19
## Prerequisites
20
20
21
- - Node.js (v14 or higher )
22
- - Bun or npm
21
+ - [ Bun ] ( https://bun.sh/ ) (recommended )
22
+ - Modern web browser with WebGL support
23
23
24
24
## Installation
25
25
26
26
1 . Clone the repository:
27
27
``` bash
28
- git clone < repository-url >
29
- cd minecraft-clone
28
+ git clone https://github.com/context-labs/minecraft-ai
29
+ cd minecraft-ai
30
30
```
31
31
32
32
2 . Install dependencies:
@@ -38,12 +38,11 @@ npm install
38
38
39
39
## Running the Game
40
40
41
- 1 . Start the development server:
41
+ 1 . Build and start the server:
42
42
``` bash
43
43
bun start
44
- # or
45
- npm start
46
44
```
45
+ This command will build the project and start the server.
47
46
48
47
2 . Open your browser and navigate to ` http://localhost:3000 `
49
48
@@ -53,16 +52,19 @@ For development with hot reloading:
53
52
54
53
``` bash
55
54
bun dev
56
- # or
57
- npm run dev
55
+ ```
56
+ This will start the development server with automatic reloading when files change.
57
+
58
+ To build the project without starting the server:
59
+
60
+ ``` bash
61
+ bun build
58
62
```
59
63
60
64
To generate the texture atlas:
61
65
62
66
``` bash
63
67
bun generate-textures
64
- # or
65
- npm run generate-textures
66
68
```
67
69
68
70
## Project Structure
@@ -74,8 +76,6 @@ minecraft-clone/
74
76
│ └── textures/ # Game textures
75
77
│ └── atlas.png # Texture atlas
76
78
├── src/
77
- │ ├── core/ # Core game engine
78
- │ │ └── Engine.ts # Main game engine
79
79
│ ├── player/ # Player-related code
80
80
│ │ └── Player.ts # Player controller
81
81
│ ├── ui/ # User interface
@@ -110,7 +110,6 @@ minecraft-clone/
110
110
111
111
The game is built using the following components:
112
112
113
- - ** Engine** : Main game engine that manages the scene, camera, and game loop
114
113
- ** World** : Manages chunks and terrain generation
115
114
- ** Chunk** : Represents a 16x16x16 section of blocks
116
115
- ** Block** : Defines different block types and their properties
@@ -120,11 +119,11 @@ The game is built using the following components:
120
119
121
120
## Technical Notes
122
121
123
- - The project uses Three.js as a dependency installed via npm
124
- - Custom PointerLockControls implementation for better compatibility
125
- - Fallback texture generation if atlas.png is not available
126
- - Debug logging added to help diagnose rendering issues
127
- - Enhanced lighting with ambient and directional lights
122
+ - The project uses Three.js for 3D rendering
123
+ - Custom PointerLockControls implementation for camera control
124
+ - Optimized chunk rendering with geometry instancing
125
+ - Collision detection for player movement
126
+ - Raycasting for block selection and interaction
128
127
129
128
## Performance Considerations
130
129
0 commit comments