Skip to content

Minecraft clone in Three.js using instancing and Perlin noise (terrain generation)

Notifications You must be signed in to change notification settings

valentecaio/aiocraft

Repository files navigation

AioCraft

Try it at valentecaio.itch.io/aiocraft.

screenshot1.png

AioCraft is a first-person game built with the Three.js library. It uses GPU instancing to render a scene composed of voxels (cubes) which are randomly generated from a Perlin noise function. The collision and gravity are handled using the native ray tracing Three.js module.

For more information, see this presentation (in Portuguese) ot this demonstration video.


Controls

Keys Function
WASD Walk
Space Jump
Mouse Camera control
R FPS show on/off
F Gravity on/off
Up/Down Teleport vertically
Left/Right Increase/decrease movement speed

How to execute

To run this project locally, follow the steps below.

  1. Install Node.js from nodejs.org.
  2. Install the dependencies: $ npm install
  3. Run the node server: $ npm run dev
  4. Access the application at localhost:5173 in a browser.

How to build

To build the project, follow the steps below.

  1. Install Node.js from nodejs.org.
  2. Install the dependencies: $ npm install
  3. Run the build script: $ npm run build
  4. The build will be available in the dist/ folder.
  5. Zip the contents of the dist/ folder and upload it to a server.

Different types of terrain

The terrain generation method can be easily adapted to generate different types of terrain, such as the examples below:

screenshot2.png

screenshot3.png