Skip to content

Latest commit

 

History

History
95 lines (82 loc) · 2.63 KB

README.md

File metadata and controls

95 lines (82 loc) · 2.63 KB

Hive

Hivegame is a free online hive game server focused mostly on realtime gameplay and ease of use.

It is written in rust nightly and relies on the Leptos framework. Pure hive logic is inside the engine workspace.

Development

Prerequisites

1. Setup the Rust Toolchain

  • Install the Rust toolchain.
  • Set the default toolchain to nightly from the project root:
rustup override set nightly
  • Alternatively set the default toolchain to nightly globally:
rustup default nightly
  • Add the WebAssembly target:
rustup target add wasm32-unknown-unknown

2. Install Leptos

cargo install cargo-leptos

3. Install and Setup PostgreSQL

  • Follow the installation instructions for your OS (example for Arch Linux).
  • With PostgreSQL running, create a database hive-local and a user hive-dev as the owner:
sudo -u postgres createuser hive-dev && sudo -u postgres createdb -O hive-dev hive-local

Manual Setup (Without Nix)

  1. Install Diesel CLI with PostgreSQL support
cargo install diesel_cli --no-default-features --features postgres
  1. Install Leptos Formatter
cargo install leptosfmt
  1. Run Database Migrations
  • From the project root, navigate to db and run migrations:
cd db && diesel migration run && cd ..
  1. Run the Project
  • The watch command will recompile your code when files change and serve it on localhost::3000, static changes inside the view! macro won't cause a recompile if running with the --hot-reload flag
cargo leptos watch --hot-reload
  1. Before Making a Pull Request please clippy and format your code
cargo clippy --fix --all-features && leptosfmt apis -q && cargo fmt

Alternative to the manual setup use Nix

  1. Install Nix or just run:
curl -L https://nixos.org/nix/install | sh -s -- --daemon
  • Add these experimental features to your nix config (/etc/nix/nix.conf)
experimental-features = nix-command flakes
  1. Start the development shell
nix develop -c $SHELL
  1. now start the server
migration run
server
  1. (Optional) Setup direnv
  2. Before committing code please run
format

License

This source code with the exception of the graphics is licensed under the GNU Affero General Public License 3 license found in the LICENSE.md file in the root directory of this project. The official graphics for Hive are owned by Gen42 and may not be used without prior written consent.