backend gap analysis

Guide for backend gap analysis

Game Backend Gap Analysis

Date: 2026-01-21 (Revised after deep code research) Scope: Product Manager evaluation of loh-backend for gaps and missing functionality

Executive Summary

The backend has made significant progress with 78+ core modules, 22 API handlers, 55 DB migrations, and substantial security/anti-cheat infrastructure. However, several critical gaps remain that block launch readiness.

✅ What's Implemented (Strengths)

Core Game Systems

SystemStatusNotes
Combat System✅ CompleteStances, Combo/Crit, Dodge/Parry, 0.4s tick
Skills (27)✅ CompleteDynamic XP curve, Level 108 cap, Prestige
Inventory/Bank✅ CompleteGrid system, placeholders, atomic operations
Trading✅ CompletePlayer-to-player with escrow
Grand Exchange✅ CompleteMatching engine, 2% tax, order book
Death System✅ CompleteItem protection, graves
Drop Tables✅ CompleteNested tables, luck system, RDT/UDT
Prayers/Tapasya✅ CompleteDrain system, meditation
Slayer✅ CompleteTasks, masters, streaks, points

Infrastructure

SystemStatusNotes
GameState Architecture✅ CompleteDashMap concurrency, session management
WebSocket Communication✅ CompleteReal-time bidirectional
PostgreSQL Integration✅ CompleteSQLx, migrations, connection pooling
Redis Caching✅ CompleteSession cache, pub/sub ready
Zone Manager✅ CompleteMulti-server grid orchestration
Tick Engine✅ Complete0.4s tick loop with batch processing
Persistence✅ CompleteWrite-behind with dirty-flag batching

Security & Integrity

SystemStatusNotes
Heuristics Engine✅ CompleteRobotic precision, macro detection
Shadow Banning✅ CompleteDegrades drops without ban alerts
Behavior Monitor✅ CompleteFatigue tracking, honeypots
Dupe Detection✅ Complete5-min background scans
XP Rate Limiter✅ CompleteHard caps per skill
Trade Escrow✅ CompleteAtomic swaps with locking
Inventory Nonces✅ CompleteReplay attack prevention

Observability

SystemStatusNotes
Prometheus Metrics✅ Completecadvisor, node-exporter
Grafana Dashboards✅ CompleteSRE panels
Alertmanager✅ CompleteEmail, PagerDuty routing
Load Test Client✅ CompleteBot roles, 2k CCU testing

🔴 Critical Gaps (P0 - Launch Blockers)

1. Payments Integration ✅ ~50% Complete (BLOCKED on incorporation)

Status: Core logic implemented, some HTTP routes missing, blocked on incorporation for real payment provider Location: logic-core/src/store/, api-game/src/api/shop_handlers.rs Impact: Cannot monetize until incorporation complete
✅ Implemented:
  • Migration 20260117020000_create_payment_tables.up.sql (orders, order_items, transactions tables)
  • CartManager with validate() method (price calculation, coupon validation, bulk discounts)
  • PaymentManager with complete_purchase() method
  • Shop endpoints: GET /shop/products, POST /shop/purchase
  • Stripe webhook: POST /webhooks/stripe
  • Documentation: docs/PAYMENT_API.md
❌ Remaining Gaps:
  • POST /cart/validate HTTP route (logic exists in CartManager, route not exposed)
  • POST /checkout/intent HTTP route (PaymentIntent creation)
  • POST /checkout/finalize HTTP route (order finalization)
  • GET /orders HTTP route (order history)
  • Chargeback webhook and debt system integration
  • Razorpay provider (Stripe only currently)
  • Receipt email dispatch

2. Account System Incomplete

Status: Partial implementation Location: logic-core/src/auth/ Impact: Multi-profile support broken
Missing Components:
  • Full Master Account → N Game Profiles flow
  • Profile switching during session
  • Profile-level debt tracking (post-chargeback)
  • Account freezing/unfreezing logic
  • Password reset flow
  • Email verification
Designed but not implemented: backend_contracts.md#L169-L201

3. Growth Engine (Referrals/Affiliates) ✅ ~70% Complete

Status: Core logic implemented, HTTP routes missing Location: logic-core/src/growth.rs, tests/growth_integration.rs Impact: Logic exists but not exposed via API
✅ Implemented:
  • GrowthManager with referral code generation (generate_referral_code())
  • Signup attribution (apply_referral_code())
  • Qualification check (check_qualification() for 150 Total Level)
  • Affiliate tables: affiliate_earnings, affiliate_applications, affiliate_clicks
  • Reservation system (create_reservation())
  • Integration tests proving full flow works
❌ Remaining Gaps:
  • HTTP API routes not exposed (logic exists, needs handlers)
  • Admin approval UI in ops-tools
  • Gift code generation endpoint
  • Milestone reward auto-distribution

4. Quest Backend Logic ✅ ~80% Complete

Status: Core system implemented, persistence layer wiring needed Location: logic-core/src/quests/ (manager.rs, events.rs, objectives.rs, definitions.rs, loader.rs) Impact: State machine works, needs DB persistence integration
✅ Implemented:
  • QuestManager with full state machine
  • QuestEvent enum (NpcKilled, ItemCollected, NpcTalked, LocationReached, SkillLeveled)
  • ObjectiveProgress tracking per step
  • PlayerQuestData struct with current_step, objectives_progress, timestamps
  • handle_event() for automatic objective progression
  • Migration 040_quest_progress.sql with quest_progress table
  • Quest requirement checks (skill levels, items, previous quests)
  • Quest point tracking
