views:

118

answers:

3

Hello. Can anyone tell me how to create a custom installer to 'install' games. I say custom meaning I don't want the user to have the option where the game is installed. I want it to be a straight forward process, maybe with just one loading bar.

The program I'm developing is a 'center' for game playing, which includes a community and other features, such as a timer that records how long a game is played for. I just thought that installing each game in one place, with a simple installer would make the program easier to use. It also will allow me to do other features as the games will all be installed in one place. No need for the user to specify where the game is installed.
Would this be possible?

+7  A: 

I'm presuming your game is developed in C#, rather than requiring the installer be written in C#?

If that's the case, there are plenty of options available to you for installer packages. Probably the most customisable option, whilst still being free, is Nullsoft Install System. The installers are built around some basic scripting activities, and can be as simple or complex as you desire - the installation, and the wiki have plenty of example scripts that you can explore and experiment with.


OT: Install Location
Personally, I'd consider it bad practice to disallow the user from selecting their own install location and, in fact, it gets me pretty frustrated when anything but system-file installations (e.g. drivers) stop me from choosing a directory. Many users will choose to locate certain types of installation and data on a non-default device (e.g. virtually all of my games are housed on a separate drive to my main Windows installation). If you need to remember the installation location so badly, create a registry key for it.

James Burgess
I had used commercial Wise products for about a year with great frustration, and found NSIS to be much better. NSIS is a little difficult to learn at first, but once you get it figured out it is great! I have used this for a wide range of very small and very large installers. Highly recommended.
AaronLS
+1 for NIS. Wish I could +1 again for the "OT" - totally agree. It's MY computer, let me install it where I want.
Evgeny
Thanks for the answer, but I mean for games that already exist. I want to create a custom installer, in C# to install them in a location I choose.
Joey Morani
+1 users should always be allowed to choose where to install to (unless it is the aforementioned driver or a system module).
slugster
So how would I get my C# program to detect where a game has been installed, if it doesn't install/know where the program is? In the registry?
Joey Morani
That's certainly a viable option - alternatively, NSIS does provide the facility to allow you to pass command-line parameters. So, for example, your C# "game centre" could pass the install location to the installer executable (removing the need for a registry key altogether).
James Burgess
The reason we windows users like to be able to specify where an app is installed is because stupid devs specify ridiculous places to install their crap (C:\ToolIUsedLikeOnce\, C:\Program Files\Obscure Publisher\Obscure Developer\JustInCaseIBuyAll99OfyourLameApps\) and our HD's were a mess. That's because windows has always *allowed it*. The *nix way: all your programs go *here*, all there temp files go *there* all their data goes *over there* **the end**. Much neater. Faster. More secure. C:\Program Files\AppName is a decent step in the right direction. Is it really so hard to just use that?
MGOwen
Your commercial game's install location is in the registry. It should be easy to find by just iterating over the keys to look for something that looks like the game's name. As for writing an installer to replace a commercial game's installer? No, you can't do that without pretty significant knowledge of what the game's installer is doing.
dash-tom-bang
+2  A: 

Another system you can use is called Inno Setup - http://www.jrsoftware.org/isinfo.php

Neil Benn
A: 

If the games already exist your best option would be to call the MSI installers in administrative mode (see documentation for MSIExec). Then you could actually

  • Set a predetermined location for the games
  • Remove any UI and replace that with your custom installer UI

Obviously that would only work if the installs are really MSI modules (with some more work also for installers that have MSIs packed into EXE setups). That is true for most, but likely not all games.

Please note that this would be a sizable task and to be honest I cannot see any value in doing what you are planning. But thats up to you.

As start you would have to read into the MSI documentation. I'd recommend WIX (Windows Installer XML) for the beginning.

Foxfire