Raised This Month: $ Target: $400
 0% 

The Future of Zombie Plugins


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
rhelgeby
Veteran Member
Join Date: Oct 2008
Location: 0x4E6F72776179
Old 11-30-2014 , 17:48   Re: The Future of Zombie Plugins
Reply With Quote #20

I thought I should just give a quick update:

After hot-plug support was implemented, development stalled again due to a bug. The bug is an issue with OnLibraryAdded being called to early (not a bug in SourceMod, just a limitation in my implementation). It's called before a library plugin is initialized, and things breaks when the module try to use that uninitialized library.

That's one issue. There's another issue with boilerplate code required in a module to properly wait for all dependencies to be ready. This code may be duplicated between multiple modules, even for the same dependencies. So I decided to make a simple dependency manager.

Dependency Manager

The dependency manager is basically just a wrapper for OnLibraryAdded and OnLibraryRemoved, with some extra features that I need. I try to design this so it will work with these library events in SourceMod.

Modules need two events:
  • OnDependenciesReady - Triggered when all its dependencies are ready (not just loaded). In this event, modules should initialize.
  • OnDependenciesUnavailable - Triggered when one or more dependencies are no longer available, such as when a library plugin was unloaded. In this event, the module should disable itself and clean up resources.

Using these two events we make it possible to do hot-plugging of modules while reducing the burden of checking dependencies.

Modules use natives in the dependency manager to declare its dependencies, and then simply waits for the ready-event.

The dependency manager will also provide some natives for registering a library, with a name that matches the one sent to RegPluginLibrary. It will keep track of availability of all libraries and notify modules when all their dependencies are met.

To solve my first issue, the manager will provide natives for manually triggering the ready-event, so that modules won't receive OnDependenciesReady until all libraries are loaded and initialized.

The hot-plugging demo in my previous post works because the module manager doesn't need initialization. Once I started working on other modules, hot-plugging was broken. With the new dependency manager it should be back on track.

It's really cool to see the modules dynamically respond to the changes in the environment. The really tricky part is to make the code simple and elegant, but I'm on to something now.
__________________
Richard Helgeby

Zombie:Reloaded | PawnUnit | Object Library
(Please don't send private messages for support, they will be ignored. Use the forum.)

Last edited by rhelgeby; 11-30-2014 at 17:51.
rhelgeby is offline
Send a message via MSN to rhelgeby
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode