How focus-creative-games/luban works
Based on your project file tree and README, Luban is a highly modular game configuration solution that “generates” configuration assets and code based on various source data formats. It is not a traditional full-stack app but rather a code generation tool with a robust pipeline design that processes raw configuration data (from Excel, JSON, XML, YAML, Lua, etc.) and outputs configuration data in binary, JSON, BSON, and many other formats. It also generates code for multiple target languages (C#, C++, Java, Go, Dart, Python, TypeScript, Rust, PHP, etc.) using a templated approach.
Main Components
• Core Pipeline & Engine (Luban.Core): This is the heart of the generation system where the overall pipeline manages the flow.
• Data Loading & Parsing (DataLoader packages): Includes modules like Luban.DataLoader.Builtin and various raw definition loaders in Luban.Core/RawDefs and Luban.Schema.Builtin.
• Data Validation (DataValidator packages): Modules under Luban.DataValidator.Builtin that check ref integrity, path validations, range checks, etc.
• Schema/Definition Management: Components for loading and interpreting configurations (schema loader in Luban.Core/Schema, Def, and RawDefs).
• Code Generation Targets (CodeTarget modules): Language-specific modules such as Luban.CSharp, Luban.Cpp, Luban.Dart, Luban.Java, etc. Each language module contains both “CodeTarget” implementations (often found under CodeTarget folders) and template extensions for generating source code.
• Template Engine & Extensions: All the TemplateExtensions and Templates folders across modules, together with the Template Manager in Luban.Core/Tmpl, enable customization and extension.
• Data Output & Saving: Managed by the “OutputSaver” modules in Luban.Core/OutputSaver that abstract writing the generated code/data to files.
• Utility & Common Services: Includes a set of utility classes (under Luban.Core/Utils), custom behaviours, L10N support, type visitors, and other helper components.
• Pipeline Orchestration: The Pipeline folder in Luban.Core outlines the staged generation process with IPipeline and related managers.
Relationships and Interactions
• Next, the parsed data moves into the Schema/Definition Manager where it is structured as Beans, Enums, Tables, etc.
• Afterwards, the data is passed through Data Validator components that verify correctness.
• Then it enters the Core Generation Pipeline where the processing is orchestrated. Here, various “TypeVisitors” run to transform or inspect the definitions.
• From the pipeline, the flow branches into code generation via the CodeTarget modules. Each language-specific module (for C#, C++, Dart, Java, etc.) relies on its templates and template extensions to generate code.
• Finally, the generated outputs are handed to the OutputSaver modules that write files to disk.
• Additionally, plugin or custom behaviour modules can hook into various stages (as shown in CustomBehaviour folders) to customize the generation flow.
Architectural Patterns & Design Principles
• Modularity & Plugin Architecture: The system is divided into numerous independent modules (by language, data handling, validation, etc.), allowing easy extension. Emphasize the “plug-and-play” nature.
• Pipeline/Flow-based Processing: Highlight that the processing is conducted in defined stages (loading, validating, transforming, generating, saving), with each stage represented as a discrete component.
• Template Driven Code Generation: Stress the separation between the static template definitions (in Templates folders) and dynamic code generation logic (in CodeTarget and TemplateExtensions).
Relevant Technologies and Technologies
• That many directories contain .csproj files, indicating a .NET-based development environment for the core and most language support packages.
• That the system relies on configuration files (e.g., .editorconfig, .travis.yml, nlog.xml) to support building, formatting, and logging.