Skip to content

HZ-KMNO/roco-sandbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

37 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Roco Sandbox Logo

Sponsor QR
If this project helps you, feel free to buy me a coffee

๐Ÿฑ Follow the developer on Bilibili: ่ฟ็ฑณไธ

๐Ÿฐ Roco Sandbox

Battle assistant for Roco Kingdom: World PVP โ€” turn-by-turn AI coach, damage reverse engineering, and a sandbox for what-if analysis.

License Tauri React TypeScript

็ฎ€ไฝ“ไธญๆ–‡ | English


๐ŸŽฏ What Is This?

A desktop companion that sits alongside your PVP match. While the in-game UI shows HP percentages and damage numbers, Roco Sandbox tells you what those numbers actually mean.

  • ๐Ÿงฉ Predict opponent personality and talent stats
  • ๐Ÿ“Š Preview who wins the next few turns
  • ๐Ÿค– Get AI coaching for every turn
  • ๐Ÿ”ง Correct the simulation when it diverges from reality

All recommendations are grounded in PVP Introduction tactical principles โ€” analyzing Check/Counter relationships, redundancy tactics, and breakthrough tactics rather than raw damage comparison.


๐Ÿค– Multi-Turn AI Coach

  • ๐Ÿง  True conversation memory โ€” the AI remembers its advice from round 2 when reasoning about round 3
  • โšก Preloaded system prompt โ€” full team context injected once, then lightweight per-turn calls
  • โ†ฉ๏ธ Undo sync โ€” rolling back a turn also trims the AI chat history
  • ๐Ÿ’พ Persistent sessions โ€” stored in localStorage, survives restarts
  • ๐Ÿ’ฐ Low cost โ€” roughly 0.001 RMB per turn, about one cent for a 30-turn match

๐ŸŽฏ Confirmation Bar

After every turn, a slim bar appears at the bottom with a 1.5-second progress bar.

  • โœ… Normal turns auto-confirm โ€” zero friction
  • ๐Ÿ”ด Key events (KO, evolution, mark layer change, freeze) force manual confirmation
  • ๐Ÿ“ Press E to expand the correction panel โ€” adjust enemy HP%, your HP, observed damage, and energy
  • โณ The AI is delayed during the bar โ€” only fires after you've locked in the data

๐Ÿง  Damage Reverse Engine

Tell it the actual damage dealt, and it reverse-solves the damage formula to narrow down the opponent's attack stat and personality.

Each observation shrinks the range. After 3โ€“5 corrections, the engine identifies the enemy's likely personality name and pins their attack stat to within ยฑ10. Future damage predictions use the inferred range instead of default popular builds.

The estimate appears as a purple badge on the enemy panel:

็‰ฉๆ”ปโ‰ˆ195ยทๅๆ‰ง / ้ญ”ๆ”ปโ‰ˆ210ยทไธ“ๆณจ (5 observations)


โช Turn Timeline & Cascade Replay

Every turn is recorded โ€” state before, state after, both players' actions โ€” and displayed as a horizontal timeline at the bottom.

  • ๐Ÿ” Click any past turn to open retrospective correction
  • ๐Ÿ“Œ "Only this one" โ€” override that turn's display without affecting later turns
  • ๐Ÿ”„ "Replay to current" โ€” re-simulate all subsequent turns using the corrected state
  • ๐Ÿค– The AI receives a correction notice so it knows the context shifted

๐Ÿ“ฅ Formula Import

Paste the official share format โ€” the kind of text players post on community platforms:

### Team Name
# ้ญ”ๆณ•๏ผš่ฟ›ๅŒ–ไน‹ๅŠ›
#
# Pokรฉmon A๏ผšFire Bloodlineใ€{Skill 1ใ€Skill 2ใ€Skill 3ใ€Skill 4}
# Pokรฉmon B๏ผšDark Bloodlineใ€{Skill 1ใ€Skill 2ใ€Skill 3ใ€Skill 4}
...

One click creates a team with all 6 Pokรฉmon, their bloodlines, skills, recommended personality and talent (auto-resolved through evolution chains and leader form lookups), plus the magic item.

โš ๏ธ Personality and talent values imported via the official formula use recommended builds. Adjust manually if they differ from your actual configuration.


๐Ÿ” Pinyin Search Everywhere

