-
Notifications
You must be signed in to change notification settings - Fork 184
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
1 changed file
with
49 additions
and
36 deletions.
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 |
---|---|---|
@@ -1,32 +1,56 @@ | ||
# World Explorer | ||
|
||
World Explorer is a GUI tool designed for visually exploring and manipulating the state of worlds. | ||
For the full information about it, [see the docs](http://mud.dev/world-explorer). | ||
|
||
## Getting started | ||
## Installation | ||
|
||
1. **Install the package** | ||
Starting with MUD 2.2, the MUD templates come with the World Explorer installed. | ||
|
||
```sh | ||
pnpm add @latticexyz/explorer | ||
``` | ||
These instructions are how to use World Explorer on earlier versions of MUD. | ||
|
||
2. **Start a local development chain** | ||
The easiest way to get World Explorer for earlier MUD versions is to create a project with the new template. | ||
|
||
Ensure you have a local development chain running. | ||
1. Create a project with the new template, which has World Explorer. Then, delete the files you no longer need. | ||
|
||
3. **Run the World Explorer** | ||
```sh copy | ||
pnpm create mud@main explorer --template vanilla | ||
cd explorer | ||
rm -rf packages/client packages/contracts/[st]* | ||
``` | ||
|
||
```sh | ||
npx @latticexyz/explorer --worldAddress <YOUR_WORLD_ADDRESS> | ||
2. Edit `mprocs.yaml` to remove the definitions for `client`, `contracts`, and `anvil`. | ||
|
||
```yaml filename="mprocs.yaml" copy | ||
procs: | ||
indexer: | ||
cwd: packages/contracts | ||
shell: rimraf $SQLITE_FILENAME && pnpm sqlite-indexer | ||
env: | ||
RPC_HTTP_URL: "http://127.0.0.1:8545" | ||
FOLLOW_BLOCK_TAG: "latest" | ||
SQLITE_FILENAME: "indexer.db" | ||
explorer: | ||
cwd: packages/contracts | ||
shell: pnpm explorer | ||
``` | ||
|
||
Alternatively, if you have a worlds configuration file: | ||
3. Replace `packages/contracts/worlds.json` with a link to the original project's `worlds.json`. | ||
```sh | ||
npx @latticexyz/explorer --worldsConfigPath <PATH_TO_WORLDS_CONFIG> | ||
```sh copy | ||
cp packages/contracts | ||
rm worlds.json | ||
ln -s <the original project>/packages/contracts/worlds.json . | ||
cd ../.. | ||
``` | ||
Note: You can use `@latticexyz/store-indexer` for indexing your world's data. | ||
4. Run the new project. | ||
```sh copy | ||
pnpm dev | ||
``` | ||
5. Browse to [World Explorer](http://localhost:13690). | ||
## CLI arguments | ||
|
@@ -35,48 +59,37 @@ The World Explorer accepts the following CLI arguments: | |
| Argument | Description | Default value | | ||
| ----------------- | -------------------------------------------------------------------------------- | ------------- | | ||
| `worldAddress` | The address of the world to explore | None | | ||
| `worldsFile` | Path to a worlds configuration file (used to resolve world address) | None | | ||
| `worldsFile` | Path to a worlds configuration file (used to resolve world address) | "worlds.json" | | ||
| `indexerDatabase` | Path to your SQLite indexer database | "indexer.db" | | ||
| `chainId` | The chain ID of the network | 31337 | | ||
| `port` | The port on which to run the World Explorer | 13690 | | ||
| `env` | The environment to run the World Explorer in (e.g., "development", "production") | "production" | | ||
## Example setup | ||
An example setup is provided in the `examples/local-explorer` directory, demonstrating a full setup for using the World Explorer in a local development environment: | ||
## Contributing | ||
1. **Setup** | ||
To contribute to World Explorer, first get familiar with the [MUD contribution guidelines](https://mud.dev/contribute). Then, the best way to edit the World Explorer is to run the example setup with World Explorer set to `development` mode: | ||
```sh | ||
cd examples/local-explorer && pnpm install | ||
``` | ||
2. **Run** | ||
1. **Clone MUD** | ||
```sh | ||
pnpm dev | ||
git clone [email protected]:latticexyz/mud.git | ||
cd mud | ||
``` | ||
This command starts all necessary processes, including a local chain, indexer, and the explorer. | ||
## Contributing | ||
To contribute to or modify the World Explorer, the easiest way is to run the example setup in `development` mode: | ||
1. **Setup** | ||
2. **Setup** | ||
Navigate to the `examples/local-explorer` directory and locate the `mprocs.yaml` file. | ||
2. **Configure** | ||
3. **Configure** | ||
In `mprocs.yaml`, ensure the `explorer` command is set up correctly. For example: | ||
In `mprocs.yaml`, ensure the `explorer` command is set to run the World Explorer in `development` mode. | ||
```yaml | ||
explorer: | ||
shell: pnpm explorer --worldsConfigPath packages/contracts/worlds.json --env development | ||
shell: pnpm explorer --env development | ||
``` | ||
3. **Run** | ||
4. **Run** | ||
```sh | ||
pnpm dev | ||
|