Thread Tools Display Modes
11-27-08, 09:14 AM   #1
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
How to subdivide a large addon?

i am the author/maintainer of the Aloft nameplate addon (http://www.wowinterface.com/download...o.php?id=10864).

some time back, my users asked if there was a way to slice Aloft up into a suite of separate addons that they could then selectively disable (and recover runtime memory in the process).

so, for the past 10 days or so, i have been trying to accomodate that. i am up to about 15 separate addons in the Aloft suite (the parent addon, and 14 children, each with its own specific job to do). it looks like i will end up with about 25-30 such addons by the time i am done.

now my users are complaining about "too many modules" .

one of them suggested looking at BigWigs, claiming that it offered some sort of "after-market" mechanism for bundling "plugins" together into a single directory, or separating them into individual addons, at the user's discretion. but in looking at the most recent version of BigWigs, it looks like a plain old modular addon to me (several folders, one per addon, each with a TOC and LUA, the embeds bundled with the "parent", tied together with dependencies specified in the TOCs). no batch file tooling in sight.

as an alternative, i could offer each of my modules as a separately versioned/released artifact, but combined with the lack of a viable automated updater (WAU is dead, i am a Vista user and manual intervention is required for use of the WoWInterface updater, and the Curse updater has never worked for me), this could result in quite a burden on the user (worse than just a delete/copy/paste on a set of 30 folders).

i want to be able to manage a set of 30 very closely related addons, such that they can be released/distributed in a single archive, operated on as file-system artifacts as a group (even if some custom "batch file" tooling is required), but still allow the user to enable/disable them as separate WoW addons. i would like to be able to do this without having to get into binary installers and the like (i have always felt that that is what WAU and similar applications are for, but we don't seem to have a viable one of those available at the moment).

can anyone suggest a solution? some addon out there that has solved this problem?

thanks.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
11-27-08, 03:00 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
I agree that having 30 separate addon modules in the addons directory is too many. But look at how Prat does it. Prat has its modules all bundled together, but they are still each LoD.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
11-27-08, 05:15 PM   #3
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
Originally Posted by Seerah View Post
I agree that having 30 separate addon modules in the addons directory is too many. But look at how Prat does it. Prat has its modules all bundled together, but they are still each LoD.
yes, thanks for the pointer. looks like that could do the trick. i will start dissecting it and see how much new code it will require.

can anyone suggest any other methods (i.e., besides the Prat approach)?
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
11-27-08, 06:03 PM   #4
Psoewish
A Scalebane Royal Guard
 
Psoewish's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 447
Originally Posted by acapela View Post
can anyone suggest any other methods (i.e., besides the Prat approach)?
Even if I would know another method, I wouldn't suggest it!
I personally love the Prat approach as it's the cleanest of them all imo, so I suggest you just go with that.

I hate it when an addon suddenly makes 20 folders in my addon directory
  Reply With Quote
11-28-08, 06:23 AM   #5
slizen
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 15
I don't know how Prat handles it's module system, but isn't it impossible to make a module LoD without giving it an own toc?
Doing it without it's own toc and folder the game would still have to load the file, and then decide whether to run it or not.
  Reply With Quote
11-28-08, 10:50 AM   #6
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
Originally Posted by slizen View Post
I don't know how Prat handles it's module system, but isn't it impossible to make a module LoD without giving it an own toc?
Doing it without it's own toc and folder the game would still have to load the file, and then decide whether to run it or not.
yeah, i am still going around with myself on this. i just don't have enough experience, i am afraid.

this LOD without separate TOC effect is what Prat apparently does. and indeed, playing with disabling modules using Prat, it looks like a substantial memory savings results. i am not clear whether this is data structure memory that is not being used, or if in fact the LUA itself is not being loaded when a module is disabled. i am still groping my way towards comprehension of this mechanism :-).

so, i just need to keep playing with it.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
11-28-08, 10:56 AM   #7
Taffu
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 149
SLDataText uses the Ace3 module system in this way, where all the modules are LoD through the module system but they do not require a TOC and load through the core. Quite a few Ace3-compatible AddOns do this as well, such as Prat and Mapster. Take a look at any of those AddOns and how they impliment the module system provided by Ace3 to create the modules to load with the core and LoD in-game.
  Reply With Quote
11-28-08, 12:56 PM   #8
Psoewish
A Scalebane Royal Guard
 
Psoewish's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 447
Another thing you could try is contact the author of a modular addon like Prat, and ask for a few pointers on how to make your addon work in the same fashion.

I'm sure they'd be happy to give you those.
  Reply With Quote
11-28-08, 01:54 PM   #9
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
Originally Posted by Taffu View Post
SLDataText uses the Ace3 module system in this way, where all the modules are LoD through the module system but they do not require a TOC and load through the core. Quite a few Ace3-compatible AddOns do this as well, such as Prat and Mapster. Take a look at any of those AddOns and how they impliment the module system provided by Ace3 to create the modules to load with the core and LoD in-game.
alas, Aloft is an Ace2 addon. porting to Ace3 as a prerequisite to this is something i am prepared to do, but that will just add a lot of time/effort to the whole thing. i would need to know if Ace3 is a basic requirement to achieving this, so i can warn my users about it.

if this can be done with Ace2 (and i am hoping to find an Ace2 addon that made an attempt at this, perhaps even Prat 2.0), then that would be a quicker/easier way to deliver this resource mitigation requirement to my users.

ultimately, i would like the resource mitigation issue to be decoupled from the Ace3 issue, so that each can be pursued separately.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
11-28-08, 02:17 PM   #10
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Prat works by encapsulating the module in a function call, the same thing is done by many mods using the Blizzard Interface Options menu by on executing the code when the options are shown.

So for example you could do this in your main addon:

Code:
local modules = {}
function Aloft:AddModule(name, func)
	modules[name] = func
end

function Aloft:LoadModule(name)
	modules[name]()
end
and for your module
Code:
function Aloft:AddModule(<module name>, function()
	
--Module code here

end)
to my knowledge, thats a very simplified version of what Prat does.

Also looking at Mapster's and SLDataText's code the modules are executed all the time, unless I'm missing something of course.

Last edited by Slakah : 11-28-08 at 02:28 PM.
  Reply With Quote
11-28-08, 03:43 PM   #11
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
Originally Posted by Slakah View Post
Prat works by encapsulating the module in a function call, the same thing is done by many mods using the Blizzard Interface Options menu by on executing the code when the options are shown.
yeah, i could see that much from inspection. i don't know if there is anything more involved, i have not rummaged the rest of Prat 3.0 and looked at the rest of the module-load workflow.

as far as this practice of "encapsulating modules in functions" goes, what i don't understand (due to lack of experience with LUA) is whether/how this saves memory, and if so, why or how much.

so:

a) i don't know how this Prat-style variation on "conditional compilation" works in WoW Client LUA environment
b) assuming all LUA is compiled and resides in memory, whether ever used or not, i don't know how much overhead passive "compiled" LUA represents (i.e. LUA that is never "loaded"/executed) compared to "active" LUA (i.e. LUA that ends up being "loaded"/executed)

if "passive" LUA ("included" via TOC/XML but encapsulated in a function that is never invoked) has a hefty footprint (simply from being scanned and compiled at startup), then the only way to give my users what they want (reduced latent overhead from functionality they do not use) is to give them what they don't want (lots of atomic modules packaged as separate addons that they can physically disable). a quandary.

my sense from disabling Prat modules is that "passive" LUA ("included" via TOC/XML and "visible" at compile time, but never executed and therefore somehow not "visible" at runtime) has a fairly small footprint.

i don't understand why, of course. i want to dig around on the web (or see if someone can walk me through it here in this thread) and understand the underlying physical mechanism a little better, before i settle on a specific approach and start fooling with my codebase.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
11-28-08, 06:14 PM   #12
break19
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 116
Originally Posted by acapela View Post
-snip-
as far as this practice of "encapsulating modules in functions" goes, what i don't understand (due to lack of experience with LUA) is whether/how this saves memory, and if so, why or how much.
-snip-
Actually that's a moot point, since unless functions are called/events are processed there is minimal memory footprint, and basically no cpu usage. So, the only thing you're saving by making module lua files is static memory.

The way sylvanaar explained his prat2/3 approach when he designed it was, there's one file with a bunch of "load this module" functions based on whether or not they're supposed to be loaded. If they are supposed to be, then that code then loads the module's lua file. If not, then the only resident memory is caused by the "module loader" lua file, since it never loads that particular module.

In someways it is a bit of a tradeoff, since having separate addons will save perhaps 10k-20k of static memory usage. But seriously, is 10-20k really worth the extra aggravation to users?

break19
  Reply With Quote
11-28-08, 08:22 PM   #13
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
Originally Posted by break19 View Post
Actually that's a moot point, since unless functions are called/events are processed there is minimal memory footprint, and basically no cpu usage.
yes! thank you! this seems to be the takeaway point here.

however it does it, LUA as a language system doesn't seem to use much in the way of static resources just holding compiled code.

so, now i need to figure out whether anything about Ace2 precludes this. looks like Prat-2.0 is an old-fashioned static LUA addon. i will just experiment, see if i can get a piece of existing Aloft code to operate this way.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
11-28-08, 09:11 PM   #14
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Just update it to Ace3 while you're rewriting it into modules - it will save you work doing it all at once. Ace2 is pretty much on life support now.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
11-28-08, 09:16 PM   #15
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
Originally Posted by Seerah View Post
Just update it to Ace3 while you're rewriting it into modules - it will save you work doing it all at once. Ace2 is pretty much on life support now.
tried porting to Ace3 already... it was very invasive, and i ended up with an addon that loaded alright (no LUA errors) but had an endless list of defects all over the place that would have taken me a lot of time to weed through.

i want to a) basically do one thing at once, and b) have some more experience before i try to tackle Ace3 again. yes, it will happen, just not as part of a refactoring that has another purpose. a matter of priorities here.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
11-28-08, 09:23 PM   #16
Psoewish
A Scalebane Royal Guard
 
Psoewish's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 447
Wouldn't it be easier in the end to do the converting to ACE3 first, and then tackle the modular loading problem?

Well I don't know how this stuff works, but to me it sounds like converting to ACE3 is a huge change. So if you first make it modular, and then convert to ACE3, wouldn't you have to weed through the problems of modular loading again?

I think it would be easier in the end then if you would make it ACE3 first, and then tackle the modular problem straight in the ACE3 thingy.

That's just what I think it's like though, I could be incredibly wrong :P
  Reply With Quote
11-29-08, 10:24 AM   #17
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
Originally Posted by Psoewish View Post
Wouldn't it be easier in the end to do the converting to ACE3 first, and then tackle the modular loading problem?

Well I don't know how this stuff works, but to me it sounds like converting to ACE3 is a huge change. So if you first make it modular, and then convert to ACE3, wouldn't you have to weed through the problems of modular loading again?

I think it would be easier in the end then if you would make it ACE3 first, and then tackle the modular problem straight in the ACE3 thingy.

That's just what I think it's like though, I could be incredibly wrong :P
in theory i would agree with you, and it could be in the end that the direction i am headed could result in more work.

i could, in fact, just branch everything several times and work on multiple things simultaneously... but i have done things that way before (not by choice), and IMO it causes more problems and eats up more time than it is worth.

i could also tell you all sorts of war-stories about teams that went ahead and jumped into a comprehensive/monolithic refactoring of a legacy codebase instead of doing things incrementally, preserving testability the whole way through...

users report bugs along the way, and production releases need to continue to flow, and etc. yes, this is just an addon for a game, but i am just one person, no-one to delegate things to, and i can't escape a "production support" mentality about even something like this (too many years of indoctrination ).

so, that means one major refactoring at a time, done in priority order (and slicing up Aloft in some form is more important to the users that an Ace3 port)... unless it proves to be infeasible.
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
11-30-08, 04:10 AM   #18
acapela
A Cobalt Mageweaver
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 241
alright, i have a couple of Aloft's modules loading at runtime, Prat-style (encapsulated in functions).

there are some Aloft data lifecycle issues i have had to work through (but that was to be expected), and i don't have enough functionality in the aggregate loading this way yet to try to quantify how much memory is used before/after loading, but it is functioning.

Ace2 did not end up imposing any restrictions.

thanks so much to everyone who contributed here for all your help, i greatly appreciate it. i would have just been groping in the dark otherwise. if anyone thinks of anything else, feel free to chip in... i am sure i am doing any number of things wrong/ineffectively .
__________________
Retired author/maintainer of Aloft (the nameplate addon)
http://www.wowinterface.com/download...AloftBeta.html
-----
Zippy said it best: "All life is a BLUR of Republicans and Meat!"
  Reply With Quote
11-30-08, 04:53 AM   #19
Psoewish
A Scalebane Royal Guard
 
Psoewish's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 447
I'm glad to see it's all coming along. :]
After all this is one of my standard wow addons, so less memory is never a bad thing ^_^
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How to subdivide a large addon?

Thread Tools
Display Modes

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

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