50DKP / FF2-Official

Freak Fortress 2 is a one versus all mod for Team Fortress 2. It is the successor to the Vs. Saxton Hale plugin.
https://forums.alliedmods.net/forumdisplay.php?f=154
GNU General Public License v3.0
54 stars 27 forks source link

Invest into better subplugin controls. #108

Open WildCard65 opened 10 years ago

WildCard65 commented 10 years ago

Atm, it's NUTS! Subplugins have no way of telling FF2 they are modifying something that FF2 also modifies(see friagram's complaint about backstab system). Subplugins rely on SourceMod's loading system, limiting FF2's controls on how subplugins must function. Commands are only ran AFTER plugin related stuff is done (so if you do sm plugins unload freak_fortress_2.smx and you got a subplugin that has to take time to unload, and it's command issueing is at top of list, expect some time for all subplugins to unload, or, if FF2 has alot of things that could take 5 minutes to complete b4 fully unloading, then it'll be 5 minutes b4 the first subplugin finishes, add onto that with let's say, 20 subplugins taking 6 minutes to unload each, and you got to wait 125 minutes, 2 hours and 5 minutes, b4 your server is "unfrozen", ya, not good! So, for 2.0.0, I suggest that better subplugin system is a must have (See my FF2-Alpha repo, as I'm working on an extension for better subplugin control).

50Wliu commented 10 years ago

I've personally done ff2_reload_subplugins (or whatever the command is). No lag at all (and this isn't just using default subplugins). Added onto the fact that you should NEVER unload freak_fortress_2.smx.

WildCard65 commented 10 years ago

Yes, but still, if you don't unload freak_fortress_2.smx but still have like 20 subplugins taking like 7 minutes to unload, you can still expect close to 2 hours and 20 minutes to unload the subplugins after every round cause how SourceMod executes commands.
Here's rundown:
1) FF2 adds all commands to unload subplugins to list, and fires the commands.
2) Commands are put on hold till FF2 finishes it's execution of code.
3) FF2 finishes executing after round ended.
4) An unload command fires, it unloads a subplugin that'll need 7 minutes to finish execution.
5) 7 minutes pass, next command is executed.
6) Repeat 4 to 6 20 more times.

WildCard65 commented 10 years ago

Also note, this is how I plan ff2 to run in my FF2-Alpha repo:
1) FF2 fires the native FF2_UnloadSubplugins() after a round.
2) Extension's code is now executing.
3) Extension is looking through it's list of known subplugins to find ones to unload that are controlled by the round(s).
4) Extension finds/not finds subplugins.
5) If 4 is found some, it then checks if said plugin is loaded.
6) If found plugin is loaded, or if extension was told to force unload, it'll call the subplugin's forward(defined in ff2_extension.inc) for unload.
7) Subplugin's unload code is fired, hopefully at this point, another one is in parrallel execution or queued up for execution.
8) If it's queued up, it'll end up starting unload proccess after last one is done. Once all executions are done, round can continue.

50Wliu commented 10 years ago

2) Commands are put on hold till FF2 finishes it's execution of code.

Wat? Commands are executed immediately. You don't see !halehp taking 7 minutes to execute. Added to the fact that subplugins aren't disabled one-by-one; they're disabled together.

In addition, if there's a subplugin taking that long to unload, then there's a problem.

WildCard65 commented 10 years ago

no, plugin executed commands like what ff2 does to control subplugins:
InsertServerCommand("", );
ServerExecute();
if a command was inserted through a plugin but then fired, BUT plugin has more code to execute, the command will be put on hold till calling plugin is done.