Jump to content

Standalone Installers (NSIS)


tomis13lack
 Share

Recommended Posts

Those who make a standalone game might want an installer for it. It makes the game seem more professional. I have created a small NSIS script for those who want to use it to accomplish this. You will need to change stuff. I put the vital things you need to change on lines with 6 #'s.

It doesn't look that good but NSI is really simple. Fixing it up should be easy.

The #'s are comments. # comments 1 line but i used 6 around the text as an attention getter. semicolons as well as /*'s are also used for commenting on this.

 

OutFile "GameInstaller.exe"

!define pathToGame "C:\Users\**USERNAME HERE**\Desktop\**Gamename**\" ######Replace as you see fit######
InstallDir "C:\Program Files (x86)\NameofGame" ######Replace as you see fit######
 
Section 
	SetOutPath $INSTDIR
	File /r ${pathToGame}\*
	WriteUninstaller $INSTDIR\uninstaller.exe
SectionEnd

Section Desktop
	MessageBox MB_YESNO "Create a Desktop Shortcut?" /SD IDYES IDNO end
	CreateShortcut "$desktop\myapp.lnk" "$instdir\gamename.exe" ######Replace gamename.exe with ur game's exe file######
	end:
SectionEnd

Section -Prerequisites ######Any prerequisites go in here. I used OpenAL as an example######
	SetOutPath $INSTDIR\OpenAL32
	MessageBox MB_YESNO "Install OpenAL32?" /SD IDYES IDNO end ###Asks if they want to install 

openal in a message box
	File ${pathToGame}\dependencies\openalinst.exe ###i put the openal installer in a dependencies folder
	ExecWait ${pathToGame}\dependencies\openalinst.exe ### actaully installs openal
	end:
SectionEnd

Section "Uninstall"
	Delete $INSTDIR\uninstaller.exe
	Delete $INSTDIR\gamename ######Replace as you see fit######
SectionEnd

You need NSIS for this. Here is a link: http://nsis.sourceforge.net/Download/

 

How to use it:

Step 1. Paste the script in notepad

Step 2. Save the script as install.nsi (or whatever-u-want.nsi)

Step 3. open with NSIS and compile. If you have installed NSIS you should be able to compile by right clicking the nsi file and clicking "Compile with NSIS"

Step 4. Enjoy

the installer has everything in it. It will work on any system. You do not need anything but the installer to install.

Edited by tomis13lack
  • Thanks 1
  • Upvote 1
Link to comment
Share on other sites

Don't forget the VS 2015 redistributable.  For silent installation, here are the parameters (from INNO Setup):

Filename: "{app}\_CommonRedist\OpenAL\2.0.7.0\oalinst.exe"; Parameters: "/s"
Filename: "{app}\_CommonRedist\vcredist\2015\vc_redist.x86.exe"; Parameters: "/q"

 

  • Like 1
  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...