Type the first letter(s) of each Chinese character's pinyin to filter results instantly.

  • t matches skills where any character starts with t
  • tq matches skills with two characters starting with t + q
  • dm matches Pokรฉmon whose name starts with d + m

All 6 search boxes in the app support this feature.


โš™๏ธ Trait System

Approximately 95% trait coverage across five handlers plus two supplemental systems.

  • ๐Ÿšช Entry traits โ€” ~30 effects on switch-in
  • ๐Ÿšถ Exit traits โ€” cleanup or transfer on switch-out
  • ๐Ÿ”„ End-of-turn traits โ€” periodic effects like dedication and auto-detach
  • ๐Ÿ›ก๏ธ Counter traits โ€” triggered on successful counter
  • โš”๏ธ On-attack traits โ€” ~25 attack-time patterns
  • ๐Ÿ Capture balls โ€” 14 variants with different stat modifiers
  • ๐ŸŒธ Beast bloodlines โ€” 18 type-based effects

Only persistent fields survive switching; all others are cleared and recalculated on re-entry.


๐ŸŽจ Six Tabs

  • โš”๏ธ Battle โ€” live match flow with team panels, AI engine, and 3-column matchup analysis
  • โ–ถ๏ธ Replay โ€” paste battle logs, view structured turns, AI replay analysis (up to 50 saved)
  • ๐Ÿ‘ฅ Teams โ€” featured teams browser, formula import, template management
  • ๐Ÿ“– Pokedex โ€” all 525 monsters by index number with recommended builds
  • ๐ŸŽ“ Tutorial โ€” reader-style with table of contents, textbook prose, and term tables
  • โš™ Settings โ€” API key, suggestion mode, rank mode, theme, font size, data management

๐Ÿ›  Tech Stack

  • ๐Ÿ–ฅ๏ธ Desktop shell โ€” Tauri 2 (Rust)
  • โš›๏ธ Frontend โ€” React 19 + TypeScript (strict mode)
  • ๐ŸŽจ Styling โ€” Tailwind CSS v4
  • ๐Ÿ“ฆ Build โ€” Vite 7
  • ๐Ÿค– AI โ€” DeepSeek (multi-turn chat completions)
  • ๐Ÿ“Š Data โ€” 525 monsters, 501 moves, 18 types

The Rust backend is intentionally pass-through โ€” all business logic lives in TypeScript for fast iteration.

๐Ÿ’ก If Windows shows "Windows protected your PC" or "Unknown publisher" after downloading the installer, click "More info" โ†’ "Run anyway". This software is a safe open-source project; we simply don't have a paid code signing certificate.


๐Ÿš€ Getting Started

๐Ÿ“‹ Prerequisites

  • Node.js 18 or higher
  • Rust (for building the desktop app)
  • Windows 10 or 11 (macOS/Linux should work but untested)

๐Ÿ”ง Install & Run

git clone https://github.com/HZ-KMNO/roco-sandbox.git
cd roco-sandbox
npm install
npm run tauri dev     # Full desktop app with hot reload
# or
npm run dev           # Frontend only at http://localhost:1420

๐Ÿ“ฆ Build a Release

npm run tauri build
# Output: %CARGO_TARGET_DIR%/roco-sandbox/release/bundle/

๐Ÿ”‘ Configure DeepSeek (Optional)

The app works without AI โ€” a rule-based suggestion engine takes over. To enable AI:

  1. Get an API key from the DeepSeek Platform
  2. Open the app โ†’ Settings โ†’ paste the key
  3. Add the first enemy โ€” AI auto-preloads and starts suggesting after each turn

๐Ÿ“– User Guide

A comprehensive usage guide is available at docs/app-guide.md (in Chinese). It covers all tabs, advanced features, keyboard shortcuts, and FAQ. Also accessible in-app via the Tutorial tab (pinned at the top).


๐Ÿ— Project Structure

