The Lattice team has been working on four templates.
Each of them can be used as a starting point for your project depending on which technology you want to use with MUD
All templates are in the v2sandbox repo: https://github.com/latticexyz/v2sandbox
To start from a template:
Select the right branch (eg: react
, phaser
, main
(minimal), three-react
) or go directly to the right branch by clicking the link in the corresponding section below.
Click the “Deploy” button, it will send you to Vercel and guide you through forking the repo and deploying it.
Important: select “4242” as your VITE_CHAIN_ID
when Vercel prompts you.
Note: Vercel is not mandatory in order to use MUD, but it will make it easier because we configured it for the hackathon.
The MUD deployer requires a private key to deploy to the local development chain or the testnet. For now (while you don’t deploy to the testnet) you can use the default private key for anvil
(the testnet)
packages
folder there)echo "PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" > packages/contracts/.env
run yarn
to install all packages
npm install -g yarn
)yarn set version 1
)NPM, PNPM, and other package managers won’t work
run yarn dev
to start the development server for your frontend, the anvil
local blockchain, and the deployer
If you change your systems or tables, press “enter” after having focused the process 3
in the dashboard
Tap “3” on your keyboard
Press enter to restart the deployer. Your client will automatically reload with the new deployment.
Hot reload of systems is a work in progress (ask Flo or Justin for progress)
If you want to rerun code-generation after changing your config file (to regenerate libraries), run yarn initialize
at the root of your project
minimal
If you want to connect MUD to a different frontend library (eg: svelte, angular, etc) or 3D engine (eg: Babylon) you should start from the minimal template.
GitHub - latticexyz/v2sandbox: Nothing to see here
branch: main
react
To use React to render your game (and any React library on top, like ReactPixi), you should start with the react
template. MUD comes with React hooks to make it easier to get MUD data into your components.