[crossfire] Events, plugins rework

Nicolas Weeger nicolas.weeger at laposte.net
Mon Dec 28 13:32:54 CST 2020


Hello.


I was thinking of reworking the events system, as well as the plugin one.


Currently, "events", events linked to specific objects (through the archetype 
in inventory trick) and global events (clock, map loading and such) are in the 
plugin system.


I'd like to move the event system to the common library, independently of the 
plugins.



Then I'd like to change the current plugins (especially the Python one) to be 
"modules", that is "code that may conditionally be compiled [if requirements 
are met], is statically linked to the server, and may be enabled/disabled at 
startup or during the server run".

Basically, like the current plugins, but not as a dynamic library.


My rationale is that having such a dynamic system is overkill for eg Python, 
and adds some overhead (as well as code complexity). Was there a real use case 
for unloading the Python plugin, changing it, and reloading?

[note: with the Python3 migration, it seems our modules imported through 
"import" in the Python code aren't updated when the .py file changes, that is 
if CFDialog.py is updated, changes don't seem to be taken into account. This 
is why enabling/disabling modules seems a good idea too. Of course that bug(?) 
can probably be fixed :)]


I intend "modules" to only consist of a few pre-init, post-init and such 
functions, with the rule that no other module function is to be called 
directly outside a plugin. Basically, like the "quests" or "knowledge" code, 
replacing direct function calls to use events.


I don't plan to remove the plugin system per se, but move plugins to modules, 
and leave the plugin system as-is, without any actual plugin.



And I intend to use C++ for that, too, you've been warned :)


Best regards


Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
URL: <http://mailman.metalforge.org/pipermail/crossfire/attachments/20201228/47283b2f/attachment.sig>


More information about the crossfire mailing list