Perovskite is a 3D voxel game engine inspired by Minetest.
It is written in Rust, with two goals:
At this time, it is not a playable game.
As this is a learning project, I may spend time on silly things that may not be useful to players or improved gameplay, if I think I can learn something from doing so. Likewise, I may use design patterns inconsistently (or make other inconsistencies) to increase the breadth of my learning. If there is enough interest or need, I can refactor and clean up code later.
Naming Rust projects after oxide minerals is fun. Unfortunately, all the cool oxide minerals are already used for really cool rust projects, or could otherwise cause confusion.
Perovskite is a cool mineral that inspired artificial structures with a bunch of cool aspirational applications.
It is possible to define blocks and dig them. Inventory support is mostly present. There's a furnace and a crafting mechanism. Game content (i.e. all the blocks you'd expect) is not yet present.
Entities are under active development, but are not yet stable. The entity system is currently focused on autonomous movement, and low-latency player control will be added in the future.
I intend to wrap the engine-specific behaviors in a lightweight API that makes it easier to define game logic. That API is still not stable, but I intend to make that API more stable than the low-level engine API.
At the moment, the network API is not yet stable - the client and server must be built from the same code. The intent is to stabilize the API to a reasonable extent later on, but having an unstable API allows for faster feature iteration.
The limitations:
The benefits:
First, build and run the server:
$ cargo build --features= --bin perovskite_game_api --release
$ target/release/perovskite_game_api --data-dir /path/to/data-directory
The default server port is 28273.
The following --features
can be used to do performance debugging of the server:
deadlock_detection
- Prints stacktraces when certain deadlocks occurtracy
- Exports trace spans and metrics to tracy.
dhat-heap
- Tracks heap allocations with dhat. Slow, and suspected to cause a rare deadlock.tokio-console
- Exports tokio stats to Tokio console. Requires $RUSTFLAGS
to contain --cfg tokio_unstable
.--release
is recommended.
At the moment, the render distance is hardcoded at the server, using constants in src/network_server/client_context.rs
.
Use Ctrl+C to exit, and Ctrl+C a second time to force quit. At the moment, there are some deadlocks that cause graceful shutdown to hang.
Then, build and run the client:
$ cargo build --features= --bin perovskite_client --release
$ target/release/perovskite_client
The only supported feature is --features=tracy
, with similar behavior to the same feature on the server.
To reach a client on the local machine, use grpc://localhost:28273
as the server address.
These can be adjusted in the settings file, whose filename is printed in the log when the client starts up.
It runs on Windows and Linux. Mac is an open question due to issues involving Vulkan libraries.
Aspirationally, I'd like the game to be somewhat playable in single-player with only one or two CPU cores and a very basic GPU.
I'm not quite there yet, and it's possible that I'll drift further away from this goal as I add features. I tend to test with a fairly powerful laptop and a high-end GPU. I aim for the following performance goals:
Tons of stuff, in no particular order, and not yet prioritized. Everything in this list is a maybe, depending on my available time and mood.
for_each_connected
and similar taking closures and running them efficiently)None at the moment. I test with either the latest or almost-latest stable Rust version, on Windows x64.
perovskite_server's API can change in breaking ways. perovskite_game_api (as well as anything it re-exports by default) should be reasonably stable once it's written. I intend to re-export some unstable APIs behind a feature flag.
cargo fmt
I work on low-level infrastructure at a major hyperscaler and produce this game in my free time. You can find me on discord as drey7925
.
Note that this project is not endorsed, sponsored, or supported by my employer or any affiliates.