So we want to bring Team Fortress to AvP2. It shouldn't be too difficult, all of the weapons we need are already in AvP2, and configuring armor and run speeds and whatnot isn't too hard. What we need, however, is input on how this should go down, and modders to make the more difficult things happen, like possibly adding new weapons and more importantly, new GAME MODES, like Capture the Flag or Assault, things that teams do that aren't Team Deathmatch. However, this is AvP2 Fortress, so everything should have an AvP2 twist to it. Like Preds and Aliens on the teams realistically, but not whorishly. No Predator rocket-launcher guys, for example, but a Predator as the Spy, a class that's supposed to cloak and primarily use a knife anyway. -- SMID

Report article RSS Feed A special gift from AvP2 Team Fortress - part 2

Continuing with our launcher & update module, the second part brings the finished product. And yes, there is also a third part in the works.

Posted by Herr_Alien on Dec 27th, 2009
Article

  1. A special gift from AvP2 Team Fortress
  2. A special gift from AvP2 Team Fortress - part 2
  3. A special gift from AvP2 Team Fortress - part 3

I know, the original deal was that you'll get the mod launcher 4 - 5 days later. But it is Christmas, so here we go:


DOWNLOAD THE MOD LAUNCHER HERE!

The archive you just downloaded contains both the compiled launcher and the NSIS script. This way you can make any alterations you want and personalize the launcher further.

If your mod is for a game that has a rich modding community, it is likely that other mods also use this launcher. This however might cause issues, because each mod would end up overwritting the same .ini file (assuming all launchers are placed in the same folder).

To counter that, the launcher is designed so that a launcher renamed to "Jailbreak.exe" will try to open the .ini file called "Jailbreak.ini". This way all launchers end up having sepparate ini files.

This means that before distributing the mod, make sure that the launcher.exe file and the launcher.ini file are renamed appropriately.

In this second part, we'll disect the NSIS script and try to identify the pieces of code responsable for the following:

  1. version checking
  2. fetching the update/patch
  3. executing the installer
  4. starting up the game

Open up the launcher.nsi file into a text editor; you'll find it in the "src/" subfolder of the archive. Keep the text editor handy 'cause we'll ALT-TAB to it a lot.
Now, until you do open up the .nsi file, a couple of words about what the launcher does (available also in the archive, in the readme.txt file):

  1. It performes a version check. If an update is found, then
  2. The user is notified that an update will be downloaded and installed
  3. When pressing "Play", it'll launch the game


(1) Version checking (Function CheckVersions)


This step can be further broken down as follow:

  • the .ini file is opened, and the value for the "url" key in section 
     "[version]" is being read. The URL must point to a remote_version.ini file.
  • the remote .ini file is downloaded to the TEMP folder.
  • both launcher's .ini file and the copy of the remote_version.ini file 
     (retrieved in the TEMP folder) are then checked for differences between the 
     major, minor and micro version numbers.
  • if all are equal, no action is performed.
  • if the micro version numbers are different, then the "Optional update" pop-up
     is displayed

  • if the major or minor version numbers are different, then the "Mandatory 
     update" pop-up is displayed


(2) Downloading of the update (Function DoUpdate)


Here are the details regarding this action:
  • the "[update]" section is located in the .ini file. Two values are read from 
     here, "url" and "localFile".

     It is needed that the file at that given url is an executable (you can set however any file extension if the web server does not allow .exe file), and the 
     "localFile" is properly named (having an .exe extension).
  • the HTTP client will then connect to the "url" and will download the remote 
     file to the same folder as the launcher. The local copy will be named according
     to the value of "localFile".
  • the copy of the installer (or self extract archive) is then executed.
    You'll notice we are calling ExecWait here: the reason is that we want the launcher to suspend it's execution until the patch is executed.


(3) Launching the mod (Function OnPageExit)


This step consists in reading the "commandline" value from the "[launcher]"
section. A simple "Exec" call is then performed with that command line.

This concludes the second part of the article. In our next (and final) part, we'll cover some best practices on using the launcher and we'll prepare some example files.

Post a Comment
click to sign in

You are not logged in, your comment will be anonymous unless you join the community today (totally free - or sign in with your social account on the right) which we encourage all contributors to do.

2000 characters limit; HTML formatting and smileys are not supported - text only

Icon
Aliens vs. Predator 2 Icon
Platform
Windows
Developed By
Herr_Alien
Contact
Send Message
Official Page
Moddb.com
Release Date
Released Sep 30, 2008
Mod Watch
Track this mod
Feature
Browse
Features
Report Abuse
Report article
Related Mods
AvP2 Team Fortress (Aliens vs. Predator 2)
AvP2 Team Fortress Aliens vs. Predator 2 - Multiplayer First Person Shooter
Related Games
Aliens vs. Predator 2
Aliens vs. Predator 2 Single & Multiplayer First Person Shooter
Related Groups
AvP2 Fortress
AvP2 Fortress Fans & Clans group with 5 members
Share and Mod
Share and Mod Hobbies & Interests group with 53 members