I remember a time when the goal was to get the yields into xml, rather than being hardcoded into the .dll.
It is a goal to place all yield stuff in XML. However there are performance issues and a stupid AI and it is rather time consuming not to break either. This mean we are stuck with mod specific DLLs for quite a while.
I still wonder if it is a good idea to have one DLL file for each mod or if it makes sense to hardcode mod specific data for performance reasons. The more I think about it, the less I like the idea of not being able to hardcode anything.
Even if we stick to the hardcoded yields path, it should be simplified. Currently adding a yield means adding it to 3 header files and 3 XML files (yield, unit and unit class). I would like to reduce this to ideally 1 enum and the yield XML and then autogenerate the rest based on this. However I will not do that right now as it can't be done in a single day.
I would guess other things that would currently be an issue moving forward, are M:C content that is Hardcoded, and needs to become XML Core, that could still break things for other mods?
There is a compile flag called MEDIEVAL_CONQUEST. M:C defines this in the yield header (since it's mod specific, not that it's a logical location). This flag enables compilation of additional DLL features, such as feast, which has hardcoded costs (using M:C yields). Any mod not defining this flag can work without M:C yields, but at the same time feasts will not be available.
I think this flag should take care of all issues. It's not pretty code, but it saved many hours of code fixing to just disable code this way. Nothing important is disabled.
One thing I have been wondering about (which kills the one DLL for all idea) is to make a bunch of flags modders can turn on and off.
Say for instance col2071 needs a space domain. The mod specific header can then contain
Unit movement and pathfinding (some of the slowest code in the game) will then be hardcoded to figure out how to handle space and can be optimized to handle it as fast as possible. Mods not using a space domain will simply not define the flag and then the compiler will not compile code to support this domain, which will be even faster at runtime. Regardless of the mod using space or not, all mods will slow down by checking domain stuff from XML.
The DLL file, which should fit all mods would have to be completely clean of mod specific code. If we hardcode unit movement (which we likely should), then it makes little sense to try to completely avoid hardcoding yields. Instead it would make sense to split the defined flags into specific features to allow mods to turn features on individually without actually touching the shared code, like using a flag called USE_COMMAND_FEAST without getting the entire MEDIEVAL_CONQUEST package.
I'm still not sure what to do and until I have figured it out, I'm not working towards either direction.