Skip to content

AminulIslamSifat/wos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

27 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ„๏ธ Whiteout Survival Autopilot (WOS-Bot)

Python License Status Platform PRs Welcome

A high-performance, intelligent automation suite for Whiteout Survival

Built with Python ยท OpenCV ยท PaddleOCR ยท FastAPI OCR Server ยท Real-time Screen Mirroring

How It Works โ€ข Quick Start โ€ข Features โ€ข Structure โ€ข Roadmap


๐Ÿ’ก Platform Note: High-speed streaming mode is optimized for Linux using v4l2loopback. Windows users fall back to standard ADB screen capture with reduced performance.

โš ๏ธ Security Note: Never commit db/account.json to version control. It contains sensitive credentials. Make sure it's listed in your .gitignore.


๐Ÿ“‹ Table of Contents


๐Ÿง  The Bot Brain: How It Works

The bot operates on a Research โ†’ Strategy โ†’ Execution loop:

  1. Vision Engine ๐Ÿ‘๏ธ Instead of simple coordinate clicking, the bot "sees" the game using a hybrid approach of PaddleOCR (for reading text) and OpenCV Template Matching (for identifying icons).

  2. Fuzzy Logic ๐ŸŽฏ Uses rapidfuzz to handle OCR misreads (e.g., reading '0' as 'O'), ensuring actions don't fail due to tiny text variations.

  3. Local OCR Server โšก A dedicated FastAPI server handles heavy lifting for image processing, keeping the main bot logic lightweight and fast.

  4. FSM Navigation ๐Ÿ—บ๏ธ (In Development) A navigation graph that calculates the shortest path between game screens (e.g., jumping from "World Map" directly to "Alliance Tech").


โš ๏ธ ATTENTION: Resolution Lock โš ๏ธ

๐Ÿ”ด CRITICAL: This bot is hardcoded for 1080ร—2460 resolution.

If your device uses a different resolution:

  • โŒ ROI detection will fail
  • โŒ Clicks will land in incorrect locations
  • โŒ The bot may perform unintended actions

Verify your device resolution:

adb shell wm size

๐Ÿ“ Planned Solution

An Auto-Calibration Suite is under development. In a future release, the bot will:

  • โœ… Auto-detect your device resolution on first run
  • โœ… Execute a guided "World Tour" of all game screens
  • โœ… Dynamically generate resolution-specific coordinates in references/TextArea/

Status: Coming soon


๐Ÿš€ Quickstart (Arch Linux)

Prerequisites

  • Android device or emulator with Whiteout Survival installed
  • Arch Linux system (or equivalent distro with pacman)
  • ADB debugging enabled on your Android device
  • USB cable (if using a physical device)
  • Python 3.10+

1๏ธโƒฃ Install System Dependencies

sudo pacman -Syu scrcpy v4l2loopback-dkms v4l2loopback-utils android-tools uv
Package Purpose
scrcpy High-speed screen mirroring
v4l2loopback Virtual video device driver
uv Fast Python package manager
android-tools ADB utilities

2๏ธโƒฃ Initialize V4L2 Loopback (Recommended)

Enable the virtual video device for high-speed OCR streaming:

sudo modprobe v4l2loopback video_nr=10 card_label="scrcpy" exclusive_caps=1

๐Ÿ’ก Tip: To auto-load on every boot, add the following to /etc/modules-load.d/v4l2loopback.conf:

v4l2loopback

And create /etc/modprobe.d/v4l2loopback.conf with:

options v4l2loopback video_nr=10 card_label="scrcpy" exclusive_caps=1

3๏ธโƒฃ Set Up the Python Environment

cd ~/wos
uv venv          # Create virtual environment
uv sync          # Install all dependencies from pyproject.toml

4๏ธโƒฃ Start the OCR Server

Open a dedicated terminal and run:

cd ~/wos
uv run core/ocr.py

This launches the FastAPI OCR server at http://localhost:8000. Keep this terminal open.

5๏ธโƒฃ Configure Your Accounts

cp db/account.json.example db/account.json

Edit db/account.json with your actual credentials:

