Quantcast Are all addon "open source"? - WoWInterface
Thread Tools Display Modes
12-10-13, 05:53 AM   #1
jjforums
A Flamescale Wyrmkin
Join Date: Jul 2009
Posts: 106
Are all addon "open source"?

Is there any "compiled" file or the addon is the code we have in .lua filess basically?

Thanks.
  Reply With Quote
12-10-13, 06:28 AM   #2
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
They're open source. The lua is what is used by Blizzard to run the add-on.
  Reply With Quote
12-10-13, 08:29 AM   #3
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,286
Open source ~= Visible Code. Not every addon is open source.
  Reply With Quote
12-10-13, 09:06 AM   #4
Xruptor
A Flamescale Wyrmkin
 
Xruptor's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 106
Originally Posted by jjforums View Post
Is there any "compiled" file or the addon is the code we have in .lua filess basically?

Thanks.
All Blizzard (WOW) addons are viewable by everyone. The lua code works with images / xml / toc and a few other file formats to work together to form an addon. In essence all the addon code revolves around the LUA and how it interacts with the WOW Client.
  • Please be aware though that Blizzard does have strict policies on WOW Addons. The code must be visible and cannot use obscurification (scramble the code) at all. A few addons in the past were spanked for using this technique. It practically makes the code unreadable and is against the TOS. Sites like WOWInterface and Curse frown upon it as well. (Note this is also called compiling LUA code)
    http://en.wiktionary.org/wiki/obscurification
  • The code cannot request donations or generate revenue at all.

to list a few....

Finally, take note that although an addon may be viewable it may have a licensing agreement attached to it. This may or may not prevent someone from using code or altering code without the authors permission. A lot of the WOW addons don't have licensing attached to it and are freely available to grab code from or modify in any shape or form. There are a few whom have GNU open licenses which allow you to use code and or alter it but also require you to mention the Author when you credit your work.

My advice is just to review the code and check for licensing material.

In practice I always credit any author regardless if they do or don't have a licensing agreement attached to their addon. But that's just me
__________________
Click HERE for the ultimate idiot test.

if (sizeof(sadness) > sizeof(happiness)) { initDepression(); }

Last edited by Xruptor : 12-10-13 at 09:14 AM.
  Reply With Quote
12-10-13, 09:39 AM   #5
pelf
Sentient Plasmoid
 
pelf's Avatar
Premium Member
Join Date: May 2008
Posts: 133
Do note that if an addon doesn't have a specific license attached, due to the Berne Convention, that addon's license is "by default" All Rights Reserved.

What that actually means for addons isn't exactly easy to nail down, due to the interaction of Blizzard's guidelines and RR licensing. Here's another thread where some people discuss it:

http://www.wowinterface.com/forums/s...ad.php?t=48570

You can be sure that it means, at least, that you cannot literally copy the addon in its entirety or any of its parts and paste them into yours. That is actually and clearly illegal. Most authors, as several expressed in that thread, are okay with you reading through their code and learning from it -- even copying the spirit of novel techniques they may have used to solve various problems.

Last edited by pelf : 12-10-13 at 09:41 AM. Reason: additional information
  Reply With Quote
12-10-13, 10:10 AM   #6
MoonWitch
A Firelord
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 455
Originally Posted by Resike View Post
Open source ~= Visible Code. Not every addon is open source.
I should have specified like XConstruct did, my bad. With Open Source, I did mean "source viewable". In fact, I use several add ons reworked in mine, which means -
1. I check their license, contact author if need be
2. Include credits and their license
  Reply With Quote
12-10-13, 12:50 PM   #7
Cairenn
Credendo Vides
 
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 7,102
Originally Posted by Xruptor View Post
Finally, take note that although an addon may be viewable it may have a licensing agreement attached to it. This may or may not prevent someone from using code or altering code without the authors permission. A lot of the WOW addons don't have licensing attached to it and are freely available to grab code from or modify in any shape or form. There are a few whom have GNU open licenses which allow you to use code and or alter it but also require you to mention the Author when you credit your work.

