| Q2 Variant Loader |
| I wrote Q2V because I never get to play some of the interesting variations on Action Quake developed since the A-Team released the source, there aren't enough servers around to support even a few of these as permanent installations. The only way to configure them on a server is to exit the game, back up the original game module (gamex86.dll on a Windows system) and copy in the variant game library. Q2V allows the game engine to be changed (by the server-op or player voting) without closing Quake. It's also handy on a LAN or for switching between the single player variants available. |
| Q2V works by replacing the game engine and then loading the desired module indirectly for each new game, effectively sitting between quake2.exe and the renamed gamex86.dll. For the most part its existance is entirely transparent and most game calls are linked directly to the loaded game engine. Where Q2V hooks one of these calls to implement variant switching and other functions I've taken care to keep the code as tight as possible. For any intents and purposes there's zero overhead involved in running Q2V. |
| Although written with AQ in mind there's nothing Action specific hard-coded within Q2V and it could as easily be applied to any Q2 mod (or baseq2 itself). Wherever this file indicates that action is a default, the value used is in fact the same as the gamedir cvar (i.e. baseq2). Presently it's for Windows only, the code supports Linux but I haven't got around to working out how to build an .so with my compiler. |
| Installation |
| The grand plan was to create a single AQ installation which supports all the various versions as one seamless mod. Ultimately this will include Espionage, Gangsters, Dirty, Fireteams, Heroes, 3-Teams, Arena, PG-BUND's Edition, Knife AQ, Mr.Brian's CTB, Tournament Edition, Standard AQ1.52 and possibly even Terror Q2 (I realise this is a mod in its own right but it may well run as an AQ variant also). This UberAQ2 will already include configs and map rotations for each variant and mode (DM, TP, Team by Skin DM etc.) and be ready to run 'out of the zip' once maps are added. Also an updated HUD and the best weapon skins and sounds I can find for Action. |
| In truth none of the above is actually likely to happen so I've created this guide for anyone that wants to work up their own installation for Action or any other Q2 game. |
| * Create a "variants" sub-directory within your game folder (i.e. c:\quake2\action\variants\). |
| * Move your existing gamex86.dll to this new folder and rename it gamedir.dll (i.e. c:\quake2\action\variants\action.dll). |
| * Copy the Q2V gamex86.dll into your game folder (i.e. c:\quake2\action\gamex86.dll). |
| That's it, without setting any of the variables described below Q2V will by default load the gamedir.dll from the variants folder. When you next run the game the only change you'll notice is the Q2V banner in the console during the load. |
| Loading a Variant by Module Name |
| Now add additional renamed gamex86.dll's to the variants folder, start a game, and switch between them with the server command: sv variant {module} [{map}] - where {module} is the filename of the renamed game library without extension (i.e. \variants\ctb.dll = ctb) and {map} is the map to load for the new game (optional, if not specified Q2V will reload the current map). Any clients already connected to the server will be automatically re-connected to the new game. |
| Before restarting the game Q2V will first check in the variants folder for a config named for the {module} parameter (i.e. \variants\ctb.cfg) and exec this if it exists. If it doesn't exist it'll look for a config named for the gamedir (i.e. \variants\action.cfg) and run this instead as a default. Use these variant configs to reset dmflags, hostname (so that the current variant is visible in GameSpy and the like), ininame (this AQ cvar points to the map and team skins list) etc. Do not include a map command in any of these configs as this will conflict with Q2V's map load and hang Quake. |
| To specify the variant without first starting a game use: set gamevar {module} - and {module} will be loaded next map. In this case the variant config will not be executed so if using this in an autoexec.cfg to start a server you should add something like: |
| set gamevar ctb exec variants\ctb.cfg map ctbcity |
| - which is in fact all Q2V does when you use the variant command. |
| Configuring the VarList |
| The variant server command is a quick way of loading any game engine without setting up anything before hand. More involved setups (which allow different configurations based around a single game library) and voting are implemented using a varlist.ini which resides in the game folder (i.e. c:\quake2\action\varlist.ini). |
| Each line in this file lists a variant config to run, map to load and descriptive title separated by a ":" for example: |
| action:teamdepo:Teamplay tpffon:teamdepo:Teamplay (Friendly Fire) dm_new:matrix2:Deathmatch dm_old:locknload:Classic Deathmatch (Old Maps) mrbctb:ctbcity:Capture the Briefcase (Mr.Brian's) aqdtte::AQDT Tournament Edition |
| The first value corresponds to the {module} parameter used with the variant command and defines the filename of the config to run (i.e. \variants\mrbctb.cfg) and default library to load (i.e. \variants\mrbctb.dll). You can specify a different filename for the game engine by setting the cvar gamelib within the variant config allowing you to have multiple variants (or modes of play) configured around a single module. In the example above the tpffon.cfg, dm_old.cfg and dm_new.cfg would all include: set gamelib "action" - and differ mainly in the dmflags set, for example: |
| set hostname "Action Q2V Classic Deathmatch" set ininame "variants\dm_old.ini" set dmflags "512" set teamplay "0" set gamelib "action" |
| In general if you set a variable within one variant config you should set or reset it any every config. The exception to this is gamelib which Q2V always clears before executing a variant and only needs to be explicitly set if the game module filename differs from that of the variant config. Setting gamelib within the default gamedir.cfg (i.e. action.cfg) will cause problems if this is executed as a default by the variant command (above). |
| The second value in each line of the varlist.ini corresponds to the {map} parameter of the variant command and is again optional, if not specified Q2V will reload the current map. In the case of Action use the first map in the list specified by ininame. |
| The client command: varlist - will print a numbered list of these variants to the console using the text entered in the third value. The server command: sv varexec {index} - will switch to the variant {index} as numbered in the list displayed by varlist. |
| The varlist.ini file is fairly relaxed about formatting, blank lines and white space at the beginning and end of a line are fine but it doesn't cope with spaces either side of the ":"'s within the line. Comment out a whole line by adding a ";" at the beginning. Up to 32 variants are allowed, the entire file should be no more than 4096 bytes (4KB) in size. |
| Variant Voting |
| Two variables to set here, varvotereq is the point over which the variant will be switched by player voting as a percentage of connected clients and entered as a fraction (i.e. set varvotereq "0.75"), default is '0.5'. Additionally varvotemin specifies the minimum number of actual votes required, default is '0' (voting disabled), '1' allows any player to switch variants if they're alone on the server. I'd recommend: |
| set varvotereq "0.5" \\More than half the players. set varvotemin "2" \\Not less than two votes for. |
| The client command: varvote {index} - will vote for the variant {index} as numbered in the list displayed by varlist. An {index} of '0' will clear that client's vote. |
| The server's maxclients should also be set to 32 or less, the 33rd client connecting will almost certainly crash Q2V. |
| Individual Player Skins in Teamplay |
| Nothing to do with variants but I thought this would be a neat thing to add. Q2V can be set to overide the skin assignments made by the game in TP and allow each player to use a custom skin subject to server controlled provisos. To enable set clientskin to 1 (default is 0), no point in setting this for DM. |
| Q2V will look at the client's skin setting (model/skin) and if it finds the specified image on the server for that player's team model it'll use this instead. If for instance my client is set to "male/defunkt" and my team's model/skin is "sas/sasurban" but a defunkt.pcx also exists for the sas model I'll become "sas/defunkt", if the skin doesn't exist I'll remain "sas/sasurban". |
| It's really intended for clan matches but with a little care on the part of the server-op could be extended to public TP without risk of abuse. The important thing is to make sure that all skins allowed (by virtue of their existing in the server's model folder) are substantially based on the default for that team to ensure the two teams remain distinguishable. |
| In the example above, the server-op should remove all skins from \players\sas other than the default sasurban.pcx and those player skins vetted as being basically similar and approved for use. This will prevent a player from using a darker skin or one that's harder to tell apart from the opposing team's skin. If desired the removed skins can be compiled into a pak file (where Q2V won't detect them) so that the server remains a completely useable client. |
| Clan skins are usually placed in the folder for the model on which they're based however this isn't neccesarily a good idea if individual player skins are enabled. Firstly these skins would then be available in any public game with clientskin set and using this model and are unlikely to be suitably similar to the base skin in use. Worse, a player could use the opposing team's skin if both are based on the same model. A better plan is to implement each set of clan skins as a separate model by creating individual folders in the \players directory and duplicating the model and vwep files (*.md2). |
| In any case the server and client should both have model and skin downloads turned on so that the client can suck down any files it doesn't already have. Responsible admins should also ensure that the inset (i.e. defunkt_i.pcx) exists for each skin, there's nothing worse than having your console flooded with missing file messages should you encounter the same skin in DM. |
| All of which may seem like a lot of shagging around but being able to see who is where during a game (where each player has a name/number/symbol on their skin) is awesome for co-operative play and partnering. Some day I might convince my clan to send me photos so I can put their real faces on our skins. |
| Known Problems |
| * Works with the 3-Teams variant on FreaK's LAN (Win98) but not on the QuakeNZ servers (WinNT). |
| Possible Improvements |
| Q2V already does more than I'd originally intended but I've thought of a few enhancements. The great thing about the way it works is that any new functions are available to all variants: |
| * A Linux build since most public servers run this. Can anyone tell me how to build an .so with MSVC6? |
| * Implementing the %L location parsing in messaging. A couple of the AQ variants already do this but it'd be pretty cool to have the same function available in all of them. |
| * Optionally forcing a sniper's cl_run to 0 while zoomed in. Messing with the game itself isn't a can of worms I wanted to open but melee sniping has always shitted me a bit because it's not very real-world. |
| * Adding a 'squad' coms system allowing players to create and join private channels that define the destination of their say_team messages and also play custom wav files (located in a sound sub-directory named for the channel) to each member of their 'squad'. |
| * Adding menus to replace the varlist and varvote console commands. |
| * Adding a varinfo command to display a text file with a little information about the loaded variant. |
| * Doing away with static limits on the number of players, number of variants and size of varlist.ini. |
| * All of Q2V's variables are 'latched' meaning that changes won't take effect until a new game is started (or variant loaded), this should be changed for some settings, particularly voting. |
| * Adding maplist, mapvote and (maybe) mapinfo commands and associated maplist.ini. Already available in some variants and admin plug-ins but it'd be good to have this work in the same way as the variants and it'd be easy to do. |
| Downloads |
| Q2V (34.9KB)- The gamex86.dll and this guide only. |
| AQ2V (524KB) - Q2V plus a few example cfg's, ini's and dll's for AQ1.52, Mr.Brian's CTB and Heroes. To be unzipped to the /quake2/action folder, you'll need to have already installed the client files for Mr.Brian's. |
| Credits |
| Q2 Variant Loader v0.7 (7 June 2000) by deFUNKt. Mail: defunkt@hotmail.com Site: http://www.ionwerks.net/defunkt |
| Based on Zarjazz' PLUG-IN for Quake2 v1.01 (25 Feb 1999). Mail: zarjazz@barrysworld.com Site: http://www.barrysworld.com/zarjazz |
| Thanks to FreaK; master and molester of all things Action for testing and his work on configs and Sgt.Rock for running Q2V on the QuakeNZ servers while I've been writing it. |