Creating and using an advanced mod (or modmod) Installer

Afforess

The White Wizard
Joined
Jul 31, 2007
Messages
12,239
Location
Austin, Texas
This is a guide to create an installer for users who play your mods, eliminating a source of many errors, from installing to the wrong folder, and making life simpler for everyone (except yourself, I'm afraid.)

There are many installers out there, some freeware, opensource, and some commercially used one's. For this guide, I will use and demonstrate InstallJammer, as it is free and opensource. However, other install creators are generally set up in a similar manner.


  • First off, grab the download for InstallJammer, it's made for Windows and Linux.
  • After you've installed it, open it for the first time. You'll be at the "Start Page." To create a new project, either select 'CTRL-N' or From the File Drop-down menu.
  • Great, you should be at this screen now:
    Spoiler :
    Screen%201.png

  • Let's fill in some basic information. Write the name of your mod in the space for "Application" and leave the company info blank (Unless you want to put your Mod Team's name their.) Also, fill out your version info.
  • Now, open the "Project Features" tab, and look at that information. It all likes fine, so close it and open the "Install Language." So can disable or enable different languages here. It's useful for multilingual mods, if you also want to have a multilingual installer. Let's leave them all enabled. By default, every time you run the installer, it will prompt for a language.
  • Close that tab and open "Project Preferences. " You might want to increase the compression level to 9, it will take up less space, but use more CPU extracting during the install. LMZA(Solid) is the most compressed format, but zlib has the best compression space to install speed ratio. It's really up to your personal preferences what you choose here. Leave the rest of the settings alone.
  • Now, on the right panel, move to "Platform Information." We are creating an installer for Windows, but if you want to create one for Linux, feel free to do so.
  • On the default destination directory in the "Platform Information" tab, change it to as follows:
    Code:
    <%PROGRAM_FILES%>/Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods
    This will always set the default path correct for 95% of users (Steam users or custom installs can just change it to the correct path themselves, in the installer). Also, the Program Files, inside the percent string means that it will always pick the correct Program Files (x86) for 64-bit Windows users.
  • Also, change "Require Administrator" to off, so that Vista and Windows 7 users don't get those UAC popups.
  • Now, on the right panel, move to "Groups and Files" This is the heart and soul of your installer, choosing what files are used. I recommend keeping a backup of your mod files somewhere in case of a catastrophic failure. Now, if you have your mod in one clean folder (I hope you do),
  • Delete the "Program Files" group. It's the default one, and it's not needed for our purposes. Now, click the blue folder icon, with the hover text "Create New File Group". Rename it with the name of your mod. (Note: if you screw up the name, on the left side, the "Name" field allows you to rename it their too.)
  • Now, for some explanation of the left panel.
    • "Active" means that this component will be included in the installer. This is useful if you have some buggy feature you need to turn off at the last minute, but will need the files later.
    • "Alias" is just a second naming feature
    • "Comment" is just comments for other people who will see this install setup file
    • "Compression Method" allows you to set an non-default compression than what you selected eariler
    • "Data" - I'm not sure, I've never used it
    • "Destination Directory" is where the files/folders will be installed. <%InstallDir%> is where the user choose to install it on the installer. 99.9% of the time, installing files should be relative to the Install Directory,.
    • "File Update Method" is how the installer chooses to overwrite existing files if it finds them. To avoid errors, I recommend "Overwrite Always."
    • The rest, other than name are not really useful for anything for our purposes.
  • Now, right click on your new file group that you created, and select "Add Directory." Navigate to where your files are kept for your mod, and select the main folder. DO NOT Select an archive (.zip, .rar .7z etc...) of your mod, you need an uncompressed version. Also note, if you selected a folder, as you change files in that folder, the installer will automatically update files in that folder to match yours.
  • On individual files, you can also set destination directories and update methods too, this is useful for Modmoder's. If no information is given, the default settings are used.
  • Now, we are done with that panel. Move to the next panel on the right side "Components"
  • If you are making an installer for a mod, you just need 1 component, your core mod. You can later create separate components and file groups for additional features, if you so choose.
  • The way components work is that a file group(s) are linked to a component. If a component is installed, so the corresponding file group.
  • For a more detailed breakdown:
    Spoiler :
    Screen%202.png

  • Great. You have everything almost working. Now, on the right panel, select "Setup Types"
  • If you are making a mod where users install it, with no configurable options or additional addons, leave it as is. Otherwise, you can make custom set up's where non-standard features are added. It's fairly self-explanatory.
  • Great. Now you have everything done. Go to the "Build Installers" tab, and Select "Build Installer" Once it's been made, run it, and give it a test run.

Commonly, after I make an installer, I find errors, where files did not go in the right place. Sometimes, fiddling is required to make files find the correct directory,

Also, feel free to fiddle with the screens and display text for users. It's all fairly basic, but it can add a nice feel to the installer.

Make sure you always test your installers and the run the game after installing.

If you have more detailed questions post them.
 
Apparently InstallJammer had a server crash not too long ago, this may have corrupted their program.
 

Attachments

  • installer crash.jpg
    installer crash.jpg
    95.1 KB · Views: 131
Apparently InstallJammer had a server crash not too long ago, this may have corrupted their program.

No, I know what causes it. It the path to the install directory. The last character can't be a backslash. Fixed the OP.
 
Honestly afforess you should try the install scripts I made with the help of Emperor Fool, Nick Nacks and Snarko and others (actually it's more like EF made them, and I just cobbled them together). These don't define the correct install path for 90% of users, they work flawlessly for 100% of users. Also includes icon scripting and aditional add ons if needed. Very easy to use. I don't mean to be rude, but it's simply a superior method to your above recommended method, and easier to explain in a guide like this (so easy I did not write up a guide because anyone that can make an XML mod can use those scripts without directions, they are pretty intuitive to use).

BtS mod install scripts

If you feel the urge to rebuff me for recomending some of my work, feel free. Just download and use one of those scripts once before you do though, and you'll see why I recommend them over any other method. They are simply easy, efficient and precise.
 
Honestly afforess you should try the install scripts I made with the help of Emperor Fool, Nick Nacks and Snarko and others (actually it's more like EF made them, and I just cobbled them together). These don't define the correct install path for 90% of users, they work flawlessly for 100% of users. Also includes icon scripting and aditional add ons if needed. Very easy to use. I don't mean to be rude, but it's simply a superior method to your above recommended method, and easier to explain in a guide like this (so easy I did not write up a guide because anyone that can make an XML mod can use those scripts without directions, they are pretty intuitive to use).

I need an installer that allows, for custom components. If you look at my installer, from my download, I have 10+ different components that players can select. I'm not sure yours will work for that.

And yours works for 99% of users, you can never get it to work for 100% of users. For instance, yours uses Reg Keys to find the path, but I couldn't get BTS to install on Win7 (I did get Warlords and Civ4 Vanilla, but BTS would choke on DirectX) so I just installed it on XP, patched it, and copied the folder. It wouldn't find the folder then. This is just a for instance, I know 99.9% of users don't do this.

Edit:

Also, since I make modmod's, I need an installer that can back up files that it would normally overwrite, and I was going to include a how to in the tips and tricks section for that. If I replace a users CvGameCoreDLL, but later, they uninstall it, I don't want the uninstaller ripping that out.

And, another trick I learned was that I have an install page that warns users if my installer doesn't find the Rise of Mankind.ini in the install directory, telling them they chose the wrong folder.

Oh, and my installer also makes sure the they uninstall previous versions of my modmod's before it will install the next.

I NEED all of those features. Can a NSIS script provide those?
 
NSIS can do all of those, for sure. You'd have to program them though. For multiple add ons (beyond the 2 I have set up), you'd need to clone the add on code (easy for anyone that's done the most simplest thing with python Civ4 modding). For the other things you ask, not sure, cause I don't really understand what you ask, but anything involving installation is possible wiht an NSIS script, some of it would be difficult to code, but definatly possible. I'd wager it would be easier, or no, maybe not easier, but more acurate to work with NSIS scripting then your program's device. Don't know though. Show me the function the install scripts I've posted don't do that you need, and I'll see how to write them, if I can... Honestly I think they'd be more direct, or less bug prone in NSIS then by using the InstallJammer system. At least it seems that way, I can't see how InstallJammer could figure out the 4 registry checks to always isntall correctly (unless the user hacked their registry/formated their hardrive--and manually reinstalled their programs-so there was no registry), like you can set up with NSIS. Maybe I'm wrong and you've found a miracle program. But I'd be blown away with disbalief, cause if you really want to build something right, like an installer, it seems to me you'd have to wade through a little guts of programming. Maybe though, maybe you've found something that can do it all from a mouse and window interface, don't know, seems so far fetched to me... at least if it were to work right.. then again that could be cause I've spent hundreds of hours haranging carreer programmers to build a script and if you have a click and work program that does that in minutes I'd just feel stupid...
 
NSIS can do all of those, for sure. You'd have to program them though. For multiple add ons (beyond the 2 I have set up), you'd need to clone the add on code (easy for anyone that's done the most simplest thing with python Civ4 modding). For the other things you ask, not sure, cause I don't really understand what you ask, but anything involving installation is possible wiht an NSIS script, some of it would be difficult to code, but definatly possible. I'd wager it would be easier, or no, maybe not easier, but more acurate to work with NSIS scripting then your program's device. Don't know though. Show me the function the install scripts I've posted don't do that you need, and I'll see how to write them, if I can... Honestly I think they'd be more direct, or less bug prone in NSIS then by using the InstallJammer system. At least it seems that way, I can't see how InstallJammer could figure out the 4 registry checks to always isntall correctly (unless the user hacked their registry/formated their hardrive--and manually reinstalled their programs-so there was no registry), like you can set up with NSIS. Maybe I'm wrong and you've found a miracle program. But I'd be blown away with disbalief, cause if you really want to build something right, like an installer, it seems to me you'd have to wade through a little guts of programming. Maybe though, maybe you've found something that can do it all from a mouse and window interface, don't know, seems so far fetched to me... at least if it were to work right.. then again that could be cause I've spent hundreds of hours haranging carreer programmers to build a script and if you have a click and work program that does that in minutes I'd just feel stupid...

There is no miracle program, but I just prefer a GUI setup to NSIS script. I guess it really comes down to preferance then, as I trust that you are right, with NSIS's functionality.

I think personally, when I have to make 20-some components, I prefer a GUI environment. That said, the save files for Installjammer projects are just glorified scripts that you can edit in notepad too. So really, it is just a GUI.
 
Back
Top Bottom