Author Topic: The beautiful guide on making a 1.2 QVM on Windows  (Read 7739 times)

Lonly

  • Posts: 231
  • Turrets: +9/-39
    • Host-Man
The beautiful guide on making a 1.2 QVM on Windows
« on: December 25, 2009, 12:10:08 am »
Follow these steps on coding a QVM on Microsoft Windows 2000/XP/Vista/7.
LAST UPDATED ON JANUARY 21, 2010

BEFORE ANYTHING, please read "The short and sweet guide to compiling SVN 895 on Windows", by Risujin, but skip instruction #9-14. If you need more help with installing MSYS check out this awesome tutorial on installing MSYS.

Most people on Windows XP have a Error with MSYS. MSYS would quickly open the close. This error occurs because of multiple reason. One reason is that your Operating System is outdated. Try buying a newer Operating System. Another reason is that your bin/msys-1.0.dll is old. Try downloading an updated msys-1.0.dll from Source Files. If neither of these help, try buying larger computer RAM (Random Access Memory). After doing all of this and MSYS still does not load try trouble shooting at the MSYS Forums.

Getting and Building a QVM

Now if you don't have these, install them now:

MinGW
What is MinGW? MinGW [Minimalist GNU for Windows], formerly mingw32, is a native software port of the GNU Compiler Collection (GCC) to Microsoft Windows, along with a set of freely distributable import libraries and header files for the Windows API.

MSYS
What is MSYS? MSYS [Minimalist GNU for Windows], (an acronym for "Minimal SYStem"), is a command line environment based on bash, (the GNU Bourne Again Shell).

Notepad++
What is Notepad++? Notepad++ [Notepad-Plus-Plus] is a text editor and source code editor for Windows, though it can run on Linux and Mac OS X, using software such as Wine[1].


What is Subversion? Subversion is a free/open-source version control system.


What is TortoiseSVN? TortoiseSVN is a Subversion client, implemented as a Microsoft Windows shell extension.

After installing all of the above restart/reboot your computer.

Getting a QVM

When your back at your desktop right click your desktop and click SVN Checkout. A screen will load, fill the information blanks with the following information given:
Press Ok and wait until the SVN Checkout is finished *Completed     At revision: ####*. Then close it by clicking Ok.

Building a QVM

First open/load MSYS. Now in MSYS type the following:
  • cd C:
  • cd tremulous
  • make
When the build is finished it should go back to what it was before. If there are no errors go to your build/vm folder and you will find your game.qvm there. To test it copy your game.qvm and drag your game.qvm into your server's vm folder. In your server's console type either !map atcs or for a easier way to test it do !devmap atcs. Test it and have fun!

Modifying a QVM


Opening the file

Open My Computer then click (DRIVE NAME)(C:). Open thefolder, then thefolder, after that open thefolder, and last but most importantly open the g_admin.c file with Notepad++. If Notepad++ is not in recommended programs to open it with, browse it:
Code: [Select]
C:\Program Files\Notepad++\notepad++.exe To jump to a line in Notepad++ go to the Search tab on the top, then click Go To... this will be needed all throughout the tutorial. (NOTE: of you change anything remember to copy the file and past it in a backup directory in case of a(n) error)

The beginning of your Commands

When g_admin.c is open the first command should be
Code: [Select]
 
    {"adjustban", G_admin_adjustban, "ban",
      "change the duration or reason of a ban.  duration is specified as "
      "numbers followed by units 'w' (weeks), 'd' (days), 'h' (hours) or "
      "'m' (minutes), or seconds if no units are specified.  if the duration is"
      " preceded by a + or -, the ban duration will be extended or shortened by"
      " the specified amount",
      "[^3ban#^7] (^5/mask^7) (^5duration^7) (^5reason^7)"
    },
Scroll down until you reach
Code: [Select]
   
    {"unmute", G_admin_mute, "mute",
      "unmute a muted player",
      "[^3name|slot#^7]"
    }
Below this type
Code: [Select]
//Beginning of (YOUR NAME)'s commands
or if you find this easier
Code: [Select]
//Start of (YOUR NAME)'s commands
my result would be
Code: [Select]
//Beginning of Lonly's commands
or
Code: [Select]
//Start of Lonly's commands

The layout of the Command

The way a Command is typed is
Code: [Select]
   
    {"(COMMAND)", G_admin_(COMMAND), "(COMMAND'S GENRE)",
      "(DESCRIPTION)",
      "(USAGE)"
    },
So if you want to make a Command you would do
Code: [Select]
   
    {"kick", G_admin_kick, "kick",
      "kick a player with an optional reason",
      "[^3name|slot#^7] (^5reason^7)"
    },
