Rustcraft is a simple Minecraft engine written in rust using wgpu.

Overview

Github Link MSRV license


Rustcraft

A simple Minecraft engine in Rust

Logo

About The Project

Welcome to RUSTCRAFT! Rustcraft is a simple Minecraft engine written in rust using wgpu.

But Why?

I wanted to work on a project to learn more about wgpu as well as practice my Rust skills. I then randomly saw this youtube video and got inspired to try to make a simple Minecraft engine in Rust!

Inspiration

As I explained I was inspired by this video and the corresponding codebase. This is why you will probably see a lot of design similarities between my project and this one. Jdah, your video was awesome. (I also copied his blocks atlas because I liked it a lot).

Current State

I am pretty happy with the current state of the engine. There are a few problems with it but they are outside of my MVP scope. I am aware that the game is not as efficient and smooth as it should be. I initially set as a goal to not use any threading or unsafe rust. Turns out it is hard to generate the world efficiently without any of that so I did end up eventually using rayon (but I should really be using Tokio). This would require some not trivial redesign and maybe I will update this in the future 🤷 .

The noise library I am using is also a bit slow. There are some issues with integrating it nicely into a bigger project but I don't really want to write my own noise library right now so this works.

Potential Updates

  • Transparent water
  • Lighting (real sun or "hacked" lighting)
  • Block memory map (saves location of broken/placed blocks)
  • Game physics
  • additional sprites: (tree, flowers)
  • Block selection during placement
  • Biomes
  • "Real" concurency for chunk generation (Tokio).

Prerequisites

Running

cargo run --release

Arguments

Running in wireframe mode:

cargo run --release -- -w

Running with coordinate system at [0,0,0] (for debugging):

cargo run --release -- -c

Running a flat world:

cargo run --release -- -f

Running on Windows

On windows-msvc, make sure that you have a version of ninja.exe (download here) available in your PATH varaible.

Controls

  • awsd to move around
  • space move upwards
  • shift move down
  • left click break block
  • right click place block

Authors

License

This project is licensed under the MIT - see the LICENSE file for details.

You might also like...
🦅🦁 Fast, simple 2D text renderer for wgpu

🦅 glyphon 🦁 Fast, simple 2D text rendering for wgpu What is this? This crate provides a simple way to render 2D text with wgpu by: rasterizing glyph

A curated list of wgpu code and resources.

Awesome wgpu A curated list of wgpu code and resources. PRs welcome. About wgpu https://github.com/gfx-rs/wgpu-rs matrix chat https://matrix.to/#/#wgp

Scion is a tiny 2D game library built on top of wgpu, winit and legion.
Scion is a tiny 2D game library built on top of wgpu, winit and legion.

Scion is a 2D game library made in rust. Please note that this project is in its first milestones and is subject to change according to convience need

Tic-Tac-Toe on the GPU, as an example application for wgpu
Tic-Tac-Toe on the GPU, as an example application for wgpu

Tic-Tac-GPU A simple (cough cough) example on a tic-tac-toe game with wgpu. Why? Because I didn't find that many small applications which use wgpu as

A barebones example of how to integrate OpenXR with wgpu (Vulkan-only)

wgpu-openxr-example a barebones example of how to integrate OpenXR with wgpu (Vulkan-only) It has four modes: cargo run --no-default-features: desktop

Simple island generator written in rust using bevy engine
Simple island generator written in rust using bevy engine

