How mrmystery-official/starlight-dev works
Project type and purpose
• AINB Editor (visual node-based AI behavior editor)
• Editor (scene/actor placement and manipulation)
• Actor Editor (basic actor creation/customization)
• It uses OpenGL for rendering, ImGui for the UI, and a collection of bundled third-party libraries for math, BVH construction, navigation mesh generation, file dialogs, and asset formats.
File structure
• Top level:
• MapEditor.sln + Main.cpp → entry point
• MapEditor/… .cpp/.h → core modules organized by feature (ActorMgr, SceneMgr/Creator/Exporter, NavMeshGenerator, Asset readers/writers, UI classes)
• MapEditor/Assets → built-in models, shaders, fonts, textures used at runtime
• MapEditor/Libraries → bundled external libraries (GLFW, Glad, GLM, stb, zstd)
• MapEditor/imgui + imgui_node_editor + imgui_gizmo → GUI frameworks/extensions
• MapEditor/recastnavigation, bvh, meshDecimation → navigation and acceleration-structure engines
• No separate “frontend” vs. “backend” directories—this is a single C++ codebase, but it naturally separates into layers:
Extract README insights
• Describes user workflows (point & click configuration of RomFS and model dumps, then restart with proper paths).
Main components
A. UI Layer
• ImGui core + extensions (node editor, gizmo)
• PopupMgr + UI*.cpp classes handle user interactions
B. Core Application & Editor Logic
• Editor (Editor.cpp/h) orchestrates sub-tools
• SceneMgr / SceneCreator / SceneExporter
• ActorMgr / AssetManagers (TextureMgr, ShaderMgr, BufferObject, etc.)
• NavMeshGenerator + BVHBuilder for pathfinding geometry
• BinaryVectorReader/Writer, Bfres, EXB, MSBT, SARC, RESTBL modules parse and write game formats
• PhiveWrapper, PhiveMaterialData, PhiveNavMesh for physics integration
C. Rendering & Graphics
• GLFW window + input
• Glad + OpenGL calls via BufferObject / VAO / VBO / FramebufferMgr
• Shaders loaded from Assets/Shaders
D. Third-Party Libraries
• Math & linear algebra: GLM
• Compression: zstd
• Image loading/writing: stb_image, stb_image_write
• Navigation: recastnavigation (Recast + Detour)
• BVH: custom bvh folder
• Mesh decimation: meshDecimation
• File dialogs: tinyfiledialogs
E. File System & External Data
• User-supplied RomFS dump, model dump folders
• Local “Assets” shipped with the app
• Config files (EditorConfig, PreferencesConfig, NodeEditor.json, imgui.ini)
Relationships & interactions
• UI → Core Editor Logic: User clicks menu or tools → PopupMgr/UI classes call Editor APIs
• Core Logic → Data Parsers: Editor invokes BinaryVectorReader, Bfres, MSBT, etc. to load or modify game data
• Core Logic → Asset Managers: AssetManagers prepare GPU resources from loaded data
• Asset Managers → Rendering: BufferObject/VAO/VBO push to GPU; ShaderMgr selects and binds shaders
• Core Logic → NavMeshGenerator/BVHBuilder → recastnavigation: For physics/navigation previews
• Core Logic → Exporter: Write modified scenes or AINB graphs back to game formats
• File System ↔ Data Parsers & Exporter: read/write files on disk
Architectural patterns & design principles
• Layered architecture:
• UI at the top
• Application logic in the middle (tool/controllers, scene graph)
• Rendering engine & data parsing at the bottom
• Modular feature components: each tool (AINB, Map, Actor) has its own “manager” classes and UI handlers
• Resource management: centralized managers for shaders, textures, buffers
• Use of dependency inversion: core modules depend on abstract data-reader interfaces (BinaryVectorReader) allowing new file formats to be pluggable
Detailed element checklist
• Which modules depend on which parsers or managers
• Main data flows (load, modify, render, export) with arrowheads
• ImGui-based UI components separately from core logic