Skip to content

Run it locally ​

Valley Explorers is a Vite + TypeScript app with no framework and no backend. The game, its art and its audio all run in the browser. The source is on GitHub.

Start the game ​

You need Node.js 20 or newer.

sh
npm install
npm run dev        # http://localhost:5173

The first run downloads the Pokémon sprites from the PokeAPI sprite collection into public/licensed/pokemon/. They aren't stored in the repository.

ScriptWhat it does
npm run devDev server with hot reload
npm run buildType-check, then a production build in dist/
npm run previewServe the production build locally

Configuration ​

Copy .env.example to .env.local and fill it in. Everything works without it; you only need it for the $PVE features.

VariableMeaningDefault
VITE_SOLANA_CLUSTERmainnet-beta or devnetmainnet-beta
VITE_RPC_URLSolana RPC endpoint the browser talks toThe public endpoint for the cluster
VITE_PVE_MINTThe $PVE mint (contract) addressEmpty

While VITE_PVE_MINT is empty, the wallet screen says "$PVE is launching" and the market's Buy buttons are disabled. Everything else plays normally. The public mainnet endpoint rate-limits browsers, so use an RPC provider URL for anything real; it ships in the page, so restrict its allowed origins with your provider.

Where things are ​

src/
  main.ts              boot: load art and sprites, show the title screen, start the game
  config.ts            cluster, RPC, mint, decimals, permit price
  data/
    creatures.ts       every Pokémon: dex no., types, base stats, catch rate, where/when, learnsets, berries
    pveShop.ts         the $PVE Market catalog, memo receipt format, stone evolutions
  game/
    game.ts            game loop, movement, encounters, lighting, saving
    maps.ts            the three maps: tiles, props, NPCs, warps, sparkles, garden plots
    render.ts          ground, edges, y-sorted props, lighting, weather, particles
    clock.ts           10-minute days, phases, weather, resting
    script.ts          NPC dialogue, trainers, garden, foraging, the Grove gate
    save.ts            save format (localStorage key pve.save.v2)
    battle/            battle rules, battle scene, evolution scene
  ui/                  dialogue, menus, HUD, party, Pokédex, shops, $PVE Market, wallet, touch pad, title
  chain/               wallet connection and $PVE transactions (build, simulate, send, verify, history)
  art/                 original pixel art, drawn in code
  audio/               procedural Web Audio music, sound effects and cries
  engine/              input (keyboard + touch) and small utilities
public/                logo, banner, icons, web manifest
vite.config.ts         build settings and the sprite download

The game loads the Solana libraries only when you open a wallet feature, so players who never connect a wallet never download them.

Pokémon sprites © The Pokémon Company, via PokeAPI/sprites. World art, music and these docs are original to Valley Explorers.