Your last command, at the bottom of it make sure that }, is only } all the other commands must have }, with the exception of the last one. Once you've typed all of your commands below that type
Code: [Select]
//End of (YOUR NAME)'s commands
or if you find this easier
Code: [Select]
//Finish of (YOUR NAME)'s commands
my result would be
Code: [Select]
//End of Lonly's commands
or
Code: [Select]
//Finish of Lonly's commands

The function of the Command

 
Now, jump to line 2890 in g_admin.c, below this is something else we won't be going over. At the bottom of the page is the "function" of the command. Basically it tells what the command should do and alternate errors and warnings.
Code: [Select]
 
    AP( va( "print \"^3%s: ^7the %s team has been %slocked by %s\n\"",
    command, BG_TeamName( team ), lock ? "" : "un",
    ent ? ent->client->pers.netname : "console" ) );

  return qtrue;
}
Below this type
Code: [Select]
//Beginning of (YOUR NAME)'s commands
or if you find this easier
Code: [Select]
//Start of (YOUR NAME)'s commands
my result would be
Code: [Select]
//Beginning of Lonly's commands
or
Code: [Select]
//Start of Lonly's commands
Now type,
Code: [Select]
qboolean G_admin_(YOUR COMMAND)( gentity_t *ent ) <- (YOUR COMMAND =  the one from g_admin.h)
Were going to follow our example (!kick) so it would be
Code: [Select]
qboolean G_admin_kick( gentity_t *ent )
Then below this we would add the function. This requires learning how to code. So once you learn how to code you code out the function, which in this case would be
Code: [Select]
{
  int pids[ MAX_CLIENTS ], found;
  char name[ MAX_NAME_LENGTH ], *reason, err[ MAX_STRING_CHARS ];
  int minargc;
  gentity_t *vic;

  minargc = 3;
  if( G_admin_permission( ent, ADMF_UNACCOUNTABLE ) )
    minargc = 2;

  if( trap_Argc() < minargc )
  {
    ADMP( "^3kick: ^7usage: kick [name] [reason]\n" );
    return qfalse;
  }
  trap_Argv( 1, name, sizeof( name ) );
  reason = ConcatArgs( 2 );
  if( ( found = G_ClientNumbersFromString( name, pids, MAX_CLIENTS ) ) != 1 )
  {
    G_MatchOnePlayer( pids, found, err, sizeof( err ) );
    ADMP( va( "^3kick: ^7%s\n", err ) );
    return qfalse;
  }
  vic = &g_entities[ pids[ 0 ] ];
  if( !admin_higher( ent, vic ) )
  {
    ADMP( "^3kick: ^7sorry, but your intended victim has a higher admin"
        " level than you\n" );
    return qfalse;
  }
  if( vic->client->pers.localClient )
  {
    ADMP( "^3kick: ^7disconnecting the host would end the game\n" );
    return qfalse;
  }
  admin_create_ban( ent,
    vic->client->pers.netname,
    vic->client->pers.guid,
    vic->client->pers.ip,
    MAX( 1, G_admin_parse_time( g_adminTempBan.string ) ),
    ( *reason ) ? reason : "kicked by admin" );
  admin_writeconfig();

  return qtrue;
}
Once we compile this and go into Tremulous and start a LAN server with the QVM we compiled and used !kick it would kick a player out of the server. When ever you see something like
Code: [Select]
   
    AP( va(
      "print \"^3denybuild: ^7building rights for ^7%s^7 revoked by ^7%s\n\"",
      vic->client->pers.netname,
      ( ent ) ? ent->client->pers.netname : "console" ) );
  }
  return qtrue;
}

If you were wondering what %s means, it is always found at the end of the print. In this case the first %s means
Code: [Select]
,vic->client->pers.netname

Which means the name given by the player who used the command, and the second %s means
Code: [Select]
,( ent ) ? ent->client->pers.netname : "console"

Which means the player's name who used the command. For example if I used deny build in Tremulous it would look like
Code: [Select]
!denybuild terminator
then a text will appear in the console/text saying
Code: [Select]
denybuild: building rights for terminator has been revoked by Lonly
If you are just wondering how to make something appear as text on someone's screen when they use the command you would use
Code: [Select]
qboolean G_admin_(COMMAND)( gentity_t *ent, int )
{
    ADMP("(YOUR TEXT)\n" );
  }
  return qtrue;
}
That will show up in the console, currently I do not know how to make it show up on the screen.

The g_admin.h

