Games

avatar

How to quickly test your UT3 mods with nFringe

by on Friday, March 27th, 2009, under Computer Programming, Tutorials

If you are like me, you will quickly get sick of waiting for the game to load only so you can click through a bunch of menus and find out that your mod didn’t work.  Well I have good news!  There are some settings that we can pass into UT3.exe to make it jump right in and show us the results of our work.

Right-click your project in Visual Studio’s ‘Solution Explorer’, and then select ‘Properties’.  Choose the ‘Debug’ tab on the left and make the following changes:

  1. Check the ‘Load map at startup’ box, and then put in the map name of your choice (I personally use WAR-Torlan as this was always my favorite, even in UT2k4).
  2. After your map name, we need to specify some command line options.  We will use the ‘?Mutator=SuperStinger.SuperStinger’ option to load up our mutator*, and also the ‘?quickstart=1’ option so we don’t have to wait for the count down.  So our ‘Load map at startup’ field should read:  WAR-Torlan?Mutator=SuperStinger.SuperStinger?quickstart=1
  3. Check the ‘Disable startup movies’ box so we can bypass all of the advertisements
  4. If you want your input settings to be applied while you test your mods, we need to login to your on-line account.  Under ‘Additional Options’, add the following text replacing ‘your_login’ and ‘your_password’ with your online account information: -login=your_login -password=your_password

*If you don’t know what to supply for your ‘Mutator’ parameter, locate the .ini file for your mutator class in the ‘Solution Explorer’ and open it up.  You will see a line for the class name that you should use, in my case, it looks like this:

ClassName=SuperStinger.SuperStinger

UT3 quick start settings for testing mods

That’s it!  Enjoy… 😀

Tags: , , , , , , , ,

Friday, March 27th, 2009 Computer Programming, Tutorials 1 Comment
avatar

Creating your first Unreal Tournament 3 mutator (The SuperStinger)

by on Thursday, March 26th, 2009, under Computer Programming, Tutorials

In this tutorial, we will walk through creating a new ‘UnrealScript Game Mod’ project using nFringe and Visual Studio 2008.  This tutorial assumes you have a development environment setup and the Unreal Tournament 3 source code downloaded and installed as prescribed in my previous tutorial, setting up Visual Studio 2008 for UnrealScript development with nFringe.  It is also assumed that you know a little bit of Java (or similar C based languages).

For our first mod, were going to take the Stinger (which is like a chain gun) and make it shoot tank shells.  :p

Creating an UnrealScript Game Mod project

Open up Microsoft Visual Studio 2008 from your Start menu and then go to File -> New -> Project.  Select ‘UnrealScript’ for the ‘Project type’, and choose ‘UnrealScript Game Mod’ under ‘Templates’.  Now, give the project and solution a name, lets say ‘SuperStinger’, and then click ‘Ok’.

New UnrealScript Game Mod Project

Once your project is created, you will need to provide some settings to allow Visual Studio to work with the existing source and the game itself.  On the right side of the screen, you will see a ‘Solution Explorer’ with a list of items under it.  Right click on your ‘SuperStinger’ project (2nd item in the list) and go to ‘Properties’.  With the ‘General’ tab selected on the left, select ‘Unreal Tournament 3’ for the ‘Target Game’ and then click ‘Load UCC Defaults’.  This should populate most of the fields with the proper information, leaving only the ‘Reference Source Path’ empty (see below for what this should contain).  If for whatever reason the fields are not populated, they should be filled out as follows:

  • UCC Path: Point this to your UT3.exe file
  • UCC User Path: Point this to your “My Documents\My Games\Unreal Tournament 3\UTGame\” folder
  • UCC Game Prefix: This should contain “UT”
  • Reference Source Path:  If you followed my first tutorial, Setting up Visual Studio 2008 for UnrealScript development with nFringe, this path would point to your “My Documents\My Games\Unreal Tournament 3\UTGame\Src” folder.  Essentially, this should point to your UT3 source code.

Super Stinger Project General Settings

Finally, go to the ‘Debug’ tab on the left and point ‘Start Game Executable’ to your UT3.exe file.  This path should be the same as the ‘UCC Path’ on the ‘General’ tab.

At this point, you may want to stray off and read my tutorial on how to quickly test your UT3 mods with nFringe.  This will offer up some time saving settings you can apply here, but it is not necessary.

That’s ALMOST it!  There is one last little step that needs to be done before we hop into the code, and that is to save everything and then reload the solution (File -> Close Solution, then File -> Recent Projects -> …\SuperStinger.sln).  We do this to work around what I assume is a bug in nFringe.  If you try to build your solution prior to reloading it, you will get the following error:

The “Ucc” task was not given a value for the required parameter “UccPath”.

NOTE:  If you want to use Visual Studio’s ‘Class View’ window with the UT3 Source,  you will need to open one of the files in ‘Reference Source’ folder before the ‘Class View’ will populate.

Making the Super Stinger

Lets right click on the SuperStinger project again, and point to Add -> New Item.  Select ‘UT3 Weapon’ for the template, and give it the name ‘UTWeap_SuperStinger’.  Click ‘Add’.

Add New UT3 Weapon ClassNow, in the ‘Solution Explorer’ on the right, you will see a few new files.  Open up the UTWeap_SuperStinger.uc file by simply double-clicking on it.  Inside, you will find the following code:

class UTWeap_SuperStinger extends UTWeap_Enforcer;
 
DefaultProperties
{
}

The first thing I want you to notice is the DefaultProperties section.  This section allows to set the properties that our base class will use, and this is where we will be making our changes to the Stinger.  But first, it looks like our new weapon is inheriting off of the puny Enforcer.  Well, since we want to make a killer gun based off of the Stinger, we will change this to inherit from ‘UTWeap_Stinger’.

Now, this isn’t simply a guess for what to inherit off of.  If you want to see a list of the weapon classes available, all you need to do is expand the ‘Reference Source’ folder in your solution explorer, and then expand the ‘UTGame’ package.  All of the hand-held weapons are prefixed with ‘UTWeap_…’, so just scroll down until you get to that section and you will see the options that we can use for our base class.  In fact, go ahead and open up the UTWeap_Stinger class. 🙂  You will notice that the Stinger class is inheriting off of the UTWeapon class, and that class is holding all of the properties we want to reset.  If you want to look at the contents of the UTWeapon class, just right click on UTWeapon, and then click ‘Go To Definition’.  This will open up the class without you having to go find it in the solution explorer manually (though if you wanted to, its only a few items down the list from the Stinger class).

Anyway, go back to the Stinger class, scroll down to the bottom and take a look at the DefaultProperties section.  This is much of what makes the Stinger, well, a Stinger.  You will see that the weapon has a series of arrays for firing ammunition.

FiringStatesArray(0)=WeaponWindUp
WeaponFireTypes(0)=EWFT_InstantHit
FireInterval(0)=+0.1
WarmupShots(0)=5
WindDownTime(0)=0.27
Spread(0)=0.0675
InstantHitDamage(0)=14
InstantHitDamageTypes(0)=class'UTDmgType_StingerBullet'
ShotCost(1)=2
 
FiringStatesArray(1)=WeaponFiring
WeaponFireTypes(1)=EWFT_Projectile
WeaponProjectiles(1)=class'UTProj_StingerShard'
WarmupShots(1)=1
FireInterval(1)=+0.28
WindDownTime(1)=0.33

The ‘0’ index is used for the primary fire, and the ‘1’ index is the secondary fire, however in the Stinger’s case, the primary fire uses an EWFT_InstantHit WeaponFireType, not a Projectile.  I can tell from looking at the secondary fire that available projectile classes will be prefixed with ‘UTProj_…’, and looking through my file list in the ‘Solution Explorer’, I find ‘UTProj_TankShell.uc’. 😀

Lets go back to our UTWeap_SuperStinger class now armed with this information.  We’ll update what the class inherits off of and then change the default secondary fire WeaponProjectile class.  Our class should now look like this:

class UTWeap_SuperStinger extends UTWeap_Stinger;
 
DefaultProperties
{
    // Heheheheheheh...  We make things go boom!
    WeaponProjectiles(1)=class'UTProj_TankShell'
}

Setting up our mutator

Now, in your ‘Solution Explorer’ on the right, find the SuperStinger.uc file and open it up.  This is our mutator class that the game will use to include the SuperStinger.  In here you will see the following code:

class SuperStinger extends UTMutator;
 
function InitMutator( string Options, out string ErrorMessage )
{
    super.InitMutator( options, ErrorMessage );
}
 
function bool CheckReplacement( Actor Other )
{
    // return true to keep this actor
    return true;
}
 
DefaultProperties
{
}

So, as you can see, our default class is inheriting the UTMutator and we have a couple functions set up.  InitMutator will run when the mutator initializes, and this is where we will make the SuperStinger a part of the game.  CheckReplacement gets fired as the player “picks up” items in the game, and I believe for many other things that we are not concerned with at this point.  We will use this to make sure the player doesn’t pick up something much less cool (like the puny Enforcer) and replace our SuperStinger with it.  Take a look at the UPDATED code below and review the comments to understand what we are doing.

class SuperStinger extends UTMutator;
 
function InitMutator( string Options, out string ErrorMessage )
{
    // Make sure the game does not hold a null reference
    if(UTGame(WorldInfo.Game) != none)
    {
        // Insert our new SuperStinger Class into the first inventory slot
        // so that we start out with one instead of the puny Enforcer
        UTGame(WorldInfo.Game).DefaultInventory[0] = class'UTWeap_SuperStinger';
    }
    super.InitMutator( options, ErrorMessage );
}
 
function bool CheckReplacement( Actor Other )
{
    // See if the player has picked up the puny Enforcer
    if(Other.IsA('UTWeap_Enforcer'))
    {
        // Looks like the pickup was an Enforcer...  We'll replace it with our
        // shiny new SuperStinger so it doesn't take over the awesome gun
        // in the inventory
        ReplaceWith(Other, "UTWeap_SuperStinger");
    }
    // return true to keep this actor
    return true;
}
 
DefaultProperties
{
}

Now, save everything!  Finally, from the menu’s at the top of your window, click Debug -> Start Debugging.  When the game starts, look at the bottom of your screen (after selecting your map) for a “Mutators” button.  Click that, and you should see your ‘SuperStinger Mutator’ in the list.

Happy hunting, and try not to kill yourself too much 🙂

Tags: , , , , , , ,

Thursday, March 26th, 2009 Computer Programming, Tutorials 22 Comments
avatar

Setting up Visual Studio 2008 for UnrealScript development with nFringe

by on Thursday, March 26th, 2009, under Computer Programming, Tutorials

If you want to start writing mods for Unreal Tournament 3, this series of tutorials will cover everything you need to get you going.  Today, I am going to walk you through installing all of the software you need so you can begin working on your first mod.  All of the software we will use is free (as in beer) for non-commercial use, so the only thing you need to buy is Unreal Tournament 3 (UT3). 🙂

Required Software

First, install UT3 and upgrade it to the patch you wish to develop for.   To get the latest patch (recommended), go to UnrealTournament3.com and look for their downloads section.  You should easily be able to find the latest patch there.  I am using patch 4 (aka 1.4, aka UT3 v2.0) so if you want to use the same version that this tutorial uses, you can download it here.

If you don’t have Visual Studio 2008 installed, or if you only have the Express Edition of Visual Studio 2008, you will need to download and install the Visual Studio 2008 Shell.

Now we need to download and install the .NET Framework 3.5 (this step may not be required; look for “Microsoft .NET Framework 3.5” in Add/Remove Programs to determine if you need it).

Next, download and install nFringe from PixelMineGames.com. You can probably get the latest release and follow through my other tutorials just fine, though this tutorial uses version 1.0.19395.0

Finally, you will need to get the source code for Unreal Tournament 3 that matches your patch. You can download the latest patch source from EpicGames.com (look for the downloads section about half-way down on the page). Extract the ‘Src’ folder from your download into “My Documents\My Games\Unreal Tournament 3\UTGame\”. For example, in patch 4, the rar contains the folder “UT3ScriptSource_1.4\Development\Src\…” with a bunch of stuff under it.  Put that folder into your UTGame folder so that you end up with “My Documents\My Games\Unreal Tournament 3\UTGame\Src\…”.
NOTE: If you cannot open the download, try using WinRAR

Start Modding!

You are now ready to create your first project and begin hammering out some serious mods.  You may also want to check out my tutorial on creating your first Unreal Tournament 3 mutator (the SuperStinger).

Happy fragging! 😀

Tags: , , , , , , ,

Thursday, March 26th, 2009 Computer Programming, Tutorials No Comments