-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3,384 changed files
with
126,548 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": ["@commitlint/config-conventional"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": ["@typescript-eslint"], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# suppress diffs for generated files | ||
**/pnpm-lock.yaml linguist-generated=true | ||
**/codegen/**/*.sol linguist-generated=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
######################################################################################## | ||
# "pnpm install" composite action for pnpm 7/8+ # | ||
#--------------------------------------------------------------------------------------# | ||
# Requirement: @setup/node should be run before # | ||
# # | ||
# Usage in workflows steps: # | ||
# # | ||
# - name: 📥 Monorepo install # | ||
# uses: ./.github/actions/pnm-install # | ||
# with: # | ||
# enable-corepack: false # (default) # | ||
# # | ||
# Reference: # | ||
# - latest: https://gist.github.com/belgattitude/838b2eba30c324f1f0033a797bab2e31 # | ||
######################################################################################## | ||
|
||
name: 'Monorepo install (pnpm)' | ||
description: 'Run pnpm install with cache enabled' | ||
inputs: | ||
enable-corepack: | ||
description: 'Enable corepack' | ||
required: false | ||
default: 'false' | ||
|
||
runs: | ||
using: 'composite' | ||
|
||
steps: | ||
- name: ⚙️ Enable Corepack | ||
if: ${{ inputs.enable-corepack }} == 'true' | ||
shell: bash | ||
working-directory: ${{ inputs.cwd }} | ||
run: corepack enable | ||
|
||
- uses: pnpm/action-setup@v2.2.4 | ||
if: ${{ inputs.enable-corepack }} == 'false' | ||
with: | ||
version: 8.6.0 | ||
|
||
- name: Expose pnpm config(s) through "$GITHUB_OUTPUT" | ||
id: pnpm-config | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | ||
- name: Cache rotation keys | ||
id: cache-rotation | ||
shell: bash | ||
run: | | ||
echo "YEAR_MONTH=$(/bin/date -u "+%Y%m")" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ steps.pnpm-config.outputs.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_MONTH }}- | ||
# Prevent store to grow over time (not needed with yarn) | ||
# Note: not perfect as it prune too much in monorepos so the idea | ||
# is to use cache-rotation as above. In the future this might work better. | ||
#- name: Prune pnpm store | ||
# shell: bash | ||
# run: pnpm prune store | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: pnpm install --frozen-lockfile --prefer-offline | ||
env: | ||
# Other environment variables | ||
HUSKY: '0' # By default do not run HUSKY install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# .github/workflows/build-client.yml | ||
name: Build client and push to a new dist-client-<branch_name> branch | ||
|
||
on: | ||
push: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Build and Push Client | ||
steps: | ||
- name: git-checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
|
||
- name: 📥 Monorepo install | ||
uses: ./.github/actions/pnpm-install | ||
|
||
- name: Install Foundry | ||
uses: foundry-rs/foundry-toolchain@v1 | ||
with: | ||
version: nightly | ||
|
||
- name: Build ecs-browser | ||
run: pnpm --filter ecs-browser run build | ||
|
||
- name: Build phaserx | ||
run: pnpm --filter phaserx run build | ||
|
||
- name: Build contracts | ||
run: pnpm --filter contracts run build | ||
|
||
- name: Build client | ||
run: pnpm --filter client run build | ||
|
||
- name: Extract branch name | ||
shell: bash | ||
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | ||
id: extract_branch | ||
|
||
- name: Push | ||
uses: s0/git-publish-subdir-action@develop | ||
env: | ||
REPO: self | ||
BRANCH: dist-client-${{ steps.extract_branch.outputs.branch }} # The branch name where you want to push the assets | ||
FOLDER: packages/client/dist # The directory where your assets are generated | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub will automatically add this - you don't need to bother getting a token | ||
MESSAGE: "client: ({sha}) {msg}" # The commit message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: 'Issue States' | ||
|
||
on: | ||
project_card: | ||
types: [created, edited, moved] | ||
|
||
permissions: | ||
repository-projects: read | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
action: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dessant/issue-states@v3 | ||
with: | ||
github-token: ${{ github.token }} | ||
open-issue-columns: '' | ||
closed-issue-columns: 'done' | ||
log-output: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
node_modules | ||
.eslintcache | ||
.DS_STORE | ||
.yalc | ||
.parcel-cache | ||
.mudbackup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
## PNPM related ############### | ||
## https://pnpm.io/npmrc # | ||
############################### | ||
|
||
# Not always possible to be strict, but if it works for you, keep it to true. | ||
# https://pnpm.io/next/npmrc#strict-peer-dependencies | ||
strict-peer-dependencies=false | ||
|
||
# Auto install peers should be false to avoid downloading | ||
# extraneous deps. If the install fails, try first to explicitly add | ||
# the missing deps in your package. Set it to true at last resort | ||
# (when the problem comes from upstream dependencies). The best is false. | ||
# https://pnpm.io/npmrc#auto-install-peers | ||
auto-install-peers=false | ||
|
||
# Helps locating duplicates, default in v8 | ||
# https://pnpm.io/next/npmrc#use-lockfile-v6 | ||
use-lockfile-v6=true | ||
|
||
# Will fix duplicates due to peer-dependencies (>=7.29.0), default in v8 | ||
# https://github.com/pnpm/pnpm/releases/tag/v7.29.0 | ||
dedupe-peer-dependents=true | ||
|
||
# Helps with peer-deps (>=7.23.0), default in v8 | ||
# https://pnpm.io/npmrc#resolve-peers-from-workspace-root | ||
resolve-peers-from-workspace-root=true | ||
|
||
# default to 'lowest' in v8.5.0 | ||
# set to highest for reasons specified here: https://github.com/pnpm/pnpm/issues/6463 | ||
# https://pnpm.io/npmrc#resolution-mode | ||
resolution-mode=highest | ||
|
||
# Default in 8.1.0 to fix issues with root/workspaces hoisting | ||
# https://pnpm.io/npmrc#dedupe-direct-deps | ||
dedupe-direct-deps=false | ||
|
||
# Pinlock to exact version (default is '^') | ||
# https://pnpm.io/npmrc#save-prefix | ||
# see also how save-workspace-protocol affect this https://pnpm.io/npmrc#save-workspace-protocol | ||
save-prefix='' | ||
|
||
# Most of the time, you want to use the rolling protocol for monorepos | ||
# https://pnpm.io/npmrc#save-workspace-protocol | ||
save-workspace-protocol=rolling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
18 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
dist | ||
packages/art | ||
packages/contracts/types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** @type {import('prettier').Config} */ | ||
module.exports = { | ||
// We need to explicitly define the plugin here for husky's lint-staged hook to work properly | ||
plugins: ["prettier-plugin-solidity"], | ||
printWidth: 120, | ||
semi: true, | ||
tabWidth: 2, | ||
useTabs: false, | ||
bracketSpacing: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"solidity.remappings": [ | ||
"memmove/=node_modules/memmove/src/", | ||
"ds-test/=node_modules/ds-test/src/", | ||
"@openzeppelin/=node_modules/openzeppelin-solidity/", | ||
"forge-std/=node_modules/forge-std/src/", | ||
"solmate/=node_modules/solmate/src", | ||
"persona/=node_modules/@latticexyz/persona/src/", | ||
"gsn/=node_modules/@opengsn/contracts/src/", | ||
"ds-test/=node_modules/ds-test/src/", | ||
"libraries/=packages/contracts/src/libraries", | ||
"systems/=packages/contracts/src/systems", | ||
"@dk1a/solidity-stringutils/=node_modules/@dk1a/solidity-stringutils/", | ||
], | ||
"Lua.diagnostics.globals": [ | ||
"getFilenameFromPath" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Lattice | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<a href="https://twitter.com/skystrifeHQ"> | ||
<img src="https://img.shields.io/twitter/follow/skystrifeHQ?style=social"/> | ||
</a> | ||
<a href="https://twitter.com/latticexyz"> | ||
<img src="https://img.shields.io/twitter/follow/latticexyz?style=social"/> | ||
</a> | ||
|
||
[![discord](https://img.shields.io/badge/join-latticexyz-black?logo=discord&logoColor=white)](https://discord.gg/latticexyz) | ||
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) | ||
|
||
![sky strife cloud background](packages/client/src/public/assets/background.png) | ||
|
||
> **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](https://0xparc.org/blog/autonomous-worlds). | ||
|
||
# Project Structure | ||
|
||
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. | ||
|
||
# Initial Dev Setup | ||
|
||
## Prerequisites | ||
|
||
`foundry` - Used to run your local node, run tests, and deploy contracts. [Install](https://github.com/foundry-rs/foundry#installation) | ||
|
||
## 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. | ||
|
||
# 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](.github/workflows/build-client.yml) for details. | ||
|
||
## Contracts | ||
|
||
Contract deployment is currently manual. | ||
|
||
To deploy to the Sky Strife testnet run `pnpm deploy:redstone-holesky` 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. |
Oops, something went wrong.