{
  "your_email@gmail.com": {
    "priority": 1,
    "player": [
      {
        "id": "12345678",
        "name": "Your Chief Name"
      }
    ]
  }
}
Field Description
priority Processing order โ€” lower number runs first
id Player ID found in-game via Chief Profile (top-left corner)
name Character name used for account switching

โš ๏ธ Important: Add db/account.json to your .gitignore immediately. See Security.

6๏ธโƒฃ Launch the Bot

In a separate terminal:

cd ~/wos
python Main/main.py

The bot will:

  • โœ… Auto-detect your device via ADB
  • โœ… Launch Whiteout Survival if not already running
  • โœ… Initialize your player profile
  • โœ… Open the interactive task selection menu
  • โœ… Begin running selected daily tasks

๐ŸชŸ Quickstart (Windows Fallback)

Note: Windows support is limited. High-speed V4L2 streaming is not natively available. ADB-only mode is slower but functional.

Prerequisites

1๏ธโƒฃ Install Python Dependencies

pip install uv
cd wos
uv venv
uv sync

2๏ธโƒฃ Add ADB to PATH

# Add platform-tools folder to your system PATH, then verify:
adb version

3๏ธโƒฃ Start OCR Server

uv run core/ocr.py

4๏ธโƒฃ Configure Accounts & Launch

Follow the same steps as Linux โ€” Step 5 and Step 6 above.

Performance note: Without V4L2 streaming, screen capture uses ADB screencap which is significantly slower. For best results, use Linux or WSL2.


๐Ÿ—‚๏ธ Task Scheduling

Task scheduling uses an interactive selector at startup.

When you run python Main/main.py, the bot opens a menu from Main/task_menu.py. You can select tasks by:

Input Method Example
Number 1,3,6
Task key vip,mail,heal
Task title VIP Rewards, Mail Rewards

Press Enter (or type all / default / *) to run the full default task list.

Default Task List (in order)

# Task
1 VIP Rewards
2 Exploration Idle Income
3 Continue Exploring
4 Mail Rewards
5 Life Essence
6 Train Troops
7 Arena
8 Chief Order
9 Ally Treasure
10 Pet Exploration
11 Labyrinth
12 Alliance Auto Join
13 Alliance Chests
14 Alliance Tech
15 Alliance Help
16 Alliance Triumph
17 Heal
18 World Gather
19 Missions Reward

Notes:

  • Tasks run in the exact order shown unless you provide a custom subset.
  • Invalid selections are rejected and the menu is re-shown.
  • Completion is tracked per player in db/completion_log.txt.
  • Players completed within the 3-hour skip window are automatically skipped.

๐Ÿ› ๏ธ Features & Use Cases

๐ŸŒ World Operations

  • Gathering โ€” Intelligent resource search (Meat/Wood/Coal/Iron) with troop equalization and recall logic
  • Healing โ€” Auto-heal wounded troops with optimal item usage

๐Ÿฐ Alliance Management

  • Tech Contribution โ€” Contribute to tech trees automatically
  • Help Members โ€” Provide help to alliance members in need
  • Chests โ€” Collect alliance chests on cooldown
  • Rallies โ€” Auto-join war rallies and contribute
  • Triumph Collection โ€” Harvest alliance triumph rewards

โš”๏ธ Combat & Exploration

  • Arena Battles โ€” Daily automated arena fights
  • Labyrinth Runs โ€” Complete labyrinth dungeons
  • Intel Missions โ€” Auto-complete Beast hunts, Survivor rescues, Exploration intel

๐ŸŽ–๏ธ Growth & Progression

  • Troop Training โ€” Auto-train Infantry, Lancers, and Marksmen
  • Pet Exploration โ€” Auto-start pet expeditions and claim rewards
  • Chief Order โ€” Activate and track chief order progression

๐Ÿ’ฐ Rewards

  • VIP Rewards โ€” Collect daily VIP bonuses and auto-buy VIP time when profitable
  • Mail โ€” Auto-collect all mail rewards
  • Missions โ€” Collect mission rewards
  • Life Essence โ€” Harvest life essence drops
  • Events โ€” Collect event-specific rewards

๐Ÿ“ Project Structure

