I had a chat with Kailric about the ability to hardcode xml values in the dll. After that I have been wondering about how to improve the idea to counter all the issues we can predict it might result in. I came up with this:
At compiletime, we either set or not set a flag. Let's call it XML_HARDCODE for now.
When XML_HARDCODE is enabled, the compiler should include whatever it can from xml if it results in increased performance. It's fast, but it requires a recompiled dll if certain xml values are altered.
When XML_HARDCODE is disabled, we should not aim for using the current code. Instead we should reduce hardcoding as much as possible. Ideally any xml can be changed without using a new DLL, including yields. This will allow compiling a single DLL file, which should work on any submod. This will be slower than the current code, but it is a modding DLL, not a player DLL, meaning it is an intended tradeoff.
I'm not sure when to use one system or the other. Perhaps we should set it to follow asserts unless manually specified otherwise. Alternatively we could gain a new xml modder target, which would provide a non-hardcoded optimized dll with asserts enabled (ideal for xml modders).
Kailric's greatest concern appears to be people downloading a release where they start to mod without reading a readme telling them not to. That will cause problems in any colo mod if you touch the wrong xml file. Still we can improve on that as well. I'm thinking of adding a new kind of assert. One, which is only active when xml data is hardcoded and it will bring up an error window if the check fails even if asserts are disabled. Any hardcoded data will then have to be verified through this system, meaning it should not be possible to be hit by hardcoding without being told. People changing xml data should use assert dlls anyway.
I think the best implementation plan would be to postpone this to after next release. It can then be a branch based on the release, meaning once it works, it can be used to produce a dll compatible with xml files from the release. This mean it will be quite useful as soon as the hardcoding of yields is optional.
There is some hardcoding, which should stay hardcoding. AI commands for instance is so integrated into the dll that it wouldn't make sense to change it. I'm not sure about domains though if the mods can't agree on the number. Time will tell if that one turns into a problem.
That is my idea for a concept for now. It's not a promise to code it or anything because first step is that we should agree on the concept