The G_admin_(COMMAND) would go in the g_admin.c and it sorta connects to the g_admin.h
If you open the g_admin.c, which is right next to the g_admin.h if it is sorted by name you would find at line 151
Code: [Select]
// ! command functions
Below this is a list of the G_admin_(COMMANDS)
Code: [Select]
qboolean G_admin_time( gentity_t *ent );
qboolean G_admin_setlevel( gentity_t *ent );
qboolean G_admin_kick( gentity_t *ent );
etc.
Below
Code: [Select]
qboolean G_admin_nextmap( gentity_t *ent );
qboolean G_admin_namelog( gentity_t *ent );
qboolean G_admin_lock( gentity_t *ent );
Below this type
Code: [Select]
//Beginning of (YOUR NAME)'s commands
or if you find this easier
Code: [Select]
//Start of (YOUR NAME)'s commands
my result would be
Code: [Select]
//Beginning of Lonly's commands
or
Code: [Select]
//Start of Lonly's commands
Then once you typed //Beginning of (YOUR NAME)'s commands in g_admin.c you would copy the G_admin_(COMMAND) and paste it below //Beginning of (YOUR NAME)'s commands. After you typed all of your G_admin_(COMMAND)s type below that
Code: [Select]
//End of (YOUR NAME)'s commands
or if you find this easier
Code: [Select]
//Finish of (YOUR NAME)'s commands
my result would be
Code: [Select]
//End of Lonly's commands
or
Code: [Select]
//Finish of Lonly's commands

The tremulous.h

Now open the tremulous.h (the last file if sorted by name)
In the tremulous.h you will find:
1. Classes/Levels and their abilities (speed, value, regen, and cost)
2. Weapons and their abilities
3. Upgrades and their abilities
4. Buildables and their abilities
5. Other
If you change anything remember  to write after your change //(default)
Also if you edit the tremulous.h remember to try your best to make the teams even to win
Some places you would find a time number, most of the time it goes by Milliseconds

The bg_misc.c

In the bg_misc.c you would find
1. Buildable names and their description
2. Classes/Levels names and their description
3. Error and warning text
3. *.PK3 directories
4. Weapon names and their description
5. Upgrade names and their description
6. Event names
7. Team names

The bg_misc.c (CONTINUED: Buildable's names)

The buildable names start at line 38
Code: [Select]
   "eggpod",              //char      *buildName; is the console CMD name to build the buildable. If you joined a server and (as a granger) typed /build eggpod you would build the buildable [EXAMPLE(1.1)] [AFTER ENTERED(1.1)].
Code: [Select]
   "Egg",                 //char      *humanName; is the buildable name in the list of buildables. [EXAMPLE(1.1)]
This goes for every other buildable. Buildable names end at line 599.

The bg_misc.c (CONTINUED: Class/Level's names)

Class/Level names starts at line 888.
Code: [Select]
   "builder",                                      //char    *className; is the name of the class that if you type in the console you spawn as it.
Code: [Select]
   "Responsible for building and maintaining all the alien structures. "
      "Has a weak melee slash attack.",
is the description of the class. [EXAMPLE(1.1)]
Class/level names end at line 1245.

The bg_misc.c (CONTINUED: Class/Level's names)

Error and warning text are scattered everywhere and they look like:
Code: [Select]

  {
    Com_Printf( S_COLOR_RED "ERROR: Buildable file %s doesn't exist\n", filename );
    return qfalse;
  }

The bg_misc.c (CONTINUED: *.PK3 directories)

*.PK3 Directories are scattered everywhere and some look like:
Code: [Select]
 
  {
    bc = BG_BuildableConfig( i );
    Com_Memset( bc, 0, sizeof( buildableConfig_t ) );

    BG_ParseBuildableFile( va( "configs/buildables/%s.cfg",
                               BG_Buildable( i )->name ), bc );
  }

The bg_misc.c (CONTINUED: Weapon names and descriptions)

Weapon names and their description starts at line 1935.
Code: [Select]
   ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages is the stages available to be bought at the Armoury.
Code: [Select]
   "rifle",              //char      *weaponName; is the text you would type in the console.
Code: [Select]
   "Rifle",              //char      *humanName; is the text on the list at the Armoury.
Code: [Select]
   "Basic weapon. Cased projectile weapon, with a slow clip based "
      "reload system.",
is the description of the weapon.
Code: [Select]
   qfalse,               //int       infiniteAmmo; qfalse means it does not have unlimited ammunition and qtrue means it has unlimited ammunition.
Code: [Select]
   qfalse,               //int       usesEnergy; qfalse means it does not use energy and qtrue means it uses energy.
Code: [Select]
   qfalse,               //qboolean  canZoom; qfalse means you cannot zoom in with it and qtrue means you can zoom in with it.
Code: [Select]
   qtrue,                  //qboolean purchasable qtrue means it is purchasable and qfalse means it is not purchasable.
Code: [Select]
   TEAM_HUMANS             //team_t  team; is the team that is allowed to purchase it/use it.
Weapon names and their description ends at line 2400.

The bg_misc.c (CONTINUED: Upgrade names and descriptions)

Upgrade names and their description starts at line 2454.
Code: [Select]
   ( 1 << S1 )|( 1 << S2 )|( 1 << S3 ), //int  stages is the stages available to be bought at the Armoury.
Code: [Select]
   "larmour",              //char  *upgradeName; is the text you would type in the console.
Code: [Select]
   "Light Armour",         //char  *humanName; is the text on the list at the Armoury.
Code: [Select]
   "Protective armour that helps to defend against light alien melee "
      "attacks.",
is the description of the upgrade.
Code: [Select]
   "icons/iconu_larmour", is the directory where the Upgrade's icon is found in the *.PK3.
Code: [Select]
   qtrue,                  //qboolean purchasable qtrue means it is purchasable and qfalse means it is not purchasable.
Code: [Select]
   qfalse,                 //qboolean usable qtrue means in the game it is not shaded grey and unusable and qfalse means it is grey and unusable (Default = qfalse because there is a bind to use it)
Code: [Select]
   TEAM_HUMANS             //team_t  team; is the team that is allowed to purchase it/use it.
Upgrade names and their description end at line 2566.

The bg_misc.c (CONTINUED: Event names)

Event names start at line 2733
We do not recommend changing this unless you are a professional. I do not know how to change this or what anything means.
Event names end at line 2832

The bg_misc.c (CONTINUED: Team names)

Team names start at line 3965
Here are the team names that you type in the CONSOLE. [Example: /team humans /team aliens /team spectators
Team names end at line 3974

The cg_main.c

Open the cg_main.c file in the src/cgame folder. Here are mostly *.PK3 directories and cg_commands. The *.PK3 directories are at lines 610 - 875. The cg_commands are at lines 50 - 355. This file is mostly edited by HUD makers and modders. 

Side Notes

NOTE: I am not responsible for server crashes. If any marks within the qvm are placed or deleted, errors will occur.
Wikipedia
Screenshot Studio
Gimp 2.6.8
000webhost
« Last Edit: January 28, 2010, 09:46:28 pm by Lonly »

Kiwi

  • Posts: 859
  • Turrets: +29/-9
Re: The beautiful guide on making a 1.2 QVM on Windows
« Reply #1 on: January 10, 2010, 10:50:50 pm »
:o Very nice job.  I'm not on windows, but you did a great job.

This should be stickied >.>

khalsa

  • Administrator
  • Posts: 597
  • Turrets: +187/-132
    • http://www.mercenariesguild.net
Re: The beautiful guide on making a 1.2 QVM on Windows
« Reply #2 on: January 20, 2010, 03:41:25 pm »
Good Job, however this really needs to be on the wiki.
}MG{ Mercenariesguild
ਮਨੁ ਜੀਤੇ ਜਗੁ ਜੀਤਿਆ

Kiwi

  • Posts: 859
  • Turrets: +29/-9
Re: The beautiful guide on making a 1.2 QVM on Windows
« Reply #3 on: January 20, 2010, 08:55:18 pm »
Fair enough ::)

Lonly

  • Posts: 231
  • Turrets: +9/-39
    • Host-Man
Re: The beautiful guide on making a 1.2 QVM on Windows
« Reply #4 on: January 21, 2010, 11:03:38 pm »
Good Job, however this really needs to be on the wiki.

Once in a while I might come back and forth to add a new file or something. If you want it on the Wiki, feel free to put it on there. Also guys check out this Youtube channel with awesome Tremulous tutorials!!!

This is a Youtube channel I made about 2 years ago, based on Tremulous and it was inactive for a very long time, but now its active again!!!

Visit the Old but now New Tremulous Youtube Channel.

MitSugna

  • Guest
Re: The beautiful guide on making a 1.2 QVM on Windows
« Reply #5 on: January 24, 2010, 10:30:11 am »
this might be a little confusing for starters. IMO, this should be a two part tutorial.
1) getting&building svn
2) modifying


Lonly

  • Posts: 231
  • Turrets: +9/-39
    • Host-Man
Re: The beautiful guide on making a 1.2 QVM on Windows
« Reply #6 on: January 27, 2010, 08:58:20 pm »
Ok thanks for the idea, I added some stuff and I'm going to be making it more... Noob friendly. Updated information and cropping so that images are links.
« Last Edit: January 27, 2010, 09:31:21 pm by Lonly »

Celestial_Rage

  • Posts: 636
  • Turrets: +120/-8
Re: The beautiful guide on making a 1.2 QVM on Windows
« Reply #7 on: January 28, 2010, 03:56:02 am »
Yeah, this is great idea. Good work Lonly :D
"The reports of my death are greatly exaggerated" ~Mark Twain