Skip to content

Module Solver: OCR text not converting to module data #27

@caaatto

Description

@caaatto

Bug Report

Description

The Module Solver's OCR feature successfully reads text from the game window, but the text is not being properly converted into module data that the solver can use. The OCR extracts the text correctly, but the parsing step fails to convert it into ModuleInfo objects.

Expected Behavior

  1. User starts OCR capture
  2. OCR reads module information from game screen
  3. Text is parsed and converted to ModuleInfo objects with:
    • Module name (e.g., "Excellent Attack Module")
    • Quality/rarity level
    • Module category (Attack/Defense/Support)
    • Module attributes (e.g., "Strength Boost+5", "Agility+3")
  4. Modules appear in the solver's module list
  5. User can analyze and optimize module combinations

Current Behavior

  • OCR successfully captures screenshots
  • OCR extracts text from screenshots (visible in debug logs)
  • Text parsing fails to create ModuleInfo objects
  • No modules are added to the solver list
  • Solver has no data to work with

Possible Causes

The parsing failure could be due to:

  1. Attribute name mismatches: OCR text doesn't match the attribute mappings in NormalizeAttributeToGameFormat()
  2. Module type detection failing: Regex pattern for "Attack/Defense/Support Module" not matching OCR output
  3. Quality/rarity detection issues: Patterns like "Excellent", "Superior", etc. not being found
  4. Regex pattern issues: Attribute value patterns (e.g., "Strength+5") not matching the actual OCR text format
  5. Language/localization issues: OCR might be reading non-English text

Steps to Reproduce

  1. Open BlueMeter and navigate to Module Solver
  2. Click "Start OCR" button
  3. Open module details screen in game
  4. Wait for OCR to capture
  5. Click "Stop OCR"
  6. Observe that no modules are added to the list (or very few modules captured)
  7. Check debug logs to see OCR text was extracted but parsing failed

Files Involved

  • BlueMeter.WPF/Services/ModuleSolver/ModuleOCRCaptureService.cs - OCR capture and parsing logic
    • Line 399-533: ParseModuleFromText() method
    • Line 535+: NormalizeAttributeToGameFormat() method
  • BlueMeter.WPF/Services/ModuleSolver/ModuleConstants.cs - Attribute ID and name mappings

Debug Information Available

The OCR service saves debug files to help diagnose issues:

  • Screenshots: ModuleOCR_debug_*.png
  • OCR text output: ModuleOCR_text_*.txt
  • Debug log: ModuleOCR_debug.log

These files show what text OCR is reading, which helps identify why parsing is failing.

Investigation Needed

  1. Review debug logs to see actual OCR text output
  2. Compare OCR text format with regex patterns in ParseModuleFromText()
  3. Check if attribute names in OCR text match the mappings in NormalizeAttributeToGameFormat()
  4. Test with different module types (Attack/Defense/Support)
  5. Test with different quality levels (Common/Rare/Excellent/etc.)
  6. Check if game language affects OCR text format
  7. Verify regex patterns handle various text formatting (spacing, capitalization, etc.)

Potential Solutions

  1. Update regex patterns to be more flexible/tolerant of OCR variations
  2. Add more attribute name aliases to NormalizeAttributeToGameFormat()
  3. Improve text preprocessing (cleaning, normalization)
  4. Add fuzzy matching for attribute names
  5. Support multiple languages/localizations
  6. Add better error logging to show exactly which parsing step is failing

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcriticalSomething like crashes or unusability

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions