Technical mod feedback

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.

3 Likes

Ok, thanks for the feedback.

Thanks for the advice Patrick!

Thanks for the feedback Patrick, already removed the api files from my project but I will remove the other files as well!

I just made the changes in my mod, @PatrickKlug, you can download it at https://github.com/Turntablelover/Game-Dev-Tycoon-Mod

I’m planning to change the default behavior when adding topics so that when mods try to add topics with a id that already exists, only the first topic is kept.

I think it’s good that the id’s for topics are the same as the name, after all it would not make sense to have two ‘Assassin’ topics in the game.

If you haven’t already then please all take note of this:

http://forum.greenheartgames.com/t/announcement-first-beta-version-with-modding-support-is-live/8612/45?u=patrickklug

@dillion345, @jasonlamb, @Venomous, @Gold, @hi5gameslp and @DzjengisKhan

1 Like

Yup, i saw Daniels post, and i’ve already made my mod compatible with the new update ^^

1 Like

I´ve saw this too , the next update of my mod is coming at Sunday

Ya, if you want to generate new names i will recommend create unique names through this latest updated Online GUID Generator script.