wos/
โ”œโ”€โ”€ Main/
โ”‚   โ”œโ”€โ”€ main.py                 # Entry point, account loop, and task execution
โ”‚   โ””โ”€โ”€ task_menu.py            # Interactive task selection and task registry
โ”œโ”€โ”€ core/
โ”‚   โ”œโ”€โ”€ ocr.py                  # FastAPI OCR server
โ”‚   โ”œโ”€โ”€ core.py                 # Vision engine (template matching, OCR)
โ”‚   โ”œโ”€โ”€ change_player.py        # Account/character switching
โ”‚   โ”œโ”€โ”€ recalibrate.py          # Auto-calibration tools
โ”‚   โ””โ”€โ”€ backup/                 # Legacy versions
โ”œโ”€โ”€ cmd_program/
โ”‚   โ”œโ”€โ”€ screen_action.py        # ADB touch/swipe actions
โ”‚   โ”œโ”€โ”€ screen_stream.py        # scrcpy streaming setup
โ”‚   โ””โ”€โ”€ scrcpy_config.json      # Stream configuration
โ”œโ”€โ”€ usecases/                   # Feature modules
โ”‚   โ”œโ”€โ”€ gather.py               # Resource gathering
โ”‚   โ”œโ”€โ”€ alliance.py             # Alliance tasks
โ”‚   โ”œโ”€โ”€ arena.py                # Arena battles
โ”‚   โ”œโ”€โ”€ exploration.py          # Exploration intel
โ”‚   โ”œโ”€โ”€ labyrinth.py            # Labyrinth runs
โ”‚   โ”œโ”€โ”€ pet.py                  # Pet mechanics
โ”‚   โ””โ”€โ”€ [other features].py
โ”œโ”€โ”€ db/
โ”‚   โ”œโ”€โ”€ account.json            # โš ๏ธ Account/player config โ€” NEVER commit this
โ”‚   โ”œโ”€โ”€ account.json.example    # Safe template โ€” commit this
โ”‚   โ”œโ”€โ”€ completion_log.txt      # Daily task completion tracking
โ”‚   โ””โ”€โ”€ players/                # Per-player data
โ”œโ”€โ”€ references/
โ”‚   โ”œโ”€โ”€ icon/                   # PNG templates for icon matching
โ”‚   โ”‚   โ”œโ”€โ”€ alliance/
โ”‚   โ”‚   โ”œโ”€โ”€ arena/
โ”‚   โ”‚   โ””โ”€โ”€ [other categories]/
โ”‚   โ””โ”€โ”€ TextArea/               # JSON ROI definitions
โ”‚       โ”œโ”€โ”€ Home.json
โ”‚       โ”œโ”€โ”€ Home.Alliance.json
โ”‚       โ””โ”€โ”€ [all screen definitions].json
โ””โ”€โ”€ test/                       # Debug & testing utilities

โš™๏ธ Configuration

account.json

The main configuration file for accounts and players. Located at db/account.json.

{
  "email@example.com": {
    "priority": 1,
    "player": [
      {
        "id": "12345678",
        "name": "ChiefName"
      }
    ]
  },
  "second_account@example.com": {
    "priority": 2,
    "player": [
      {
        "id": "87654321",
        "name": "AnotherChief"
      }
    ]
  }
}

Multiple accounts are supported. Set priority values to control execution order.

scrcpy_config.json

Controls the screen mirroring stream. Located at cmd_program/scrcpy_config.json. Adjust bitrate, resolution, and device serial here if needed.


๐Ÿ” Security

Your db/account.json contains sensitive account credentials. Protect it.

Make sure your .gitignore includes:

db/account.json
db/players/
db/completion_log.txt

Never share your account.json publicly or commit it to any repository. Use db/account.json.example as a safe template for sharing.


๐Ÿ–ฅ๏ธ Linux vs Windows Support

Feature Linux Windows
ADB Support โœ… โœ…
Standard Screencap โœ… โœ…
High-Speed Scrcpy Stream โœ… Native โŒ Requires WSL2 + v4l2
V4L2 Direct Streaming โœ… Native โŒ Not Available
Performance ๐Ÿš€ Ultra Fast ๐Ÿข Standard
Setup Complexity โญ Straightforward โญโญ Extra steps needed

Recommended: Linux (full native support) Fallback: Windows with ADB only (slower but functional)


