Skip to content

KairuiLiu/ThreeCraft

Repository files navigation

ThreeCraft

⛏ MineCraft Release Based on Three.js

Threejs Socket.io TypeScript Vite

✨ Feature

  • Multiplayer online game support
  • Efficient collision detection method
  • Multiple ways to save and load archive
  • Efficient multi-threaded dynamic infinite map generation and partial refresh method
  • 30 random character skins (in multiplayer mode)
  • 5 random game scenes (Classic / Ice / Beach Melon Field / Pumpkin Field / Bizarre)
  • Multi-terminal and multi-control mode support (PC, mobile, VR, PS4/5 joy stick, Xbox joy stick support)
  • Multiple parameters can be adjusted(FOV / Fog factor / Simulate range / Operation range / Volume / Number of threads / Operation sensitivity / Language / Operation mode / Crosshair color / Backpack mode / Cheat mode)
  • Dual language support (Chinese / English)
  • Original sound
  • PWA support

🎮️ Operation

  • PC

    • Space Bar:Jump
    • E Key: Switch Bag
    • Q Key: Cheat Mode
    • Mouse Move: Change Orientation
    • WSAD Key: Move
    • Number Key: Toggle Block
    • Wheel Scroll: Toggle Block
    • Click Item Box: Toggle Block
    • Shift Key: Drop in Cheat Mode
    • Mouse left/right click: Destroy/Create Blocks
    • ESC Key: Show Menu
  • Mobile

    • Drag Screen: Change Orientation
    • Click Item Box: Toggle Block
    • Click Active Item: Open Backpack
  • Xbox joy stick(test on Xbox One)

  • PS joy stick(test on PS4)

  • VR

    • Turn headset: Change Orientation
    • Using remote: Destroy Blocks

🛠️ Install

  • Frontend

    # Install pnpm
    > npm install -g pnpm
    
    # Install all dependencies
    > pnpm install
    
    # Install a dependency
    > pnpm install xxx  -D/-S
    
    # Run
    > pnpm dev
    
    # Build
    > pnpm build
  • Backend

    # Enter the backend directory
    > cd server
    
    # Install all dependance
    > pnpm install
    
    # Compile TS code
    > tsc
    
    # Execute backend programs (if process management tools such as PM2 are not required)
    > node ./dist/index.js
    
    # Install PM2
    > pnpm install -g pm2
    
    # Sign up for PM2 monitoring
    > pm2 start --watch ./dist/index.js
    
    # For reverse proxy, proxy /socket.io to localhost:9000 and configure same-origin policy

    After the program runs, the following prompt will be output

    ThreeCraft v1.0.2 game server running at:
    > Local:        http://localhost:9000
    > Network:      http://xxx.xxx.xxx.xxx:9000
    
    YOU MUST ENTER THE ADDRESS LIKE http://xxx.xxx.xxx.xxx:9000 IN GAME, NO PART CAN BE OMITTED!
    

    When connecting to the server, be sure to enter all http://xxx.xxx.xxx.xxx:9000, do not omit http:// or :9000

    If the frontend runs on https, then the backend should also runs on https. Some reverse proxy tools may be needed to implement https

🥰 Reference