I took a look at some of the current mods listed under http://forum.greenheartgames.com/t/unofficial-mod-list-index/8619
Some promising/fun mods are appearing already but I’d like to point a few things out to the modders involved (@dillion345, @jasonlamb, @Venomous, @Gold, @hi5gameslp and @DzjengisKhan):
Many mods seem to include files from the gdt-modAPI
Don’t include files from gdt-modAPI project. The gdt-modAPI comes with the game so if you clone files and include them with your mod then all you do is override what is already there and this could cause problems in the future.
Most mods I’ve seen would be better off, if the following folders are removed:
- remove the api folder from your mod
- remove the helper folder from your mod
- remove the examples folder from your mod
And some things to check:
###Names
Give meaningful names to your mod and any global objects/items you put into the game. Naming your mod GameDevTycoonMod
or GDTExpansion
isn’t a very good name because chances are that someone else will pick this name as well. Pick something that is unique, instead of generic.
In the same spirit, make sure that any id’s are globally unique. When in doubt, use a GUID generator to generate your id’s.
###Don’t steal from other mods
It’s okay to learn from other mods and I think everyone is happy to help each other out but don’t re-use stuff from other mods without asking first. Copy/pasting code will also introduce compatibility problems, since mods might overwrite each others data.
###Scope
Don’t pollute the global scope. If you don’t know JavaScript very well then just follow these guidelines: Instead of just throwing code into your main code file like this:
//your code goes here
//example:
var myEvent={};
GDT.addEvent(myEvent);
wrap the content of your file into a self-executing function like this:
(function(){
//your code goes here.
//example:
var myEvent={};
GDT.addEvent(myEvent);
})();
All that does, is move your variable definitions into a local scope so you don’t pollute the global scope.
Hope this helps.