Skip to content

latticexyz/skystrife-public

Repository files navigation

discord License: MIT

sky strife cloud background

Sky Strife is an onchain RTS game built on the MUD framework.

Mission

Sky Strife's purpose is to explore the limits of what is possible in an onchain game, with the eventual goal of becoming an Autonomous World.

Project Structure

Sky Strife is broken into several sub-packages. Here are the packages that are essential to run the game:

  • packages/client: Used to render and play the game in a browser.
  • packages/contracts: Contains all of the MUD contracts that make up a single Sky Strife world.
  • packages/art: Responsible for storing and exporting assets for Sky Strife. This also includes tooling for the Tiled map editor (map making tilesets, Tiled map files, and a plugin to export maps that are compatible with our template system).
  • packages/ecs-browser: Sidebar ECS browser for debugging component state and manually running queries. Used to be part of MUD but was moved back into Sky Strife as MUD development diverged from it.
  • packages/phaserx: A wrapper for Phaser 3 that was created at Lattice. Mainly used for strong types and easier setup. Vendored from the official MUD repo as we've made some changes to it.

Dev Setup

Prerequisites

  • node - Version 18.16.1 or greater
  • foundry - Used to run your local node, run tests, and deploy contracts. Install

Steps

  1. Install the latest forge using foundryup (see Foundry docs).

    If necessary, you can update to a new version of Rust.

    rustup update
  2. Clone the repository and install dependencies

    git clone https://github.com/latticexyz/skystrife-public.git
    cd skystrife-public
    pnpm install
  3. Start your local node, deploy contracts, and start the client.

    pnpm dev
  4. Browse to http://localhost:1337 to view the client.

    If you get an error saying The connected Sky Strife world is not valid., wait about a minute and reload. It takes some time for the contracts to build and deploy.

    You should automatically be connected as the admin of the world.

Test Matches

If you are okay with playing alone with no win condition, the standard dev setup will spawn test matches for you on a debugging map.

If you want to play against an opponent (yourself), these are the steps:

  1. Browse to http://localhost:1337 to view the client as an administrator.
  2. Press PLAY and then SKIP.
  3. Click + CREATE MATCH.
  4. Enter a match name, select a map (preferable for 2 players, easier to test), and then scroll down and click CREATE AND JOIN MATCH.
  5. Select a hero and click CREATE AND JOIN MATCH.
  6. Click PLAY.

To join as another player:

  1. Browse to http://localhost:1337/?asPlayer as a normal user.
  2. Click PLAY and then SKIP.
  3. Click OPEN in the row for your match, and then join normally.

You can join a match as the administrator, a regular user, and another regular user in an incognito window. If you need to be more, you can use different browser profiles or different browsers.

Using Local MUD

If you want to make live changes to MUD while developing you will have to link the local MUD package to the client and contracts packages.

  1. Clone the MUD repo locally.
  2. Run pnpm mud set-version --link <relative_path_to_mud_install> in your local MUD repo.

Live Deployment

Client

The client is deployed automatically when a commit is pushed to any branch. By default https://playtest.skystrife.xyz points to the latest playtest branch commit. The client is hosted on Cloudflare Pages. See the github action description for details.

Contracts

Contract deployment is currently manual.

To deploy to the Sky Strife testnet run pnpm deploy:garnet in packages/contracts. After deployment has finished, you'll need to make a commit with the worlds.json changes and open a PR to the develop branch. The live client uses this to determine which world to connect to.