A voice-enabled, character-driven trading game that brings markets to life through personality, sound, and social play. Learn trading through interactive characters who speak, react, and guide you through the excitement of the trading floor.
Development Server Running: http://localhost:3001
- 5 Unique Trading Personalities with distinct voices via ElevenLabs API
- Real-time voice announcements for game events
- Character catchphrases and contextual dialogue
- Emotional voice tones matching game situations
- Animated Character Avatars with 8 expressions each
- Dynamic particle effects and animations
- Expression changes based on game events
- Interactive character selection gallery
- Physical Card Game: 17 custom cards with values from -10 to 20
- Online Multiplayer: Real-time trading with 2-5 players
- Solo Practice: Play against AI personalities
- Web3 Integration: Optional crypto-backed micro-stakes (coming soon)
- Firebase Authentication & Real-time Database
- Socket.io for multiplayer functionality
- CI/CD with GitHub Actions
- Vercel deployment configuration
- Environment-based configuration
- Node.js 18+
- pnpm (
npm install -g pnpm) - Git
# Clone the repository
git clone https://github.com/M0nkeyFl0wer/A-Trading-Game-WTF.git
cd A-Trading-Game-WTF
# Install dependencies
pnpm install
# Build workspace packages
pnpm --filter @trading-game/shared build
pnpm --filter @trading-game/core build
pnpm --filter @trading-game/bot build
# Set up environment variables
cp apps/web/.env.example apps/web/.env
# Edit .env with your API keys-
ElevenLabs API (for voice features)
- Get your key at: https://elevenlabs.io
- Add to
.env:VITE_ELEVENLABS_API_KEY=your_key
-
Firebase (for authentication & database)
- Create project at: https://console.firebase.google.com
- Enable Authentication and Realtime Database
- Add Firebase config to
.env
# Start development server
cd apps/web
pnpm dev
# Access at http://localhost:3000- Personality: Professional, neutral, authoritative
- Voice Style: Calm and measured
- Catchphrase: "The market waits for no one"
- Personality: Optimistic, aggressive, risk-taker
- Voice Style: Excited and confident
- Catchphrase: "To the moon!"
- Personality: Pessimistic, analytical, conservative
- Voice Style: Cautious and skeptical
- Catchphrase: "The crash is coming"
- Personality: Mysterious, strategic, influential
- Voice Style: Deep and commanding
- Catchphrase: "I move markets"
- Personality: Naive, enthusiastic, learning
- Voice Style: Young and energetic
- Catchphrase: "YOLO!"
A-Trading-Game-WTF/
โโโ apps/
โ โโโ web/ # React web application
โ โโโ src/
โ โ โโโ lib/ # Core libraries
โ โ โ โโโ elevenlabs.ts # Voice integration
โ โ โ โโโ firebase.ts # Firebase config
โ โ โ โโโ gameRoom.ts # Multiplayer logic
โ โ โ โโโ characterVisuals.ts # Visual system
โ โ โโโ ui/ # UI components
โ โ โ โโโ VoiceControls.tsx
โ โ โ โโโ CharacterAvatar.tsx
โ โ โ โโโ CharacterGallery.tsx
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ pages/ # Page components
โ โ โโโ contexts/ # React contexts
โโโ packages/ # Shared packages
โ โโโ shared/ # Shared types & utils
โ โโโ core/ # Game logic
โ โโโ bot/ # AI players
โ โโโ contract/ # Smart contracts
โโโ api/ # Serverless functions
โโโ .github/workflows/ # CI/CD pipelines
โโโ vercel.json # Deployment config
The game features full voice integration with:
- Pre-game lobby announcements
- Round start/end notifications
- Trade confirmations
- Win/loss reactions
- Character-specific commentary
- Toggle on/off
- Volume control
- Character selection
- Manual phrase triggering
- Queue management for sequential dialogue
Recent red-team and UX feedback led to a full lobby and table overhaul:
- Adaptive Layouts โ lobby/table pages now use responsive cards, skeleton loading states, and accessible ARIA labels.
- State Management Overhaul โ a normalized zustand store exposes trades, rounds, players, and voice preferences for deterministic renders.
- Voice Fallbacks โ ElevenLabs requests gracefully downgrade to the browser SpeechSynthesis API (or console logs in SSR/tests) when API keys are missing.
- Accessible Modals & Controls โ table creation, quoting, and voice controls trap focus, surface live regions, and support keyboard flows.
- Offline Lobby Cache โ when the realtime backend is offline, the lobby hydrates with sanitized mock table data so QA can rehearse the flow.
Navigate to /payments to review the new payment experience skeleton:
- Multi-Rail Selector โ wallet deposits, card checkout, and ACH transfers with statuses (
available,coming soon). - Workflow Blueprint โ disabled forms outline required data capture while highlighting integration points (Stripe, Plaid, compliance vendors).
- Risk & Compliance Sidebar โ checklists reference Travel Rule, AML screening, PCI, and SOC2 tasks surfaced in the security audit.
- Escrow Notes โ copy documents the pull-payment settlement strategy and latency expectations per network.
โ๏ธ Everything renders with sandbox placeholders. Replace the disabled buttons with real provider SDK calls once credentials and compliance gates are cleared.
- Install & run the web app โ
pnpm install && pnpm --filter @trading-game/web devthen open http://localhost:3000. - Lobby smoke test โ ensure the lobby shows skeleton cards, then populated mock tables, and voice controls toggle without errors when ElevenLabs keys are absent (you should see SpeechSynthesis or console fallbacks).
- Table experience โ join a table, trigger the quick actions, submit a sample quote, and confirm trades appear in the tape with timestamps.
- Payments scaffold โ navigate to
/payments, switch between rails, and review compliance notes against theSECURITY_AUDIT_PREBETA.mdfindings. - Security regression script โ rerun
./tests/red-team-termux.shto ensure middleware, rate limiting, and headers still pass after UI updates (backend must be running).
- Each player receives one card (value: -10 to 20)
- Players trade shares based on expected total
- Market value = Sum of all cards รท Number of players
- Winners profit from accurate predictions
- Deal Phase: Cards distributed
- Trading Phase: 2-minute trading window
- Reveal Phase: Cards shown, market value calculated
- Settlement Phase: Profits/losses determined
# Install Vercel CLI
npm i -g vercel
# Deploy to production
vercel --prodVITE_ELEVENLABS_API_KEYVITE_FIREBASE_API_KEYVITE_FIREBASE_AUTH_DOMAINVITE_FIREBASE_PROJECT_ID- All other Firebase config vars
# Run tests
pnpm test
# Run with coverage
pnpm test:coverage- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add AmazingFeature') - Push to branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Voice-enabled characters with ElevenLabs
- Visual character system with animations
- Firebase authentication
- Real-time multiplayer infrastructure
- CI/CD pipeline
- Vercel deployment configuration
- Complete game logic implementation
- Mobile responsive design
- Comprehensive test coverage
- AI opponent personalities
- Tournament mode
- Leaderboards
- Educational tutorials
- Mobile app (React Native)
- Web3 micro-stakes integration
- Environment variables for sensitive data
- Firebase security rules
- Input validation
- Rate limiting (planned)
- Secure WebSocket connections
MIT License โ Open source for public learning and remixing.
- Gary Stevenson for the original trading game concept
- ElevenLabs for voice synthesis API
- Firebase for backend infrastructure
- Vercel for deployment platform
- Issues: https://github.com/M0nkeyFl0wer/A-Trading-Game-WTF/issues
- Discussions: https://github.com/M0nkeyFl0wer/A-Trading-Game-WTF/discussions
Built with โค๏ธ and ๐๏ธ voices by the community