A Minecraft clone built in THREE.js as a final project for a graphics course at the University of Waterloo.
minecraft.mp4
- Voxel-based rendering system
- Infinite world generation
- Breaking/placing blocks
- Tweened FOV changes when sprinting
- Day/night cycles
- Dynamic shadows based on sun position
- Block lighting sources
- Transparent blocks
- Sound effects
npm install
npm run dev
- Navigate to localhost:5173
WASD
keys to move the playerDouble tap W
to sprintSpace
to jumpLeft click
to break blocksRight click
to place blocksNumbers 1-9
to cycle through toolbarR
to reset positionEsc
to disable pointer-lock/go into orbit mode
-
Voxel Rendering System: Implement a voxel rendering system for a 3D matrix of blocks, each with unique properties like texture and translucency, and create a data structure and functions for rendering each voxel.
-
Texture Mapping: Develop a texture mapping system to apply image textures to block faces, with support for transparency in textures for blocks such as leaves, grass, and water.
-
Procedural Terrain Generation: Generate an infinite world using noise functions, rendering it in 16x16 chunks, with dynamic loading/unloading of chunks as the player moves, and adding fog for depth illusion. Ensure generated structures like trees render seamlessly between chunks.
-
Performance Optimizations: Implement at least three optimizations for smooth browser gameplay
-
Block Shading: Shade blocks based on their orientation relative to a simulated sunlight source.
-
Player Physics and Collision Detection: Develop a simple physics engine for realistic player movement, including walking, jumping, and gravity, along with efficient collision detection to prevent passing through objects.
-
Interactive Block Mechanics: Implement mechanics to allow players to break and place blocks, using raycasting for block detection, highlighting, and enabling block removal or placement.
-
Skydome: Create a skydome encompassing the play area, with a dynamic day-night cycle that affects the world's lighting conditions, featuring transitions between dawn, daylight, dusk, and night.
-
Procedural Generation of Environmental Structures: Algorithmically generate and place natural structures like trees and flowers, ensuring logical placement and natural patterns without unnatural overlaps.
-
Lighting: Enhance the lighting engine to support day/night cycle effects and additional placeable light blocks which will influence the visibility and shading of nearby objects.
This project is licensed under the MIT License.