Tuesday, September 1, 2009

New Addon Design

I love having options. The more, the better. But in regards to addons, options come at a price. In my addons directory right now, there are over 200 folders. There are over 30 megs of settings for my main. It takes WoW several minutes to load up, and I generally crash at least once a day. With most crashes, Blizzard recommends you clean out your WTF folder, which will reset all your addons to their initial settings. It makes sense, I can imagine those things get very unwieldy over time, but it's not something I'm willing to do. It'd be days of work to get things back to how they are.

For many addons, you configure them once and then leave them be. You position them where you want them, make them look the way you want them to look, and then they stay that way for weeks or months or possibly years. Why then are addons using all this memory to store settings that you'll likely never touch again. Some addons have their configuration screens separate, to be enabled and disabled as needed, but the setting still needs to be saved in memory. And let's face it, the Addon window from the Character Selection screen, where you specify what addons should be loaded... well, it's not very friendly. It's sort of a pain in the butt. And if you're like me, you just hit the Enable All button and let all your toons load up all the addons because it's just too much fuss doing it any other way.

With all this in mind, I've begun work on a couple of addons that take a different approach. My addons use virtually no memory, they save no variables, and the settings you create for them will not be lost if the game crashes. Each addon will search its directory for a config.lua file. The file will not be packaged with the addon because then updating the addon will mean losing your settings, but each user can create it and, with the guide of a help file, configure the addon to their own liking.

My first test of this was an addon I called MapTweak. When 3.2 hit, my Cartographer wasn't working so well. I realized my favorite features of the addon were simply the ability to make the map smaller, allow the rest of the interface to work even with the map up, and such things like that. So I deleted Cartographer and studied the LookNFeel module. I created MapTweak with a nearly identical feature set to LookNFeel, with more configuration options, and with a 0 KB memory footprint.

My next task was to add data to the various zones on the map, like Cartographer's ZoneInfo module. That module uses a library which uses a library which all accounts for a large amount of memory. Most of the data available is not even put to use. All I care to know is the level range of the zone, and the instances in it. So I got to work on another addon. No options are required here, the display settings are handled through MapTweak. It's still under development so I'm not yet sure what the memory footprint is, but I estimate it will be a couple KB at the most.

My latest and biggest endeavor so far has been to replace kgPanels. By far, this is my favorite addon for creating panels on my UI. And I've been quite happy with it. However, the memory footprint is huge, and many of the scripts don't seem to work. So I got to work on a version myself that included a config file that essentially created just a large data structure to define the properties of the panels that you wanted. Then I started adding events and scripting and making the panels responsive. Then I allowed the user to modify existing UI elements in much the same way as creating new ones (just supply the name of something that already exists). The only limit to the addon at this point is your imagination. With a little know-how and creativity, you can achieve great things. At this point, I've replaced all of my kgPanel panels, I replaced a clock addon with my own clock, I made my own area to display the zone that generally appears over the minimap, I made my own calendar button, my own mail icon to show me when I have new mail, and I've modified my viewport and gotten rid of an addon there. So far, I'm using half the memory that kgPanels used, plus saving myself memory from all the other addons that I got rid of for the other things.

Overall, this method is not for everyone. It's not user-friendly, but with proper help documentation (and tutorials for Tweaker), I hope to make it accessible to everyone that wants to squeeze a bit more out of their WoW experience. And if I should interest some people in programming and making their own addons, all the better.

2 comments:

  1. Is your MapTweak addon available for DL? Sounds like something I would use instead of Cart.

    ReplyDelete
  2. Unfortunately, no. But I will be working on a Tweaker tutorial that will teach people how to get the same result.

    ReplyDelete