mxbmrp3

AI Development Context for MXBMRP3

Read This First

This is a racing simulator HUD plugin for Piboso racing games (MX Bikes, GP Bikes, WRS, KRP). It’s a DLL plugin written in C++ using each game’s proprietary API, with a shared core that works across all supported games.

For deep technical details: See ARCHITECTURE.md (comprehensive documentation with mermaid diagrams, component descriptions, dependency graphs, multi-game architecture). This file is a quick-start guide.

Quick Architecture

Game Engine (MX Bikes / GP Bikes / WRS / KRP)
    ↓ (callbacks via plugin API)
mxb_api.cpp / gpb_api.cpp (per-game DLL exports)
    ↓ (converts to unified types via adapters)
PluginManager (receives unified types only)
    ↓
PluginData (singleton - caches all game state)
    ↓ (notifies on data changes)
HudManager (singleton - owns all HUD instances)
    ↓
Individual HUDs (IdealLap, Standings, Map, etc.)
    ↓ (build render primitives)
Game Engine (renders quads/strings)

Key Singletons:

Multi-Game Support

The plugin supports multiple Piboso games from a single codebase:

Game Config Output Status
MX Bikes MXB-Release mxbmrp3.dlo ✅ Full support
GP Bikes GPB-Release mxbmrp3_gpb.dlo ✅ Core features
WRS - wrsmrp3.dlo ⏳ Stubbed
KRP - krpmrp3.dlo ⏳ Stubbed

Translation Layer:

Build & Test

⚠️ IMPORTANT - Build Environment:

⚠️ IMPORTANT - Shell Commands:

Build Instructions (Windows only):

Important Patterns & Constraints

Performance Target: 240fps

The plugin must run efficiently at 240fps (4.17ms frame budget). Many competitive players use high refresh rate monitors. Avoid per-frame allocations, unnecessary string operations, and complex calculations in hot paths like Draw() and RunTelemetry().

DO:

DON’T:

Design Decisions (Don’t “Fix” These)

Singletons Everywhere Required by plugin API - we get one global entry point, everything branches from there.

Lambdas in settings_hud.cpp rebuildRenderData() Intentional - they capture local layout state. Alternatives were worse (passing 8+ parameters).

Public member variables on HUDs (e.g., m_enabledRows) These are configuration data, not encapsulated state. SettingsHud needs direct access.

HUDs don’t cache raw game data HUDs pull fresh from PluginData on rebuild - they only cache formatted render data (m_displayEntries, m_quads, m_strings). This enforces PluginData as single source of truth and prevents synchronization issues.

Widget vs HUD Distinction Widgets (TimeWidget, PositionWidget, LapWidget, SpeedWidget, SpeedoWidget, TachoWidget, BarsWidget, LeanWidget, NoticesWidget, VersionWidget, SettingsButtonWidget) are simplified HUD components with:

Full HUDs (StandingsHud, LapLogHud, PitboardHud, TimingHud, etc.) have:

Handler-to-API Event Mapping Each handler corresponds to game API callback(s), but receives unified types:

No unit tests Requires game engine to run. Manual testing in-game is current workflow.

Common Tasks

Adding a New HUD

  1. Create class inheriting from BaseHud (.h and .cpp files in mxbmrp3/hud/)
  2. Add files to Visual Studio project:
    • mxbmrp3/mxbmrp3.vcxproj - Add <ClInclude> for .h and <ClCompile> for .cpp
    • mxbmrp3/mxbmrp3.vcxproj.filters - Add filter entries to place files in Header Files\hud and Source Files\hud
    • Without these entries, the build will fail with linker errors (LNK2019 unresolved externals)
  3. Implement rebuildRenderData() - builds vectors of quads/strings
  4. Register in HudManager constructor (add pointer, getter, initialize in initialize(), null in clear())
  5. Add tab in SettingsHud for configuration
  6. Add save/load in SettingsManager

Debugging Rendering Issues

Working with Game API Events

When implementing event handlers or debugging timing/lap data:

Adding Support for a New Game Feature

  1. Add field to appropriate Unified:: struct in game/unified_types.h
  2. Add conversion in each adapter (game/adapters/*_adapter.h)
  3. Add feature flag to game/game_config.h if game-specific
  4. Update handlers/HUDs to use the new field

Files You’ll Likely Need

Core:

Multi-Game Layer:

HUD Base:

Example HUDs:

Settings:


Git & Development Workflow

Commit Message Conventions

Branch Naming

Version Management

Development Style