Getting Started Easy enough to run cargo run --release Change generation speed Find the system set that looks like this .add_system_set(

Minecraft using Bevy and Bevy-Meshem

minecraft_bevy Minecraft_bevy was built to showcase bevy_meshem. After a week of developing it has: Chunk loading / unloading each chunk's mesh is bei

A simple, very minimal Minecraft server implementation in Rust.
A simple, very minimal Minecraft server implementation in Rust.

A simple, very minimal Minecraft server implementation in Rust. For a simple Minecraft server that isn't supposed to do much (for example, a limbo ser

ULE - Minecraft's server core written in Rust

ULE - Minecraft's server core written in Rust This's server core fully written in Rust-Lang and using more custom code for best perfomance and control

Comments
  • Running build on release mode panics

    Running build on release mode panics

    Hi So, First I git cloned the project,checked the dependencies and ran it with the command cargo run --release -- -c . Here is the output,

    sol@solmate:~/Documents/projects/rustcraft$ cargo run --release -- -c
        Finished release [optimized] target(s) in 6.51s
         Running `target/release/rustcraft -c`
    May 07 10:15:34.941 INFO Generating World...
    wgpu error: Validation Error
    
    Caused by:
        In Device::create_buffer
          note: label = `Vertex Buffer`
        not enough memory left
    
    
    thread 'main' panicked at 'Handling wgpu errors as fatal by default', /home/sol/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.7.1/src/backend/direct.rs:1896:5
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    Segmentation fault (core dumped)
    

    Which traces back to ,

    fn default_error_handler(err: crate::Error) {
        eprintln!("wgpu error: {}\n", err);
    
        panic!("Handling wgpu errors as fatal by default");
    }
    

    and goes back to ,

    pub enum Error {
        /// Out of memory error
        OutOfMemoryError {
            ///
            source: Box<dyn error::Error + Send + Sync + 'static>,
        }, 
        ...
    

    I am a Rust beginner ,and there is one thing I am not able to understand here is that if this program is panicking and is going through the usual process of unwinding then why is it seg faulting here ?

    opened by Lauel09 5
  • Error building on macOS Catalina

    Error building on macOS Catalina

    I'm trying to build on macOS Catalina, but getting the following error:

    XType: failed to connect - Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service on pid 0 named com.apple.fonts was invalidated." UserInfo={NSDebugDescription=The connection to service on pid 0 named com.apple.fonts was invalidated.} rustcraft[70247:3351893] Font server protocol version mismatch (expected:5 got:0), falling back to local fonts

    opened by esimov 1
  • Add Windows run instructions to README.md

    Add Windows run instructions to README.md

    As mentioned here: https://crates.io/crates/shaderc-sys shaderc-sys needs ninja.exe to build from source on windows-msvc This pull request adds that information in the README.md

    opened by PhilipK 0
  • Update to Wgpu 0.8

    Update to Wgpu 0.8

    I was just about to start writing a block engine on Wgpu, then I found rustcraft. Looks like a great start!

    Is this going to be an actively developed project?

    If so, the first thing I'd like to contribute to is updating to Wgpu 0.8 and moving the shaders to WGSL. I don't have a lot of time or expertise, so I have no idea if this will take me 5 minutes or 5 months. Interested?

    opened by Slyklaw 3
Owner
Raphael Van Hoffelen
Raphael Van Hoffelen
Self Study on developing a game engine using wgpu as the rendering API. Learning as I go.

Fabled Engine Any issues, enhancement, features, or bugs report are always welcome in Issues. The obj branch is where frequent development and up to d

Khalid 20 Jan 5, 2023
3d Cellular Automata using WGPU in Rust (for the web and using compute shaders)

3D-Cellular-Automata-WGPU 3d Cellular Automata using WGPU in Rust (for the web and using compute shaders) The branches are very messy... I recommend y

null 18 Dec 18, 2022
Simple profiler scopes for wgpu using timer queries

wgpu-profiler Simple profiler scopes for wgpu using timer queries Features Easy to use profiler scopes Allows nesting! Can be disabled by runtime flag

null 41 Dec 5, 2022
Minecraft-esque voxel engine prototype made with the bevy game engine. Pending bevy 0.6 release to undergo a full rewrite.

vx_bevy A voxel engine prototype made using the Bevy game engine. Goals and features Very basic worldgen Animated chunk loading (ala cube world) Optim

Lucas Arriesse 125 Dec 31, 2022
A simple Minecraft written in Rust with the Piston game engine

hematite A simple Minecraft written in Rust with the Piston game engine How To Open a World This method is only for personal use. Never distribute cop

PistonDevelopers 1.7k Dec 22, 2022
A modern 3D/2D game engine that uses wgpu.

Harmony A modern 3D/2D game engine that uses wgpu and is designed to work out of the box with minimal effort. It uses legion for handling game/renderi

John 152 Dec 24, 2022
Brine is my attempt at writing a Minecraft client in Rust using the Bevy game engine.

Brine Brine is my attempt at writing a Minecraft client in Rust using the Bevy game engine. It's EXTREMELY work-in-progress. The thing that makes Brin

Ben Reeves 34 Dec 26, 2022
🌎 Demo for Minecraft-like procedural generation using the Bevy game engine

infinigen This is a demo for Minecraft-like procedural generation using the Bevy game engine. chunks along all axes (X, Y and Z) adjustable zoom level

James Hiew 16 Jun 11, 2023
Guide for using gfx-rs's wgpu library.

Introduction What is wgpu? Wgpu is a Rust implementation of the WebGPU API spec. WebGPU is a specification published by the GPU for the Web Community

sotrh 1k Dec 29, 2022
🍖A WGPU graphics pipeline, along with simple types used to marshal data to the GPU

renderling ?? This library is a collection of WGPU render pipelines. Shaders are written in GLSL. shaderc is used to compile shaders to SPIR-V. Defini

Schell Carl Scivally 5 Dec 20, 2022