The end goal is to build challenge like tutorials for learning different aspects of the Bevy game engine. An example of one could be learning how to use run conditions. Currently the focus is on building a user friendly and featureful playground that will then be used for the challenges.
Here is a list of current and planned features
- Code editor with syntax highlighting (highlight is stolen from the rust playground)
- Visual window
- Console that displays logs and build stderr
- Selectable Bevy version and rust channel (nightly and stable)
- Formatting code
- Sharing code
- Bevy example selector
- Assets for testing with
- Popular crates
- Entity hierarchy
- Entity inspector
- Rust analyzer running in the browser (it's possible)
This is backend of the project.
Each request spins up a new docker container depending on the Bevy version and Rust channel selected, see images for for infomation on them.
The http server in use is axum, I chose this due to its great ecosystem and simplicity.
The server is hosted on a 4GB Premium KVM VPS from Snakecraft Hosting who very generously sponsored this project.
All the program needs to run is docker and the images for the versions and channels you want to use/test.
You can pull them like this.
docker pull ghcr.io/liamgallagher737/learnbevy-<version>-<channel>
docker pull ghcr.io/liamgallagher737/learnbevy-0.14-nightly # 0.14 on nightly
docker pull ghcr.io/liamgallagher737/learnbevy-main-stable # bevy main branch on stable
If you want to build them yourselve see the images section.
This is the NixOS system config for the server(s) running the compile_api program.
You can install NixOS with the config on any achine you have root ssh access to using the following command.
nix run github:nix-community/nixos-anywhere -- --flake .#<server-type> root@<ip address>
The server-type
is any of the outs from flake.nix. This is because parts of the config will depend on the server they are running on.
Once installed, any updates to the config can be activated by running the following command on the server via ssh.
nixos-rebuild switch --flake <URI to your flake>
Or if your cool and use NixOS you can rebuild it without needing to ssh into it with this command.
nixos-rebuild switch --flake .#<server-type> --target-host "root@<ip address>"
This is where the Dockfile is for the images used durning compiling. A single dockerfile is used taking both a Bevy version and Rust channel as arguments. The Cargo.toml files for each version are in the manifests
directory, each version gets it's own file as the features change between versions.
An image can be build like this, replace 0.14
and stable
with options of your choice.
docker build --build-arg="version=0.14" --build-arg="channel=stable" --tag "ghcr.io/liamgallagher737/learnbevy-0.14-stable" .
This is the website https://learnbevy.com.
It is a SvelteKit 4 app that uses tailwind for styling and shancn-svelte for the ui components.
The website is hosted on Cloudflare Pages for free. The shares are stored in a Cloudlflare KV database which is also free.
The program can be built with the following command
Most of the time a simple npm run dev
will suffice however if you want to use the sharing functionality you will have to build the app and run it with wrangler, this is due to needing a database. The following command will do both.
npm run build && npx wrangler pages dev .svelte-kit/cloudflare
If you want the website to use a locally running compile server you can specify a url in your .env file.
PUBLIC_COMPILE_HOST=http://localhost:53740
If your running the compile server with ssl then most likely your browser will block the request when you try to compile due to an untrusted self-signed certificate. To trust it on Firefox you can go to https://localhost:53740/compile and click on the Advanced then Accept the Risk. Other browser should be very simular.
All code in this repository is dual-licensed under either of the following license at your option.
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
The assets included in this repository are copied from the Bevy repository and typically fall under different open licenses. See CREDITS.md for the details of the licenses of those files.