Idea: Supporting multiple DLL modifications

primem0ver

Emperor
Joined
Jun 16, 2006
Messages
1,158
Location
Peoria, AZ
I don't know if this has been attempted previously but my desire for a few DLL mods and the fact that they cannot be used the same way regular mods can be has got me thinking.

I am going to get a bit technical so please forgive me if you are not a programmer.

Since I am new to Civ V I could be stepping in where I don't have enough experience so please remember I am just posting my thoughts for comment to see if this idea is feasible.

I believe it would be possible to make most DLL modifications modular so that they can be loaded independently. I welcome feedback if anyone has an opinion. All that would be necessary is to create a standard for initialization/implementation, a "delegate" system, a priority queue, and a list of standard "events" or locations in the DLL code where delegates should be relied upon (a list of functions and places in the function where they should exist).

C++ does not have a standard for delegates but a delegate system could be created using C++. For those of you not familiar with what a delegate is (specifically a multi-cast delegate), it is an increasingly common form of managing callback functions that is seen in .NET programming, Qt programming, and possibly Java (I am not familiar with Java so I am guessing). A delegate is a structure that keeps track of a list of callback methods that are to be called when a specific event occurs.

Basically what would be needed to make DLL mods modular is a delegate system that is based on a priority queue (which allows mod developers and/or users to customize when a specific mod's "event" or "delegate" handler is called.)

Each callback has a standard set of arguments that mirror the parent function in which the delegate call is placed plus one extra argument that is a container for any custom data that the mod requires.

Each mod must have an instance of a pure virtual function that is defined in the "standard" core dll and instantiated in each mod. That function is called when the mod dll is loaded and lets the core know what delegates it will use and what priority its handlers should have in the callback queue as well as any other standard data that is needed for the system to work.

Those are my initial thoughts on creating support for multiple dll mods. Whether or not there is enough interest in doing something like this is another matter entirely.
 
Top Bottom