For your final project (and all homework from now
on), you will be required to create an installer for your game.
Basically you create a text file (.nsi) that describes
your install and all the files that are required for the install
and where each item gets installed. That text file is compiled into
a single exe and when it is run will install all the files you specified
in the .nsi file. This should be a very simple process for you to
create
Always start with a working example.
You don't actually have to do this next part, I'm
including a sample file I would
like you to modify. It is the file I created when using example2
as a starting point.
To test the basic process, take the example2.nsi
file.
Right click on it and select Compile NSIS script.
This will create the example2.exe file which only installs one file,
the example2.nsi file. It is as simple as you can get. We'll use
this as a good starting point for your game.
For your installer:
Create a new directory called yourgame-dist. This
is what I call the distribution directory. This will contain the
final distribution of your game. In our case you will be shipping
source with the game until class is over, but in the real world we
would only copy the .dso and .ml files to this area not the source
code.
Copy the skilltest.nsi file
to this directory and rename it yourgame.nsi.
Copy all your game files to this directory. All
the elements for my specific game are torquedemo.exe (renamed skilltest.exe),
the gameOne directory (you should rename it at some point), the common
directory and a main.cs file. You will need the creator directory
if you want to edit your missions.
First I edited the skilltest.nsi file and changed
all the Example2 entries to GD360SkillTest. You can change the SkillTest
to the name of your Game (leave the GD360 see below).
CAUTION: You are changing registry entries here.
Make sure you get them all to match or your machine could have extra
fluff in the registry after uninstall and this is a sure way to screw
up someones machine and miss getting a perfectly good job (or grade!).
Make sure to add your design document into the
install so I know who wrote it and what the game is. The design doc
should include your name and information about the game and game
design. It can be .txt or .doc format. Each week you should add a
section to the document that describes the changes made since the
previous week.
Then I added the list of files that I want the
installer to include.
; Put file there
File /r "GameOne"
File /r "Common"
File "skilltest.exe"
File "main.cs"
File "mydesign.doc"
The /r tells it to recursivly include all files
and a specific directory.
Later in the file you will also need to remove
all those files.
; Remove files and uninstaller
RmDir /r $INSTDIR\GameOne
RmDir /r $INSTDIR\Common
Delete $INSTDIR\skilltest.exe
Delete $INSTDIR\main.cs
Delete $INSTDIR\mydesign.doc
Delete $INSTDIR\uninstall.exe
Please make sure you remove everything. I will
mark down significant points if you do not remove all the registry
items and files on uninstall. Make sure you test this process.
PLEASE MAKE MY LIFE EASIER
AND DON'T SCREW UP MY MACHINE WITH A BAD INSTALL! I WILL REQUIRE
THAT YOU USE SPECIAL NAMING SO I CAN TRACK MY MACHINE CHANGES.
MAKE SURE ALL ITEMS ARE REMOVED BY THE UNINSTALL. IT IS EXTREMELY
BAD FORM TO LEAVE FILES AFTER AN UNINSTALL.
Name your install directories and registry values
starting with GD360. For instance, my game directory would be.
; The default installation
directory
InstallDir $PROGRAMFILES\GD360SkillTest
The registry values would be:
WriteRegStr HKLM SOFTWARE\GD360SkillTest "Install_Dir" "$INSTDIR"
Use regedit (Start/Run - regedit) to make sure
you really did clear out the registry keys. HKLM stands for HKey,
Local Machine. You should be able to find that very easily with regedit.
Here is my sample
nsi file you should use as a starting point.
If you notice, I give my installer a version number.
This is so I can more easily keep track of various installers that
might end up on cdroms or other websites. I can quickly tell what
version we are talking about. I always use three numbers. 1-0-0 would
be version 1.0.0. 1-0-1 would be a minor bug fix to version 1. 1-1-0
would be 1.1 which is intermediat dot release. For our purposes we
are starting with 0-0-8 which I consider an alpha (very rough, not
even ready for general testing) version. In this case 8 stands for
week 8. You will have to change this number each week when you build
a new installer to turn in.
Keeping version information clear will really make
your life a lot easier. Most large projects also include build numbering.
A large group of developers check their code into a central area
and a librarian does the build each evening (or more often). The
release is tracked on version and build number as there may be a
significant number of builds for each release. Each organization
will have it's own process, but they all have a well documented system
to keep the developers organized.