Skip to content

Commit

Permalink
Moar plugin docs and slicker local dev setup πŸ€–
Browse files Browse the repository at this point in the history
  • Loading branch information
Kooshaba committed Mar 8, 2024
1 parent 345db10 commit d73cdfc
Show file tree
Hide file tree
Showing 946 changed files with 4,263 additions and 3,875 deletions.
80 changes: 68 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,82 @@ Sky Strife's purpose is to explore the limits of what is possible in an onchain

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

1. `packages/client`: Used to render and play the game in a browser.
2. `packages/contracts`: Contains all of the MUD contracts that make up a single Sky Strife world.
3. `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).
4. `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.
5. `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.
- `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.

# Initial Dev Setup
# Dev Setup

## Prerequisites

`node` - Version 18.16.1 or greater
`foundry` - Used to run your local node, run tests, and deploy contracts. [Install](https://github.com/foundry-rs/foundry#installation)
- `node` - Version 18.16.1 or greater
- `foundry` - Used to run your local node, run tests, and deploy contracts. [Install](https://github.com/foundry-rs/foundry#installation)

> There is currently an issue with the latest version of Foundry which causes Sky Strife deployment to fail. Please revert back to an old version using this command `foundryup -C 375df5834d0fea8350a4aae9ca34a0dab55d74ac`
> There is currently an issue with the latest version of Foundry which causes Sky Strife deployment to fail. Please revert back to an old version using this command `foundryup -C 375df5834d0fea8350a4aae9ca34a0dab55d74ac`
## Steps

1. Install latest forge using `foundryup` (see [foundry docs](https://book.getfoundry.sh/getting-started/installation))
2. Run `pnpm` in the base directory to install all dependencies and compile contracts.
3. Run `pnpm dev` to start your local node, deploy contracts, and start the client. You can view the client at `http://localhost:1337/` if you have not changed the default config.
1. Install the latest forge using `foundryup` (see [Foundry docs](https://book.getfoundry.sh/getting-started/installation)) and then revert to an older version that is known to work.

Note that this is a slow process because it is necessary to compile Foundry from the source code.

```sh copy
foundryup -C 375df5834d0fea8350a4aae9ca34a0dab55d74ac
```

If necessary, you can update to a new version of [Rust](https://doc.rust-lang.org/book/ch01-01-installation.html).

```sh copy
rustup update
```

2. Clone the repository, install the dependencies, and compile the contract.

```sh copy
git clone https://github.com/latticexyz/skystrife-public.git
cd skystrife
pnpm install
cd packages/contracts
pnpm build
cd ../..
```

3. Start your local node, deploy contracts, and start the client.

```sh copy
pnpm dev
```

4. Browse to [`http://localhost:1337`](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`](http://localhost:1337) to view the client as an administrator.
1. Press **PLAY** and then **SKIP**.
1. Click **+ CREATE MATCH**.
1. Enter a match name, select a map (preferable for 2 players, easier to test), and then scroll down and click **CREATE AND JOIN MATCH**.
1. Select a hero and click **CREATE AND JOIN MATCH**.
1. Click **PLAY**.

To join as another player:

1. Browse to [`http://localhost:1337/?asPlayer`](http://localhost:1337/?asPlayer) as a normal user.
1. Click **PLAY** and then **SKIP**.
1. 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](https://support.google.com/chrome/answer/2364824?hl=en&co=GENIE.Platform%3DDesktop) or different browsers.

# Using Local MUD

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
"mud:up": "pnpm recursive exec mud set-version -v canary && pnpm install",
"mud:link": "pnpm recursive exec mud set-version -l ../../../mud && pnpm install",
"---": "---",
"dev": "pnpm --filter ecs-browser run build && pnpm --filter phaserx run build && run-pty % % pnpm run dev:client % pnpm run dev:contracts % pnpm run dev:upload-map % pnpm run dev:copy-maps % pnpm run dev:create-debug-matches % pnpm run dev:plugins",
"dev": "pnpm --filter ecs-browser run build && pnpm --filter phaserx run build && run-pty % pnpm run dev:client % pnpm run dev:node % pnpm run dev:contracts % pnpm run dev:upload-map % pnpm run dev:copy-maps % pnpm run dev:create-debug-matches % pnpm run dev:plugins",
"dev:client": "pnpm --filter client run dev",
"dev:contracts": "DEBUG=mud:* pnpm --filter contracts run dev",
"dev:node": "DEBUG=mud:* pnpm --filter contracts run devnode",
"dev:upload-map": "wait-port localhost:8545 && sleep 70 && pnpm --filter headless-client run upload-map:dev",
"dev:copy-maps": "wait-port localhost:8545 && sleep 80 && pnpm --filter headless-client run copy-maps:dev",
"dev:create-debug-matches": "wait-port localhost:8545 && pnpm --filter headless-client run create-debug-matches:dev",
Expand Down
Binary file modified packages/art/sprites/combat/sword-confirm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/art/sprites/combat/sword-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/art/sprites/combat/sword-up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/art/sprites/combat/sword.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/art/sprites/tile_ui/blue/outline/0.png
Loading

0 comments on commit d73cdfc

Please sign in to comment.