❌ Remaining Gaps:
  • Persistence layer: Save/load PlayerQuestData from quest_progress table
  • HTTP API handlers for quest operations (start, check, complete)
  • Reward distribution integration (XP orbs, items via inventory system)

5. Item Instance IDs (Dupe-Proofing)

Status: Deferred in backlog Location: pending_tasks.md#L215-L221 Impact: Cannot trace individual items for RWT detection
Missing Components:
  • UUID generation for non-stackable items
  • Schema overhaul for inventory/bank tables
  • Instance ID in trade logs

🟡 Significant Gaps (P1 - Post-Launch Issues)

6. World Content Systems

FeatureStatusNotes
Fairy Rings (Yaksha Portals)🟡 Data onlyNo backend validation
Spirit Trees (Kalpavriksha)🟡 Data onlyNo backend validation
Gliders (Vimana)🟡 Data onlyNo backend validation
Canoes🟡 Data onlyNo backend validation
Achievement Diaries✅ CompletePersistence and API implemented
Missing: Server-side coordinate validation for all travel networks.

7. Social Systems

FeatureStatusNotes
Friends List✅ CompleteCRUD + status updates
Ignore List✅ Complete
Private Messages⚠️ PartialNo persistence
Clan System⚠️ Partialclan.rs exists, limited features
Party System✅ CompleteFull party management
Missing:
  • Clan bank
  • Clan broadcasts
  • Clan ranks with permissions

8. Player Housing

Status: Stub only Location: logic-core/src/house_construction.rs (3KB) Impact: Major content gap
Missing Components:
  • Room placement logic
  • Furniture system
  • Portal network
  • Visitor permissions
  • House parties

9. Minigames

Status: Not implemented Impact: No group content variety
Missing:
  • Clan Wars (Gandharva War)
  • Warrior's Guild (Kshatriya Mandala)
  • Underworld Arena (Patala Loka)

10. Economy NPCs (QoL)

Status: Not implemented Location: pending_tasks.md#L199-L208
Missing:
  • Yamaraja's Office (grave retrieval, gold sink)
  • Kingdom Management (passive income)
  • Price Checker (GE price lookup)
  • Parashurama (bank cleanup)
  • Kshetrapala (tool storage)

🟢 Backlog (P2 - Nice to Have)

FeatureLocationNotes
Lua Hot-ReloaderDeferredmlua context reload
NavMesh VisualizerDeferredA* debug overlay
Packet Loss SimulatorDeferredDebug tool
SQL Safety Net ExecutionBlockedNeeds high-privilege audit
Thieving ContentDeferredRogue's Outfit

Schema Gaps

Based on migrations review, the following tables may be missing or incomplete:
TableStatusNotes
quests_progress❌ MissingNo migration found
achievements❌ Missingregional_diaries.rs has no backing table
housing_rooms❌ MissingHouse construction has no persistence
housing_furniture❌ Missing
affiliate_payouts❌ MissingGrowth engine not implemented
referral_tracking❌ Missing

Recommendations

Immediate (Pre-Launch)

  1. Complete Payments Integration - Unblock revenue
  2. Implement Quest Backend - Core gameplay loop
  3. Account Multi-Profile - Already designed, needs implementation
  4. Item Instance IDs - Anti-RWT requirement

Short-Term (30 Days Post-Launch)

  1. Growth Engine (Bandhu/Rajdoot)
  2. Achievement Diary persistence
  3. Housing Phase 1 (rooms + basic furniture)

Medium-Term (90 Days)

  1. Minigames (Clan Wars first)
  2. Full clan system
  3. Private message persistence

API Coverage Check

Contract EndpointImplementedNotes
GET /products✅ YesGET /shop/products in Rust
POST /shop/purchase✅ YesCreates PaymentIntent
POST /webhooks/stripe✅ YesHandles payment success
POST /cart/validate⚠️ Logic onlyCartManager.validate() exists, route not exposed
POST /checkout/intent❌ No
POST /checkout/finalize❌ No
GET /orders❌ No
POST /store/reserve⚠️ Logic onlyGrowthManager.create_reservation() exists
POST /game/deliver_bond❌ NoFulfillment
/admin/*❌ NoBackoffice
Coverage: ~30% of e-commerce API from backend_contracts.md (up from 0%)

Summary

┌─────────────────────────────────────────────────────────────┐
│ BACKEND READINESS ASSESSMENT (Revised 2026-01-21)          │
├──────────────────┬──────────────────────────────────────────┤
│ Core Game Logic  │ █████████████████████████████ 95%        │
│ Security         │ ██████████████████████████── 85%         │
│ Infrastructure   │ ██████████████████████████ 90%           │
│ Payments         │ █████████████░░░░░░░░░░░░░ 50%           │
│ E-Commerce API   │ ████████░░░░░░░░░░░░░░░░░░ 30%           │
│ Growth Engine    │ ██████████████████░░░░░░░░ 70%           │
│ Quest Backend    │ ████████████████████░░░░░░ 80%           │
│ Housing          │ ░░░░░░░░░░░░░░░░░░░░░░░░░░ 5%            │
│ Minigames        │ ░░░░░░░░░░░░░░░░░░░░░░░░░░ 0%            │
└──────────────────┴──────────────────────────────────────────┘
Overall Backend Readiness: ~72% (up from 60%)
Critical Path to Launch: HTTP Route Wiring → Security Hardening → Incorporation