๐Ÿ› ๏ธ Troubleshooting

OCR Server Won't Start

Error: ModuleNotFoundError or port already in use

# Check if port 8000 is occupied
lsof -i :8000

# Kill the existing process
kill -9 <PID>

# Reinstall dependencies and retry
cd ~/wos
uv sync
uv run core/ocr.py

Bot Clicks in Wrong Locations

Cause: Resolution mismatch โ€” bot is hardcoded for 1080ร—2460

# Verify your device resolution
adb shell wm size

# Expected output:
# Physical size: 1080x2460

If your resolution differs, the Auto-Calibration Suite is in development. In the meantime, manually update ROI coordinates in references/TextArea/ (advanced).

ADB Connection Issues

# Restart ADB daemon
adb kill-server
adb start-server

# List connected devices
adb devices

# If device shows as unauthorized, re-accept the prompt on your device

V4L2 Loopback Not Detected

# Check if the module is loaded
lsmod | grep v4l2loopback

# Reinstall and reload if missing
sudo dkms remove v4l2loopback/0.12.7 --all
sudo pacman -S v4l2loopback-dkms

sudo modprobe -r v4l2loopback
sudo modprobe v4l2loopback video_nr=10 card_label="scrcpy" exclusive_caps=1

PaddleOCR Installation Fails

PaddleOCR requires Python 3.10+. Verify your version:

python --version
# Should be 3.10 or higher

If using uv, ensure your venv uses the right Python:

uv venv --python 3.10
uv sync

๐Ÿš€ Roadmap

Phase 1 โ€” Current

  • โœ… Core daily task automation
  • โœ… Multi-account support
  • โœ… Interactive task selector
  • โณ Auto-calibration suite
  • โณ Windows setup guide

Phase 2 โ€” Planned

  • ๐Ÿ“‹ Advanced FSM navigation (Dijkstra-based pathfinding)
  • ๐Ÿ“‹ Event-specific strategies (Tundra Adventure, Sunfire Castle)
  • ๐Ÿ“‹ Enhanced anti-detection (human-like click patterns)

Phase 3 โ€” Future

  • ๐Ÿ”ฎ Multi-device simultaneous control
  • ๐Ÿ”ฎ Web dashboard for monitoring
  • ๐Ÿ”ฎ Community script marketplace

๐Ÿ“ฆ Dependencies

Core Requirements:

  • Python 3.10+
  • OpenCV (cv2)
  • PaddleOCR
  • FastAPI & Uvicorn
  • RapidFuzz
  • Requests
  • Rich (CLI output)

See pyproject.toml for the full pinned dependency list.


๐Ÿค Contributing

Contributions are welcome! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature-name
  3. Make your changes and test thoroughly
  4. Submit a Pull Request with a clear description of what you changed and why

Code Guidelines

  • Follow PEP 8 style guidelines
  • Add docstrings to all new functions
  • Test with multiple accounts where applicable
  • Document any new game screen modules in references/TextArea/
  • Never commit db/account.json

๐Ÿ“ Changelog

v0.2.0 โ€” Current (Active Development)

  • Added interactive task selector (Main/task_menu.py)
  • Added per-player completion tracking with 3-hour skip window
  • Added multi-account priority ordering
  • Improved OCR fuzzy matching accuracy

v0.1.0 โ€” Initial Release

  • Core daily task automation
  • FastAPI OCR server
  • ADB screen capture and touch actions
  • Linux V4L2 high-speed streaming support
  • Multi-account support

๐Ÿ“„ License & Disclaimer

License

This project is released under the MIT License. See the LICENSE file for details.

โš ๏ธ Disclaimer

Use this bot at your own risk.

This project is for educational purposes only. Using automation tools may violate the Terms of Service of Whiteout Survival. The authors are not responsible for:

  • Account suspension or bans
  • In-game penalties
  • Loss of progress or items
  • Any violation of game terms

Always read the game's ToS before using automation tools.


๐Ÿ“ž Support


Made with โ„๏ธ by the WOS Bot community

โญ Star this repo if you find it useful!

About

Multi-account game automation bot for Whiteout Survival with task scheduling, character rotation, and OCR-based screen interaction.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages