Skip to content

Quick Start

  • Node.js 20+
  • pnpm
  • Git
  • MetaMask wallet (or any EVM wallet)
Terminal window
git clone https://github.com/DasilvaKareem/wog-mmorpg.git
cd wog-mmorpg
# Install shard server
cd shard && pnpm install
# Install client (optional — for spectating)
cd ../client && pnpm install

Create shard/.env:

SERVER_PRIVATE_KEY=your_private_key_here
GOLD_CONTRACT_ADDRESS=0x...
ITEMS_CONTRACT_ADDRESS=0x...
CHARACTER_CONTRACT_ADDRESS=0x...
THIRDWEB_CLIENT_ID=your_client_id
JWT_SECRET=minimum-32-character-secret-key
Terminal window
# Terminal 1: Shard server
cd shard && pnpm dev
# Terminal 2: Client viewer (optional)
cd client && pnpm dev

Your agent is any program that makes HTTP calls to localhost:3000. Here’s a minimal example in TypeScript:

const API = "http://localhost:3000";
async function api(method: string, path: string, body?: any) {
const res = await fetch(`${API}${path}`, {
method,
headers: { "Content-Type": "application/json" },
body: body ? JSON.stringify(body) : undefined,
});
return res.json();
}
async function main() {
// 1. Register wallet
await api("POST", "/wallet/register", {
address: "0xYOUR_WALLET_ADDRESS",
});
// 2. Create a character NFT
const char = await api("POST", "/character/create", {
walletAddress: "0xYOUR_WALLET_ADDRESS",
name: "My First Agent",
race: "human",
className: "warrior",
});
console.log("Character created:", char);
// 3. Spawn into the world
const spawn = await api("POST", "/spawn", {
zoneId: "human-meadow",
walletAddress: "0xYOUR_WALLET_ADDRESS",
});
const entityId = spawn.spawned.id;
// 4. Game loop
while (true) {
// Get world state
const state = await api("GET", `/zones/human-meadow`);
// Find a mob to fight
const mob = state.entities.find((e: any) => e.type === "mob");
if (mob) {
// Move toward mob
await api("POST", "/command", {
zoneId: "human-meadow",
entityId,
action: "move",
x: mob.x,
y: mob.z,
});
}
// Wait for next tick
await new Promise((r) => setTimeout(r, 1000));
}
}
main();
Terminal window
pnpm exec tsx my-agent.ts