src/
โ”œโ”€โ”€ App.tsx                          # Tab shell, settings, AI orchestration
โ”œโ”€โ”€ components/
โ”‚   โ”œโ”€โ”€ TeamPanel.tsx                # Your team
โ”‚   โ”œโ”€โ”€ EnemyPanel.tsx               # Opponent team
โ”‚   โ”œโ”€โ”€ MatchupAnalysis.tsx          # 3-column battle UI
โ”‚   โ”œโ”€โ”€ TurnCorrectionBar.tsx        # 1.5s correction bar
โ”‚   โ”œโ”€โ”€ TurnTimeline.tsx             # Timeline & cascade replay
โ”‚   โ”œโ”€โ”€ QuickImport.tsx              # Formula import
โ”‚   โ”œโ”€โ”€ MonsterCard.tsx              # Monster detail card
โ”‚   โ”œโ”€โ”€ FeaturedTeams.tsx            # Teams tab
โ”‚   โ”œโ”€โ”€ Pokedex.tsx                  # Pokedex tab
โ”‚   โ”œโ”€โ”€ Tutorial.tsx                 # Tutorial reader
โ”‚   โ””โ”€โ”€ ReplayAnalysis.tsx           # Replay tab
โ””โ”€โ”€ lib/
    โ”œโ”€โ”€ calculator.ts                # Damage formula & stat calc
    โ”œโ”€โ”€ battle.ts                    # Matchup analysis
    โ”œโ”€โ”€ simulator.ts                 # Turn engine & trait handlers
    โ”œโ”€โ”€ aiAdvisor.ts                 # DeepSeek client (multi-turn)
    โ”œโ”€โ”€ aiSession.ts                 # Session persistence & truncation
    โ”œโ”€โ”€ observations.ts              # Damage observation log
    โ”œโ”€โ”€ damageReverser.ts            # Reverse engine
    โ”œโ”€โ”€ battleTimeline.ts            # Turn records & cascade replay
    โ”œโ”€โ”€ officialFormatParser.ts      # Share-format parser
    โ”œโ”€โ”€ popularStats.ts              # Recommended config lookup
    โ””โ”€โ”€ pinyinSearch.ts              # Pinyin search

See CLAUDE.md for an architecture deep dive.


๐Ÿ“ Data Flow per Turn

User selects skills โ†’ Space (execute)
  โ†’ resolveTurn() โ†’ new state
    โ†’ TurnRecord recorded
      โ†’ Correction bar appears (1.5s)
        โ”œโ”€ Key event? โ†’ red, must confirm
        โ”œโ”€ Press E โ†’ correction panel
        โ”‚   โ””โ”€ Apply โ†’ BattleState updated + observation recorded
        โ””โ”€ Auto or manual confirm
          โ†’ getTurnAdvice() with multi-turn history
            โ†’ AI reply + localStorage persistence

Undo โ†’ state rollback + AI history trim + notice banner
Retrospective fix โ†’ Timeline โ†’ this-only or cascade replay

๐Ÿค Contributing

This is a personal project, but pull requests are welcome:

  • ๐Ÿ› Bug fixes for trait edge cases
  • ๐Ÿ“Š New recommended build data
  • ๐Ÿ“ Tutorial content updates
  • ๐ŸŒ Localization

๐Ÿ“œ License

This project is for educational and personal use only. Game data belongs to the original IP holder of Roco Kingdom: World.

โš ๏ธ No piracy. No commercial use. This is a free open-source project. If you paid for access, please report the seller and demand a refund.


๐Ÿ™ Acknowledgments

  • ๐Ÿ”— RK Team Builder โ€” team building reference
  • ๐Ÿ“š LCX Wiki โ€” monster and move data source
  • ๐ŸŒ Roco PVP Assistant โ€” popular teams API
  • ๐Ÿ“บ Zhuo Shuai โ€” recommended builds for all monsters
  • ๐Ÿค– DeepSeek โ€” affordable multi-turn LLM API
  • ๐Ÿ‘ฅ Roco Kingdom: World community โ€” tactical theory contributors
  • ๐ŸŽ“ WwlWss โ€” tactical theory

โš”๏ธ Have fun. The best players know when to stop trusting the simulator.

About

๐Ÿฐ ๆด›ๅ…‹ๆฒ™็›˜ โ€” ๆด›ๅ…‹็Ž‹ๅ›ฝ๏ผšไธ–็•Œ PVP ๅฏนๆˆ˜่พ…ๅŠฉ | AI ๅคš่ฝฎๆ•™็ปƒ + ไผคๅฎณๅๆŽจๅผ•ๆ“Ž + ๅฎžๆˆ˜ไฟฎๆญฃ

Topics

Resources

License

Contributing

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors