How simulationcraft/simc works
Main Components
• Core Simulation Engine – This is found mostly in the “engine” directory. It includes modules such as the event manager (engine/sim/event_manager.cpp), simulation logic (engine/sim/*.cpp), cooldown, proc, and more. This component essentially drives the simulation of combat events.
• Data & DBC Modules – The “engine/dbc” directory (plus the generated subdirectories) handles parsing and managing game data (spells, items, talents, etc). SpellDataDump is also dedicated to dumping and processing “spell” data.
• Reporting and Output – The “engine/report” subdirectory contains modules responsible for creating charts, text, and JSON reports.
• External Interfaces – The “engine/interfaces” folder handles network and external communications (e.g. with Wowhead or HTTP APIs) as well as interfacing with Armory data.
• Administrative & Build Infrastructure – This includes directories like “cli”, “gui” (with Qt) for the user interfaces, the “tests” directory, various CI scripts and build configurations (CMakeLists.txt, GitHub workflows, and Visual Studio project files).
Their Relationships and Interactions
• The CLI and GUI components serve as the front-end, allowing the user to set up simulations and view reports.
• Once a simulation is initiated, the simulation controller (likely in engine/sim) triggers the event system and distributes tasks – this engine will query the DBC/Data subsystem for game parameters and constructs the “player” models.
• The simulation loop uses an event manager to process combat events (buffs, debuffs, cooldowns, APL actions, etc.) where the “player” module interacts with the “action priority list” files and class-specific modules in “engine/class_modules.”
• Reporting modules then take processed simulation data and generate outputs (graphs, text-based reports, JSON files).
• External libraries (RapidJSON, RapidXML, fmt, etc.) and network interfaces are integrated throughout to parse input, format output, and handle asynchronous data (via interfaces like sc_http).
Architectural Patterns and Key Design Principles
• Modular Design: The clear separation between simulation logic, player modeling, data ingestion, reporting, and interfaces allows independent modification and testing.
• Event-Driven Architecture: The engine drives the simulation through a series of events (e.g., time ticks, procs, cooldown events), where components communicate using callbacks (see engine/sim/event.hpp and related files).
• Platform Separation: There are distinct components for CLI vs. GUI (with Qt) and platform-specific release scripts (e.g., Dockerfile, Windows release scripts).
• Layered Architecture: With an underlying core simulation layer, a data/DBC layer for game mechanics, and a top presentation layer (CLI/GUI/reporting), the design follows layered architecture principles.