Skip to content

ep150de/fabricpet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

58 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿพ FabricPet

A Tamagotchi-style virtual pet living in the RP1 spatial fabric metaverse, powered by Bitcoin Ordinals and Nostr.

License: MIT Open Source


๐ŸŒŸ What is FabricPet?

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

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    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)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽฎ Features

Pet System

  • 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

Battle System

  • 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

Bitcoin Ordinals

  • 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

Nostr Integration

  • 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

RP1 Spatial Fabric

  • 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

Open Source Avatars

  • 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

๐Ÿš€ Quick Start

# 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 build

๐Ÿ› ๏ธ Tech Stack

All 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

๐Ÿ“ Project Structure

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

๐Ÿ”ฎ Roadmap

Phase 1 โœ… โ€” Core Pet + Nostr

  • Pet state machine (needs, moods, XP, evolution)
  • Nostr identity (NIP-07 + auto-generated keys)
  • NIP-78 pet state persistence
  • Behavior tree AI

Phase 2 โœ… โ€” Battle + Wallet

  • Turn-based battle engine with elemental types
  • UniSat + Xverse wallet integration
  • Ordinal trait โ†’ stat mapping
  • Practice battles vs CPU

Phase 1.5 โœ… โ€” RP1 Scene Integration

  • 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

Phase 6 โœ… โ€” LLM Pet Chat Agent

  • 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)

Phase 3A โœ… โ€” HoloBall Arena Integration

  • 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

Phase 3B-D โœ… โ€” Multiplayer + Social

  • 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)

Phase 4 โœ… โ€” Live RP1 Scene Sync

  • Auto-sync scene to RP1 when wallet inscriptions change
  • Debounced SceneSync with change detection
  • Force sync and reset capabilities

Phase 5 โœ… โ€” AR + PWA + Sound

  • 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

๐Ÿค Contributing

FabricPet is 100% open source. Contributions welcome!

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“œ License

MIT License โ€” see LICENSE for details.

๐Ÿ™ Credits


Built with โค๏ธ for the open metaverse

About

๐Ÿพ Tamagotchi-style virtual pet for RP1 spatial fabric metaverse โ€” Bitcoin Ordinals avatars, Nostr persistence, 3D kawaii home, battle system. 100% open source.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages