Sign in to follow this  
ƒƒ5•ßahamutZero

Compiling the Source Code

Recommended Posts

For Advanced Users

-Required: C++ knowledge

Object-Oriented Programming (Optional)

C++ Compiler (Visual Studio 6 recommended)

Resource Editor (Optional)

DirectX SDK Installed and ready

-Get DirectX SDK here: DX9 SDK complete

 

 

Setting-up the directX sdk:

Download the kit.

Install it.

Set-up the following directories in VS- Tools->Options->Directories:

Executables:

C:\Program Files\Microsoft DirectX 9.0 SDK (December 2004)\Utilities\Bin\x86

 

Libraries:

C:\Program Files\Microsoft DirectX 9.0 SDK (December 2004)\Lib\x86

 

Includes:

C:\Program Files\Microsoft DirectX 9.0 SDK (December 2004)\Include

 

 

 

-Using the documented tutorials (Adding Demolition to the Source, for example), you really don't need those skills, basic C++ knowledge is good enough.

 

 

Here I will explain how to compile your modified version of NOLF2.

It is available in the documentation, so refer to it as well, use what is here for tips.

 

After compiling the source code, you will need to rez it in order to use it as a mod (which both client and server needs to activate).

 

After making the game compile sucessfully, you may create mods such as the Demolition Mod, or adding a vehicle from the tutorials given in the official documentation.

 

 

First, create a new folder, for example C:\NOLF2 to start.

Unzip the source zip file that comes with the toolkit.

 

I used Visual Studio C++, these next steps will be described according to my VisStu experience.

Prepare the compiler:

Tools>Options>Directories

Add all the necesary paths (see documentation)

This includes paths for DirectX 9 SDK if have'nt done so.

 

Registering Variables

Register Environment Variables (Right-click on My Computer), follow the paths given in the documentation:

 

Right-Click on My Compter

Click on the Advanced tab

Click on Environmental Variables button

Click on New (under your login or the system which is all logins within your user rights or both just to be extra sure)

 

To make an entry:

Example of the first entry:

 

After clicking new, you will get a box with 2 input fields.

For Variable name type-in: GAME_MAIN_DIR

For Variable value type-in: C:\NOLF2\

And click ok

 

Do this for all 3 entries and you're set.

 

 

 

Compiling:

You have 3 options to compile.

Double-click on the BuildFinal batch file to compile everything in the non-debug form.

After compilation (will take several minutes the first time!), the files will be located in your folder\GAME. So, if my Source was unzipped in C:\NOLF2, the set of files will appear in C:\NOLF2\GAME.

Check the log file in case of errors. (might have warnings at first compilation).

The log is kept next to the batch file.

Made a mistake? No prob, make changes and re-compile it, it should take much less time.

 

Modifying the source-code files:

Try Compiling the original code first!

You don't have to edit the files in VisStu, you may find it easier to open them in a simple text editor such as Notepad (remember to uncheck Read-Only in thier properties to save).

I recommend moving the files' positions in their explorer window if you will modify them to find them easily later.

 

 

Testing:

At your nolf2 GAME folder (not where the source is!), you use what was compiled to replace those files- but before you do so, take a moment to make a back-up of those files that will be replaced in case you want to make maps for regular nolf2.

So replace all files, and run a map on DEdit. If you want to test it with, for example, the first level of the game, when in the map you chose in DEdit, select leave in the menu, and hit New Game.

 

Resource Editing (optional):

If you want custom strings or make make changes to them, I recommend a resource editor over VS6's editor.

I used PE Explorer to add strings such as the message to pick-up a 'Bouncing Fire Bolt'.

These strings may be found in CRES.dll. Open it, make changes, and save it, but make sure it is still in .dll format.

Alternatively, if you have a version of C++ .NET you may use it to open-up CRES.dll to edit it (Visual Studio would truncate the entries, .net keeps it all)

 

 

Once your are satisfied with your changes, rez it!

REZzing a map is the same way to rez your content, but put the Rez inside Custom\Mods. Inside Mods, make a folder with the same name of your mod (case-sensative!), but without adding the .rez extension. Example: Custom\Mods\mymod\mymod.rez

 

When finished, start nolf, before hitting Play, hit Custom to activate it. You can only play on servers running the same mod, or you may host your own server the same way you run a server without a mod.

 

 

 

I will try to make updates to this to improve it...

Share this post


Link to post
Share on other sites

Thanks for that manual. I will try to compile source code.

Share this post


Link to post
Share on other sites

I don't seem to be able to compile the NOLF2 sources. It fails with the following error:

 

--------------------Configuration: ClientFxDLL - Win32 Final--------------------

Performing Custom Build Step on \Fox\No One Lives Forever 2\Tools\Source\Game\built\Final\ClientFxDll\ClientFx.fxd

copy \Fox\No One Lives Forever 2\Tools\Source\Game\built\Final\ClientFxDll\ClientFx.fxd J:\Fox\No One Lives Forever 2\Game

Das System kann die angegebene Datei nicht finden.

Error executing e:\windows\system32\cmd.exe.

 

Game.exe - 1 error(s), 0 warning(s)

 

The German sentence above means: The system can't find the file.

 

I set the env variables as described in the docs. I also set the 3 variables in the Visual Studio options (don't think that's neccessary, though). Do I have to set ALL the paths mentioned in the docs in ViStudio (like TO2 etc.)?

 

The only thing I haven't done is to install the DX development kit, hope I get around that one....but at least this error should have nothing to do with that, not?

 

Ahhrgl, VS is not too user friendly, compared to most HARDWARE development tools (even the bad ones....ISE).

Share this post


Link to post
Share on other sites

I'm not sure about DX, so no need to install it if it'll work...

 

And, I dont remember, but I think I copied over that ClientFx.fxd file (fx animations compiled by FXEdit tool), that can be found in the GAME folder.

 

 

edit: nevermind, ClientFx.fxd is different from the one I'm talking about

Share this post


Link to post
Share on other sites

The whole problem seems to be the line:

 

copy \Fox\No One Lives Forever 2\Tools\Source\Game\built\Final\ClientFxDll\ClientFx.fxd J:\Fox\No One Lives Forever 2\Game

 

Anyway I don't get this one. I interpret this as the standard copy command from the shell. This would mean that the ClientFx.fxd from my BUILT directory is copied into the game's Game directory, which I don't understand. These files should remain in the built/final/etc dirs as far as I know (the doc says the same).

 

By the way, I have ClientFx.fxd in BOTH dirs. I built the debug version. The file then is in the given directory too.

 

I hope the whole problem isn't the spaces in the pathname...

 

EDIT: DRAAAAAAAAAAAAAAAAAAAAAAT! I testet it. The problem is the pathname. Tryed to copy a dummy file with same pathnamen...same error..then I placed underscores instead of spaces: copying worked...

 

There goes the "Alexa anti-spawnkill-mod"!

 

Will try to change my Nolf directory by hand. The registry should be the "hardest" part of that...i hope.

 

ANOTHER EDIT: Jup, changed the pathname. Seems to work. The error when compiling the sources is now:

 

Cannot open include file: 'd3d8.h': No such file or directory

 

Seems like the DirectX SDK IS needed. :(

Edited by Alexa

Share this post


Link to post
Share on other sites

Alright, after that, I bet it will work. Setting-up dx should be easy, I'll edit my first post to add the dirs for dx.

Share this post


Link to post
Share on other sites

Works, could compile the source. Just didn't WANT to DL DX SDK since it's big and I had to verify my Windows Key for downloading, bah! :angry:

 

Yet some more questions:

 

- As mentioned above, why are files copied into my ORIGINAL NOLF2 directory? It seems I even built a new NOLF2.exe. Guess I have already overwritten some original NOLF files by using the BuildFinal.bat.

 

- How to built correctly. Using the batch files seems to built the whole game (and to overwrite my original one...). I just want to compile the file I changed + dependencies of course. I set ObjectShared as Active Project (it contains the class PlayerObj that I changed), which still leads to 50++ mb of resulting files. I should expect something like ObjectShared.lib, size below 2 Mb or so....

 

EDIT: I built ObjectShared.lib, size about 21 Mb. Perhaps of all classes to change, I chose the one which IS that big....

 

EDIT2: I should learn to read. The docs say that the env variables point to the install dir where the built files will be copied to. So reverse, if I don't want to overwrite my install, I have to use new dirs with same substructure, right?

Share this post


Link to post
Share on other sites

Works, could compile the source. Just didn't WANT to DL DX SDK since it's big and I had to verify my Windows Key for downloading, bah! :angry:

...

Yet some more questions:

...

-How to built correctly. Using the batch files seems to built the whole game (and to overwrite my original one...). I just want to compile the file I changed + dependencies of course

...

The docs say that the env variables point to the install dir where the built files will be copied to. So reverse, if I don't want to overwrite my install, I have to use new dirs with same substructure, right?

 

Dang, last time I didn't need to validate...

 

After the first compilation, it should only change the affected files for the next compilations. The files that were changed should be specified in the log file (information is added at the end of the file for each compile).

 

Yeah, use new dirs, so you don't modify your original nolf.

 

Share this post


Link to post
Share on other sites

WOW im an idot i just noticed the fxed thingy in the tools\bin how..what... is this for and

i used my map set up for rezing my mod thats not cool is it?

c:\mymap\mymaps ok this is too much for my burnout head

 

Share this post


Link to post
Share on other sites

The way you rez it is fine if it works :)

Yeah i just noticed it a few months ago, but had no clue how to use it or what it does for a while...

Anyway, it's actually a pretty cool tool. You open the fxd file from ClientFx folder in Game, and you can make new fx. You can edit existing Fx or, I would suggest copying and moding some to make 'new' fx.

 

Fx are game effects such as the 'muzzle' or flashes the guns make, the giant waterfall in the Japan level, smoke effects, loads of other effects. I used it to make smoke grenades, sloppy 'mini-flamethrower', fire-hydrant water burst (coming to Total Demolition map later), and reduced some effects that generally cause unnecessary lag.

Share this post


Link to post
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.

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.

Sign in to follow this