frnsys / half_earth

Half-Earth Socialism: The Game, for Half-Earth Socialism (Verso 2022)
GNU Affero General Public License v3.0
37 stars 6 forks source link

Half-Earth Socialism

The project consists of two artifacts:

This video walks through an example of how to use the editor.

Overview

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.

Setup

git submodule init
git submodule update

Dependencies

# 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

Development

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:

  1. cd hes-game/public/js
  2. If you haven't already, run just setup.
  3. 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.

Running

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.

Building & Deploying


Releases

You can play it at:

Community

We have a Discord for the game and book here.