rlcevg / CircuitAI

Spring RTS local native AI
GNU General Public License v2.0
18 stars 19 forks source link

Feature: Merge configs #93

Closed GoogleFrog closed 5 years ago

GoogleFrog commented 5 years ago

I would be easier to maintain updates for multiple difficulty levels if circuit read every json file in /configs and merged the resulting table.

rlcevg commented 5 years ago

Note to myself: 1) remove easy and hard sections from json config and AIOptions.lua 2) add isCheating param into AIOptions.lua 3) read in alphabetical order all .json files from /configs into single in-memory config, with possible single param overrides and section additions.

rlcevg commented 5 years ago

There are no AI API to list files in directory. And reading filesystem with crossplatform support is not very interesting task for an AI (what's the current working directory?). It is easier to add text file into AI's data dir with specific name that contains a list of json files inside AI's data dir. Or even use AIOptions.lua as container for the list of json parts, that should allow per-startscript configuration.

rlcevg commented 5 years ago

https://github.com/rlcevg/CircuitAI/commit/31800727b94f1eabad73edd7f5cfe3287cf5c57b

AIOptions.lua
config_file=behaviour+block_map+build_chain+commander+economy+factory+response

Circuit will load behaviour.json, then block_map.json, then build_chain.json, etc., in order of appearance inside config_file param. And additional soft limitation on file names - it should conform to regex's "\w+" syntax, that is letter, digit or underscore.

rlcevg commented 5 years ago

available since 104.0.1-941-gfcc4751