My advice is just to review the code and check for licensing material.

In practice I always credit any author regardless if they do or don't have a licensing agreement attached to their addon. But that's just me
The section I highlighted is actually completely bass-ackward, as others have noted. If there is no license attached, it defaults to All Rights Reserved. That means you can not use any of it without specific, explicit permission of the original author.

Also, as others have said, open source does not mean the same thing as source viewable. WoW addons can not be obfuscated or compiled.
  Reply With Quote
12-10-13, 01:53 PM   #8
ravagernl
Proceritate Corporis
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 1,176
Originally Posted by Cairenn View Post
[...]
Also, as others have said, open source does not mean the same thing as source viewable. WoW addons can not be obfuscated or compiled.
I believe you can only use obfuscation in your AddOns, when you have asked explicit permission from Blizzard (or when you're writing a personal AddOn that you are not going to release, but what is the point of obfuscation then?). I remember Peggle / Bejeweled were obfuscated with luasrcdiet.

On a different topic, I wonder what the Statute of limitations(or do you call it prescription??) are for AddOns, since there's different law enforcements(I assume EU, USA and Asian regions all have different timespans). I hope there's never going to be any occasion that will play a role. Lucky Blizzard brings us content every half year or so, so chances are small
  Reply With Quote
12-10-13, 02:02 PM   #9
Cairenn
Credendo Vides
 
Cairenn's Avatar
Premium Member
WoWInterface Admin
Join Date: Mar 2004
Posts: 7,102
Originally Posted by ravagernl View Post
I believe you can only use obfuscation in your AddOns, when you have asked explicit permission from Blizzard (or when you're writing a personal AddOn that you are not going to release, but what is the point of obfuscation then?). I remember Peggle / Bejeweled were obfuscated with luasrcdiet.
You are correct. I just didn't bother to mention it because it is so very rare that they allow it and it has to be under some very specific circumstances. For most addons it'll never even be a consideration.
  Reply With Quote
12-10-13, 02:42 PM   #10
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,286
Originally Posted by Cairenn View Post
You are correct. I just didn't bother to mention it because it is so very rare that they allow it and it has to be under some very specific circumstances. For most addons it'll never even be a consideration.
Well i would definitely use it, if it wouldn't be against the tos, but only for the performance improvements.
  Reply With Quote
12-10-13, 05:02 PM   #11
Xruptor
A Flamescale Wyrmkin
 
Xruptor's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 106
Originally Posted by Cairenn View Post
The section I highlighted is actually completely bass-ackward, as others have noted. If there is no license attached, it defaults to All Rights Reserved. That means you can not use any of it without specific, explicit permission of the original author.
To be fair I did mention that I still give credit to an author and yes I still do contact them before I make any use of their code. This goes for code also that is freely available and does not fall under 'All Rights Reserved' I should have worded it a bit better but I'm sure he got the general gist of it.
__________________
Click HERE for the ultimate idiot test.

if (sizeof(sadness) > sizeof(happiness)) { initDepression(); }
  Reply With Quote
12-10-13, 05:04 PM   #12
Xruptor
A Flamescale Wyrmkin
 
Xruptor's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2005
Posts: 106
Originally Posted by ravagernl View Post
I believe you can only use obfuscation in your AddOns, when you have asked explicit permission from Blizzard (or when you're writing a personal AddOn that you are not going to release, but what is the point of obfuscation then?). I remember Peggle / Bejeweled were obfuscated with luasrcdiet.
These are two really rare cases where this was done. They had to get permission from Blizzard for this. Other then that it's really frowned upon and is not supported on WOWInterface and Curse to my knowledge.
__________________
Click HERE for the ultimate idiot test.

if (sizeof(sadness) > sizeof(happiness)) { initDepression(); }
  Reply With Quote
12-10-13, 05:40 PM   #13
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Resike View Post
Well i would definitely use it, if it wouldn't be against the tos, but only for the performance improvements.
What performance improvements? Ridiculous gymnastics with loadstring() and compression algorithms will not improve performance by any measure...
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
12-11-13, 04:02 AM   #14
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,286
Originally Posted by Phanx View Post
What performance improvements? Ridiculous gymnastics with loadstring() and compression algorithms will not improve performance by any measure...
LuaSrcDiet doesn't do any compressions, just reduce the lenght of variable names, and remove white charaters. Sometimes you can reach 30-40% reducement, and when you load a modul based on an event, it kinda matters how long code you gonna get loaded in. In before 2-3 sec lags when DBM loads up a module.
  Reply With Quote
12-11-13, 04:36 AM   #15
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
I know you're trying to be helpful, but as in some other recent thread, the information you're giving is simply wrong.

The only possible advantage a smaller file could have would be in reducing the amount of time it takes to read the file from your hard disk, and there's simply no way that any functioning modern hard drive is going to take 2-3 additional seconds to read a few hundred KB worth of files. (Basing that size on the size of a BigWigs zone module; I can't imagine DBM modules are all that much bigger.) The size of each file is not really what matters. The quantity of files will have a much more noticable effect. If you are really hyper-obsessed with minimizing the time it takes to load your addon, you'll see a much bigger difference by combining all of your code into one file, than you will by reducing all of your variable names to single letters and removing all the whitepsace from each file.

Also, most of the time it takes to load an addon has nothing to do with either the size or the quantity of files in the addon -- it's in your code being compiled and executed, and the Lua interpreter doesn't give a rat's behind whether your variable name is 1 or 1000 letters long.

Minifcation is useful in, say, the JavaScript code for a website -- but it doesn't make the code itself load or run any faster, it only makes it faster to transfer the file from the server to your computer. No files are being transferred across a network in the WoW addon environment, so that isn't a concern. The only reason to minify, obfuscate, or do any similar thing to the code of a WoW addon is to make your code harder for other people to read because you're paranoid that someone is going to copy you.

This is why Bejeweled and Peggle got permission to obfuscate their code -- because those are addons based on established proprietary games that are sold for profit, and it wouldn't make sense for their creators to suddenly start giving away the code for free, and Blizzard loses nothing by letting them run their game inside of WoW. In fact, Blizzard benefits from it, in that people are less likely to get bored and quit if they have something fun to do in between real activities like dungeons and raids.

TLDR version: Minifying or obfuscating your WoW addon code has no benefits for normal addon authors.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
  Reply With Quote
12-11-13, 06:34 AM   #16
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 255
Be aware that Blizzard has some size limitations on a single loaded file. I ran into this when I tried combining eleven files into one that was approaching 5MB in size. I know most will never encounter this, but it exists.
  Reply With Quote
12-11-13, 07:25 AM   #17
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,286
The Lua compiler translates programs written in the Lua programming language into binary files that can be loaded and executed with lua_dofile in C or with dofile in Lua.
The main advantages of precompiling chunks are: faster loading, protecting source code from user changes, and off-line syntax error detection.

Pre-compiling does not imply faster execution because in Lua chunks are always compiled into bytecodes before being executed. The compiler simply allows those bytecodes to be saved in a file for later execution.

Longer variable names would never have an impact on runtime performance in a compiled language. But in a just-in-time compiled language, it could slowdown program startup and program performance.

For dynamic languages such as Lua or Python or Ruby, the length of a variable name could very well affect runtime performance depending on how variable name lookups are performed. If variable names are hashed and then the hash is used to index a table of values to get the value of the variable, then natrually the more data the hash function has to process, the longer it will take.

When you compile this:

Lua Code:
  1. local x = 1

The compiled file will be this:

Lua Code:
  1. 1b4c 7561 5100 0104 0404 0800 0700 0000
  2. 4078 2e6c 7561 0000 0000 0000 0000 0000
  3. 0002 0202 0000 0001 0000 001e 0080 0001
  4. 0000 0003 0000 0000 0000 f03f 0000 0000
  5. 0200 0000 0100 0000 0100 0000 0100 0000
  6. 0200 0000 7800 0100 0000 0100 0000 0000
  7. 0000

And if you complie this:

Lua Code:
  1. local xxxxxxxxxxxxxxxxxxxxxxx = 1

You will get this:

Lua Code:
  1. 1b4c 7561 5100 0104 0404 0800 0700 0000
  2. 4078 2e6c 7561 0000 0000 0000 0000 0000
  3. 0002 0202 0000 0001 0000 001e 0080 0001
  4. 0000 0003 0000 0000 0000 f03f 0000 0000
  5. 0200 0000 0100 0000 0100 0000 0100 0000
  6. 1800 0000 7878 7878 7878 7878 7878 7878
  7. 7878 7878 7878 7878 7878 7800 0100 0000
  8. 0100 0000 0000 0000

- Used lua 5.1.

Since the variable name is more then 8 charaters the compiler can't transalte that variable name into 1 bytecode, so it will take up more space, and since the code is longer the execution is going to take more time.

You are right about it's might be irrelevant for 100-200 kB codes or i7 12 core processors, but it still a performance improvement, bit faster execution, less memory fragmentation.
  Reply With Quote
12-11-13, 07:41 AM   #18
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,286
Originally Posted by Nimhfree View Post
Be aware that Blizzard has some size limitations on a single loaded file. I ran into this when I tried combining eleven files into one that was approaching 5MB in size. I know most will never encounter this, but it exists.
I'm not sure about the size limit, but also you can't have more then 1024 upvalues in a single file.
  Reply With Quote
12-11-13, 04:17 PM   #19
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Resike View Post
You are right about it's might be irrelevant for 100-200 kB codes or i7 12 core processors, but it still a performance improvement, bit faster execution, less memory fragmentation.
In the WoW addon environment, any improvement you're going to see by obfuscating your code (via minifcation or otherwise) is so minor that it's really just theoretical, and not even worth doing. Between that and the fact that it's against Blizzard's rules and may get your addon blacklisted in the game client, recommending it is useless at best, or malicious at worst.

Edit:
@Nimhfree: If there is a limit on the size of a single file WoW will load, it's certainly larger than 5 MB, as saved variables files for damage meters don't start failing to load until they're in the 30+ MB range.

Edit #2:
I just tested loading a 30 MB file in an addon, and had no trouble at all. I didn't bother testing anything larger, as there's pretty much no way the combined size of any addon is more than 30 MB.
__________________
Author/maintainer of Grid, PhanxChat, oUF_Phanx, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!

Last edited by Phanx : 12-11-13 at 04:34 PM.
  Reply With Quote
12-11-13, 07:22 PM   #20
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 255
I must be mistaken about the error loading my 5MB being related to size. I will dredge up that version and post whatever the error was. I am guessing it is related to the number of "ifs" if it is not size related, but will know for sure later.

Edited to add:
It turns out the actual error I am getting is:

1x Grail-059\Grail-QuestNames.lua:142112: control structure too long near "<eof>"

Basically the file structure looks like:

if locale == "enUS" or locale == "enGB" then

elseif locale == "deDE" then

elseif locale == "esES" then

-- all the rest of the locales until

else
print("Unsupported locale", locale)
end

Each of the "language sections" has over 12,000 lines in it looking like:
G[32647]='工作令:金蓮會I'
G[32648]='工作令:金蓮會II'

However, within each section there are if blocks with various line count in them like:

if release >= 17345 then
G[11488]='博學者殿堂'
G[11490]='占卜者的占卜'
G[11492]='難以殺死'
end

Last edited by Nimhfree : 12-11-13 at 08:04 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Are all addon "open source"?

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