Compiling QVMs without Visual C++

version 1.44
Last Updated: April 12, 2010
Tutorial created by neural-link, with lots of information from SARACEN. Thanks to Master of Miscellany (for telling me how to edit the batch files) and Raven Software

This tutorial is for the EF Multiplayer (Holomatch) code, and won't work with the Singleplayer code. However, I have some very brief notes on EF Single Player and EF2 code.

Tutorial Sections


Tools

  • Knowledge of C programming
  • EF 1.20 source code
  • Text Editor
    • Notepad++, Notepad, etc.
      Notepad++ has syntax color highlighting making the code easier to read, and allows for powerful searching.

Setting Things Up

I recommend downloading the ef1_20readytogo code off of my site. It has batch files that are already edited, which would be too lengthy to explain what had to be changed.

The Game Source is broken out into 3 areas

  • game - governs the game, runs on the server side.
  • cgame - governs the client side of the game, runs on the client side.
  • ui - handles the ui on the client side.

First off you need to get the EF 1.20 source code and put it in your root directory of your computer so it ends up being.

C:/stvoy

You might have to rename the folder code-dm to Code-DM, I'm not sure if it is case sensitive.

Windows 95 and 98 users need to do the following:
Edit your autoexec.bat file to include a path to c:\stvoy\bin_nt
(example)
SET PATH="C:\stvoy\bin_nt"
and reboot. If you dont know where the autoexec.bat file is, it is in your C:\ directory. It can be edited it with any text editor, like Notepad or in DOS.

Windows 2000 and XP users need to do the following:
Right click My Computer, pick the advanced tab, click on Enviroment Variables. In System Variables, click on Path and pick edit then add
;C:\stvoy\bin_nt
to the very end of the line, and yes that semicolon needs to be there.


Starting a Fresh Code Base

To prevent problems from editing the original code and so you always have a fresh start for new mods, create a source directory inside your mod's subdirectory C:\stvoy\yourmod\Code-DM
From now on, when I refer to the source directory, I mean the new one you just made under your mod's directory.

From inside C:\stvoy\Code-DM copy the cgame, game, ui and qcommon directories to your new source directory.

Now find the three *.q3asm files in Code-DM\cgame, Code-DM\game and Code-DM\ui folders. Edit each one of these so that the first line has the exact directory\filename that the outputted *.qvm file for each should be, inside the quotes, the first line of cgame.q3asm should read
-o "C:\stvoy\yourmod\vm\cgame"

the first line of game.q3asm should read
-o "C:\stvoy\yourmod\vm\qagame"

and the first line of ui.q3asm should read
-o "C:\stvoy\yourmod\ui"

Now, open Code-DM\game\g_local.h
You see that line that says #define GAMEVERSION "baseef"? Change the baseef to something relevant to your mod's subdirectory

(example)
#define GAMEVERSION "YourMod"

Now open Code-DM\game\bg_public.h and do the same sort of thing for the line #define GAME_VERSION "baseef-1" and change it to something like

(example)
#define GAME_VERSION "YourMod-1"


Test a Quick Mod

Slow Stasis Projectiles - TestMod
Make sure to copy the stuff as indicated in the above section, so you dont change the original code. That way you always have a fresh start for new mods.
----------------------
1. Open the g_local.h file in the C:\stvoy\TestMod\Code-DM\game and change the GAMEVERSION define from baseef to TestMod

2. Save g_local.h

3. Open the g_weapon.c file in the C:\stvoy\TestMod\Code-DM\game

4. Go to line #706 and change the 1100 to 300. The old line reads:

 #define STASIS_VELOCITY 1100 //800 //650

The new line should read

#define STASIS_VELOCITY 300 //800 //650

5. Save g_weapon.c

6. Goto C:\stvoy\testmod\Code-DM\game and run the game.bat file. This ultimately produces a qagame.qvm in the \TestMod\vm\ path.

7. Make a TestMod path under your STEF directory. This will be a sibling to baseef

8. Move qagame.qvm to \YourSTEFPath\TestMod\vm\
which would be
C:\Program Files\Raven\Star Trek Voyager Elite Force\TestMod\vm\
if you installed it with the default path.

9. Run STEF with the following command line stvoyhm +set fs_game TestMod
If you dont know how, open a new file in a text editor and type
stvoyhm +set fs_game TestMod
and then save it as TestMod.bat and then click it. And it will start it for you.

10. TestMod should be the referenced game and you should be able to catch up with and outrun your rockets.

You might get a syntax error due to the batch files I edited, but it should still compile fine. Also if you get the following error (when you are running the game):

Client/Server game mismatch: baseef-1/testmod-1

that means you have to run the game with the pureserver option off by adding +set sv_pure 0 so your new command line would be

stvoyhm +set fs_game TestMod +set sv_pure 0

and that will turn pureserver off for you.


Making Your Mod Show Up on the Mod List in the Game

You need to create a description.txt file inside your pk3 file in your mod directory before it will show up on the in-game menu. Create a description.txt file and put the mods name in it, this is the name that will show up in the Mod list. You can use WinZIP or Pakscape to create your pk3 file. Or if you are on Windows ME/2000/XP or newer you can use Windows to create the zip file and rename the extension to pk3. Add the description.txt file to your pk3 file and store it in your TestMod directory. Now create a vm directory and place the qvm files in the vm directory in your pk3 file.


Compiling

Just a quick note to those who are unfamiliar with Quake III programming - whenever you make a modification to one of the source code files, you usually only need to run the *.bat file in that directory (this will recompile the *.qvm file that that source file is a part of). However, if you make any modifications to any of the Code-DM\game\bg_*.* files, you need to recompile all three *.qvms. And it's also worth mentioning that you should NEVER edit either of the Code-DM\game\q_shared.* files - they are both part of the source code to the game engine and so any changes made to those files would require recompiling stvoyHM.exe - which nobody but Raven Software can do!

Now Run STEF with the following command line stvoyhm +set fs_game YourMod
If you dont know how, open a new file in a text editor and type
stvoyhm +set fs_game YourMod
and then save it as YourMod.bat and then double click it. And it will start your mod for you.

Now you can edit the code and compile without using an expensive compiler! You might get a syntax error due to the batch files I edited, but it should still compile fine. Also if you get the following error (when you are running the game):

Client/Server game mismatch: baseef-1/testmod-1

that means you have to run the game with the pureserver option off. It may reset it to on, so make sure it is off before you start or just make the YourMod.bat file

stvoyhm +set fs_game YourMod +set sv_pure 0

and that will make the turn pureserver off for you.


Additional Notes

It is best to know the C programming language before you begin. It's possible to modify the code without any programming experience, but things that should take a minute to do will take you much longer. If you are new to C or need to brush up on some parts of it, check out Eddie's Basic Guide to C Programming.

If you have trouble figuring out something, try looking for a similar effect or feature elsewhere in the code, often you can take a look how something was done elsewhere and modify that to your needs in another situation. You can ask others for help, but don't expect them to code everything for you.

Elite Force is based on the Quake3 engine, however there are some differences. The weapons, gamemodes, powerups, holdables, pickups, effects and UI will be different or renamed or in a different order. EF has ladders, alternate firing modes and supports MDR player models whereas Q3 does not.

Here are some links that could be of use

Code3Arena - probably the best Q3 coding site on the net.
Quake Style - Q3A coding tutorials
QDevels - Q2 tutorials, but they could give you an idea

I also have a archive of Q3 mods that open sourced their code.


EF Single Player Code Compiling?

Again this tutorial is NOT meant to compile the single player code.

EF's Single Player (SP) code is in C++ so if you decide to edit the single player code I recommend that you USE Visual C++ to compile the Single Player code. You can use other compilers (there are free ones), but it may take some configuration. I won't write a tutorial on compiling the SP code, because its just too easy to setup with Visual C++. Download the EF Single Player code here


EF2 Compiling?

EF2 is in C++ and I would recommend that you USE Visual C++ to compile your EF2. You can use other compilers (there are free ones), but it may take some configuration. Compiling the code for EF2 will effect both multiplayer and single player modes. I won't write a tutorial on compiling the EF2 code, because its just too easy to setup with Visual C++. Download the EF2 Source Code here