A Tamagotchi-style virtual pet living in the RP1 spatial fabric metaverse, powered by Bitcoin Ordinals and Nostr.
FabricPet is an open-source virtual pet application that combines:
- ๐ฅ Tamagotchi-style pet care โ Feed, play, clean, and nurture your pet through 5 evolution stages
- โ๏ธ Pokรฉmon-style battles โ Turn-based combat with elemental types, status effects, and STAB bonuses
- โฟ Bitcoin Ordinals integration โ Use your ordinal inscriptions as pet skins that influence battle stats
- ๐ก Nostr-powered persistence โ Your pet state is stored on Nostr relays (NIP-78) โ you own your data
- ๐ RP1 Spatial Fabric ready โ MVMF bridge prepared for RP1 metaverse integration
- ๐ญ Open Source Avatars โ VRM avatar support via the Open Source Avatars protocol
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FabricPet App โ
โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโค
โ Pet โ Battle โ Wallet โ Home/Spatial โ
โ View โ Screen โ View โ View โ
โโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโค
โ Zustand Store โ
โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโค
โ Pet โ Battle โ Wallet โ Avatar โ
โ Engine โ Engine โ Connect โ Loader โ
โโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโค
โ Nostr Layer (NIP-07, NIP-78) โ
โโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ RP1 MVMF Bridge โ Bitcoin Ordinals (UniSat/ โ
โ (Spatial Fabric) โ Xverse via sats-connect) โ
โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- 5 Evolution Stages: Egg โ Baby โ Teen โ Adult โ Elder
- 4 Needs: Hunger, Happiness, Energy, Hygiene (real-time decay)
- 8 Moods: Happy, Playful, Content, Hungry, Tired, Sad, Sick, Excited
- Behavior Tree AI: Autonomous pet behavior in the spatial home
- XP & Leveling: Gain XP from care actions and battles
- Turn-based combat with speed-priority resolution
- 7 Elemental Types: Fire, Water, Earth, Air, Light, Dark, Neutral
- Type effectiveness chart (super effective / not very effective)
- STAB bonus (Same Type Attack Bonus)
- Status effects: Sleepy, Dizzy, Dazzled, Charmed, Pumped
- 18+ moves across Attack, Special, Defense, Support, and Status categories
- Deterministic RNG using seeded hashing for verifiable battles
- UniSat wallet integration (browser extension)
- Xverse wallet integration (via sats-connect)
- Ordinal โ Pet skin: Your inscription's image becomes your pet's appearance
- Trait โ Stats: Ordinal metadata traits boost battle stats
- Trait โ Element: Keywords in traits determine elemental type
- Rarity multiplier: Rarer ordinals give higher stat multipliers
- NIP-07: Browser extension signing (nos2x, Alby)
- NIP-78: App-specific data storage (kind 30078)
- Auto-generated keys: For users without a Nostr extension
- Relay pool: Publishes to multiple relays for redundancy
- Battle challenges: Send/receive challenges via Nostr events
- MVMF Bridge: Pet and home state formatted as MVMF models
- NSO Service: AI behavior endpoints defined for RP1 integration
- Spatial registration: Ready to register as a fabric node
- Visitor system: Guestbook and visitor detection prepared
- VRM model loading via @pixiv/three-vrm
- Avatar catalog from the OSA repository
- Placeholder pet (cute 3D sphere) when no VRM is loaded
- Three.js rendering with proper lighting and materials
# Clone the repository
git clone https://github.com/your-username/fabricpet.git
cd fabricpet
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run buildAll open source tools and libraries:
| Layer | Technology | License |
|---|---|---|
| Framework | React 19 + TypeScript | MIT |
| Build | Vite 7 | MIT |
| Styling | Tailwind CSS 4 | MIT |
| State | Zustand | MIT |
| 3D | Three.js + @pixiv/three-vrm | MIT |
| Identity | nostr-tools (NIP-07, NIP-78) | Unlicense |
| Wallet | sats-connect (Xverse) | MIT |
| Avatars | Open Source Avatars protocol | CC-BY-4.0 |
| Metaverse | RP1 MVMF Bridge (stub) | MIT |
src/
โโโ types/ # TypeScript type definitions
โ โโโ index.ts # All interfaces and types
โโโ utils/ # Utility functions
โ โโโ constants.ts # Game constants, relay URLs, evolution tables
โ โโโ hash.ts # Deterministic hashing utilities
โโโ engine/ # Core game engine
โ โโโ PetStateMachine.ts # Pet creation, evolution, mood, XP
โ โโโ NeedsSystem.ts # Hunger/happiness/energy/hygiene decay
โ โโโ MoveDatabase.ts # All 18+ battle moves
โ โโโ BehaviorTree.ts # Autonomous pet AI behavior
โโโ battle/ # Battle system
โ โโโ BattleEngine.ts # Turn-based combat with type effectiveness
โโโ nostr/ # Nostr integration
โ โโโ relayManager.ts # Relay pool management
โ โโโ identity.ts # NIP-07 key management
โ โโโ petStorage.ts # NIP-78 save/load pet state
โโโ wallet/ # Bitcoin wallet integration
โ โโโ WalletConnect.ts # UniSat + Xverse + ordinal traits
โโโ avatar/ # Avatar system
โ โโโ AvatarLoader.ts # OSA + VRM model loading
โโโ rp1/ # RP1 metaverse integration
โ โโโ MVMFBridge.ts # MVMF model + NSO service stubs
โโโ store/ # Global state
โ โโโ useStore.ts # Zustand store
โโโ components/ # React UI components
โโโ Navigation.tsx # Bottom nav bar
โโโ Notification.tsx # Toast notifications
โโโ SetupScreen.tsx # New pet creation
โโโ PetView.tsx # Main pet interaction
โโโ HomeView.tsx # Spatial home environment
โโโ BattleScreen.tsx # Turn-based battle UI
โโโ WalletView.tsx # Wallet connection & ordinals
- Pet state machine (needs, moods, XP, evolution)
- Nostr identity (NIP-07 + auto-generated keys)
- NIP-78 pet state persistence
- Behavior tree AI
- Turn-based battle engine with elemental types
- UniSat + Xverse wallet integration
- Ordinal trait โ stat mapping
- Practice battles vs CPU
- Scene Assembler JSON generator (dynamic Bitcoin-to-RP1)
- GLB export with Web Share API
- MVMF bridge with scene push
- Ordinals rendered directly from blockchain in RP1
- Ollama + vLLM + OpenAI-compatible endpoint support
- Dynamic personality system (elemental type, mood, stage, battle record)
- Streaming chat with conversation history
- Configurable settings (endpoint, model, temperature)
- Full holoball-arena repo integrated (github.com/sayree121/holoball-arena)
- Arena system with 7 biomes (Cyber Grid, Volcanic Forge, Deep Ocean, Crystal Cavern, Void Nexus, Sky Temple, Overgrown Ruins)
- HoloBall system (throw, materialize, deploy, recall)
- Battle arena manager, visualizer, and camera system
- NSO services (Arena, Matchmaking, Spectator, Tournament)
- Spatial registration and proximity detection
- P2P battles via Nostr events (relay code + UI)
- Challenge lobby with incoming challenge cards
- Leaderboard โ queries Nostr relays, ranks by wins/win rate/level
- Pet visiting via npub or hex pubkey
- Guestbook signing (NIP-78 events)
- Auto-sync scene to RP1 when wallet inscriptions change
- Debounced SceneSync with change detection
- Force sync and reset capabilities
- Camera AR mode โ see your pet overlaid on real world
- 3D pet rendering with Three.js on camera feed
- WebXR immersive AR detection (ready for future)
- Procedural sound effects via Web Audio API (16 sound types)
- PWA manifest + service worker for offline support
- Installable as home screen app
FabricPet is 100% open source. Contributions welcome!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License โ see LICENSE for details.
- RP1 โ Spatial fabric metaverse protocol
- Open Source Avatars โ Avatar protocol by ToxSam
- nostr-tools โ Nostr protocol library
- Three.js โ 3D rendering
- @pixiv/three-vrm โ VRM avatar support
- sats-connect โ Bitcoin wallet connection
- Zustand โ State management
- Tailwind CSS โ Utility-first CSS
- Vite โ Build tool
Built with โค๏ธ for the open metaverse