The project consists of two artifacts:
- The Half-Earth Socialism game (both web browser and standalone app versions).
- The Half-Earth Socialism editor (both web browser and standalone app).
This video walks through an example of how to use the editor.
hes-engine
defines the model that drives the game.hes-game
is the game itself, which is mostly a visual layer over the engine.hes-editor
is an editor to change parts of the game/engine, e.g. what projects are available, their parameters, etc, and is used to build custom.world
files that can be loaded into new games.
We also include a version of the Hector simple climate model that we've adapted to run in the browser. The process of building Hector for WASM is complicated so pre-compiled versions are included here.
git submodule init
git submodule update
# Leptos is the main framework used for both the game and the editor.
cargo install trunk
cargo install cargo-leptos
# WASM target is required for frontend code.
rustup target add wasm32-unknown-unknown
There is some functionality which is better kept in JS rather than ported to Rust/WASM. In particular, the rendering of the globe (which depends on three.js), handling of audio, and interfacing with the Hector WASM module. We'd use our Rust adapter for Hector directly but Rust/WASM doesn't work with C++ FFI, so we have to stick with using JS as a bridge.
The globe and Hector JS modules need to re-built if any of their files are edited. They can be rebuilt by doing:
cd hes-game/public/js
- If you haven't already, run
just setup
. - Then run
just build
.
If debugging the game there are a few options you can pass as URL parameters which can help. These are used a comma-separated following debug=
, e.g. http://localhost:3000/?debug=all-projects,all-processes
.
check-events
: Show a list of all events and updates and click on them to trigger them.all-projects
: All projects are unlocked at the start.all-processes
: All processes are unlocked at the start.skip-to-planning
: Skip the intro and just go to the planning phase.skip-tutorial
: Skip the tutorial.skip-events
: Skip all events.fast-years
: Speed up years in the world events phase.always-skip-world
: Skip the world events phase.i-am-the-state
: Start with 1000 political capital.
You can use just
to run most tasks:
Available recipes:
game # Run development game (browser)
editor # Run development editor (browser)
build # Build the web release versions (browser)
test # Run tests
translate # Extract translation strings and update the translation mappings from the source CSVs.
surfaces # Generate biome surface textures and regional climates.
sharing # Generate sharing images.
- Cross-platform builds are handled by Github Actions (using a
workflow_dispatch
, i.e. manual trigger). - The web versions of the game and editor are built using
just build
and are hosted as static sites.
You can play it at:
- half.earth (web; and the editor)
- Steam (Windows/macOS/Linux) (Account needed)
- Note: The build process for the Steam version is more complicated so it's less likely to be up-to-date.
- Itch.io (Windows/macOS/Linux)
We have a Discord for the game and book here.