1.0.15 • Published 2 months ago

@primodiumxyz/mud-game-tools v1.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Primodium Game Tools

Description

@primodiumxyz/mud-game-tools is a developer utility package designed to assist in building Ethereum applications with the MUD framework. This package streamlines the development process by offering a browser and specialized tabs: CheatcodesList and Editor, to interact with the onchain game state.

Features

  • Browser: A basic browser to navigate the onchain environment.
  • CheatcodesList: Write cheatcodes to manipulate the game state for testing.
  • Editor: A comprehensive editor to view and edit all parts of the game state.

Prerequisites

  • Node.js (>=14.0.0)
  • pnpm
  • MUD V2

Installation

Install with npm:

npm install @primodiumxyz/mud-game-tools

Usage

Browser

To integrate the development browser, add the following to your file:

import { Browser } from "mud-game-tools";
<Browser
  layers={{ react: { world, components: mud.components } }}
  world={world}
/>;

CheatcodesList

To add the Cheatcodes list to the browser, create a Cheatcodes object with the following interface:

export type Cheatcodes = Record<string, Cheatcode>;

// NOTE: the params field must match the names and types of function arguments
export type Cheatcode = {
  function: (...args: any[]) => any,
  params: { name: string, type: "number" | "string" | "boolean" }[],
};

To use it, add the cheatcodes as a parameter to the Browser:

import { Browser } from "mud-game-tools";
<Browser
  layers={{ react: { world, components: mud.components } }}
  world={world}
  cheatcodes={cheatcodes}
/>;

Access via the browser's Cheatcodes tab.

Editor

Access via the browser's Editor tab. This allows you to:

  • View game state
  • Modify components
  • Execute queries

Development

  1. Run the local development server:
    pnpm run dev

Contributions

Pull requests and issues are welcome.

To develop this package locally, clone the repository and install dependencies.

git clone https://github.com/primodiumxyz/mud-dev-tools.git
cd mud-dev-tools
pnpm install
pnpm build

License

MIT

1.0.15

2 months ago

1.0.14

2 months ago

1.0.13

2 months ago

1.0.12

2 months ago

1.0.9

3 months ago

1.0.11

3 months ago

1.0.10

3 months ago

1.0.8

5 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

2.0.0-next.5

8 months ago