Excel Configuration Development
Game-design numeric configuration flows through the pipeline: Excel → xresloader → binary → generated config manager.
Steps
- Define the config proto: add a message in
com.struct.*.config.protoundersrc/server_frame/protocol/public/protocol/config/(or on the private side), and annotate thexrescode.loaderoptions (loader name, table name, indexes, etc.). - Edit the Excel and conversion configuration:
- Excel files go in
resource/ExcelTables/; - register the conversion rules for new tables in
resource/excel_xml/xresconv.xml.in.
- Excel files go in
- Declare generation rules: CMake (
generate_config_codes.cmake/ each service's CMakeLists) declares theconfig_manager/config_set/config_easy_apitemplates and custom field injection (custom_group_fields.h.mako,custom_config_*_include_fields.h.mako). - Write an index class (if fast lookup by key is needed): refer to
src/server_frame/config/src/excel_config_dtmq_index.cpp(dtmq'sDChannelConfigure). - Loading and hot-reload: at service startup,
excel_config_wrapper_reload_all(src/server_frame/config/src/excel_config_wrapper.cpp) loads data grouped by loader/version; after a reload is triggered, hot-reload callbacks are invoked grouped by version. - Reading: use the convenient generated
config_easy_apiinterfaces or reflective queries on the config manager.
Reference Example
dtmq channel type configuration: ExcelDtmqChannelType in com.struct.dtmq.config.proto
(channel_type / show_max_log_count / readonly_replicate_count) → resource/ExcelTables/DtMq.xlsx →
excel_config_dtmq_index.cpp.
Notes
- The conversion tool xresloader lives in
third_party/xresloader/and is invoked automatically by the build process; - Configuration reload and the YAML reload of
logic_configare two independent channels—do not confuse them; - On the deployment side, the Excel configuration path is specified in the
logic.excelsection of the instance configuration.