Modern web application for real-time 🎮 game state analysis and 🖼️ image processing.
Booki takes periodic images from your display and runs them through high-performance OCR processors, cleaning noisy data and predicting in-game probabilities in real time using Bayesian and frequentist approaches. ♟️
Important
This proof of concept will no longer be maintained when a minimum viable product is reached, a polished version will be pursued
- 🚀 Real-Time OCR Image Processing:
- Extract and process data from game screenshots in real time using Tesseract.js.
- Configurable game models using JSON schemas for maximum adaptability.
- ⚙️ Configuration-Driven Design:
- Modular, schema-first architecture with loosely coupled systems.
- Define new game rules with minimal effort and maximum flexibility.
- 🎨 Tailored Frontend Integration:
- Highly dynamic React-based UI.
- Effortless navigation using declarative routes powered by
react-router-dom.
- Scalable Express API for serving OCR results and game logic.
- CPU-intensive tasks are optimized with worker threads 🛠️ for better performance.
- Plug-and-play handler system for game-specific logic implementation.
- Real-time data visualization 🖼️ via the
/feedendpoint. - Fully customizable game state views styled with 🌀 TailwindCSS.
- Interfaces for data corrections, validation, and export options.
- 🟦 Node.js (16.x or later)
- 📦 pnpm (Install globally:
npm install -g pnpm)
- Clone the repository:
git clone git@github.com:trentonyo/booki.git
- Move into the project directory:
cd booki - Install all dependencies:
pnpm install
Warning
This proof-of-concept version requires manually rebuilding after changes, there's no hot reload
-
🖥️ Run the Project:
- Development Mode:
pnpm run build pnpm run dev
- Production:
pnpm run build pnpm start
- Development Mode:
-
Open your browser and navigate to:
🌐http://localhost:3000
| Task | Command |
|---|---|
| Frontend Build | pnpm run build:react |
| Backend Build | pnpm run build:server |
| CSS Build | pnpm run build:tailwind |
| Complete Build | pnpm run build |
| Development (React) | pnpm run start:react |
| Development (Backend) | pnpm run dev |
| Start Production | pnpm start |
- 📂
src/: Main TypeScript/React files for both frontend and backend logic.- Frontend Entry:
src/index.tsx - Backend Entry:
src/server.ts
- Frontend Entry:
- 📂
public/: Static assets including game state schema JSONs. - 📂
dist/: Compiled and bundled files after runningpnpm run build.
tsconfig.json: TypeScript compiler setup.tailwind.config.js: Tailwind theme and configuration.- Webpack:
webpack.config.js(Frontend)webpack.server.config.js(Backend)
- Drop a JSON file into
public/stateModelsthat outlines the game rules and required inputs. - Example:
{ "constraints": { "width": 1920, "height": 1080, "refreshInterval": 30 }, "gameState": [ {"id": "score", "type": "ocr"}, {"id": "timer", "type": "ocr"} ] }
- Create a new handler in
scripts/stateHandlers/that maps raw OCR data into processed game logic. - Example:
export default function handleProcessedGameState(processedGameState: any): any { // Custom logic to enhance and refine the input data return processedGameState; }
- Build a React component for visualization using TailwindCSS under
scripts/stateHandlers/. - Define its UI for showing timer, score, or predictions.
- Add the schema and handler into the backend:
- Register the schema in
server.ts:const gameStateModels = { "my_game": require("../public/stateModels/my_game.json"), };
- Register the schema in
- OCR results are cleaned through:
- Character masks (predefined OCR rules).
- Regular expressions in the game state model.
- Custom handler logic designed for the specific game.
- Not yet. All game schemas and handlers must be manually registered.
- TailwindCSS is recommended for consistency, but custom styles are allowed as long as they are maintained by the contributor.
For more FAQs, refer to FAQ.md.
- OCR Performance: CPU-intensive operations may slow down on lower spec machines. Cloud-based OCR services could mitigate this bottleneck in the future.
- Testing: CI/CD pipelines and Jest-based tests are not yet implemented.
- Schema Validation: Only enforced via TypeScript during runtime. Stronger validation tools are planned.
We welcome your contributions! 🚀
Follow our Issue Template if you'd like to submit a new game configuration.
- Fork this repository.
- Clone your forked repo:
git clone git@github.com:<your-username>/booki.git
- Create a new feature branch:
git checkout -b my-new-feature
- 👩💻 Write your code (and don't break anything... please).
- Submit a PR with a clear explanation of your changes.
All rights reserved, Trenton Young 2024.
🌟 We hope Booki helps empower your gaming experience with cutting-edge analysis tools. Let the wins come rolling in! 🏆 🎮