Q2JAVA EXTRAS

The Q2Java distribution includes a few extra goodies intended to 
demonstrate various interesting things programming in Java allows.  They 
are implemented as gamelets you can load either at startup on the 
command line with a command like: 

    quake2 +set game q2java +set gamelets q2java.baseq2.BaseQ2+<gamelet>
    
Or in a properties file with lines like:

    q2java.gamelet.1=q2java.baseq2.BaseQ2
    q2java.gamelet.2=<class> [<alias-name>]
    q2java.gamelet.3=<class> [<alias-name>]
    
or in some cases while the game is running with a console command like:

    sv addgamelet <class> [<alias-name>]
    
The <class>'s are:


--------------
Grappling Hook
--------------

    q2java.ctf.GrapplingHook
    
        Load this and everybody gets a grappling hook. Doesn't matter
        if you're playing CTF, DM, Paranoia, etc.  Players don't even
        have to respawn to start using them (but if the gamelet
        is unloaded, players won't lose the hook until they respawn).


--------------
LevelChanger
--------------

    q2java.baseq2.LevelChanger
    
        Watches the timelimit and fraglimit, decides when to start
        intermission, and what the next map will be based on the
        sv_maplist CVar or the info embedded in the maps themselves.
        
        
-------------
New XML/DOM Stuff
-------------

    barryp.map.NoBFG
    
        Removes BFGs from map.  Simple example of altering the level's 
        DOM Document before items are spawnned.
        
    barryp.map.RandomWeapons
    
        Randomly changes the class of each weapon on a map.  The weapons
        appear in the same spots.  For example: where you'd expect a 
        RocketLauncher to appear, you may now find a BFG instead.        
        
    barryp.map.ShuffleWeapons
    
        Similar to RandomWeapons, but smarter in that it keeps the same weapon 
        weapon balance - just shifts the positions around.  Also updates nearby
        ammo to match the shifted weapon classes.
        
    barryp.map.XMLMaps
    
        When a new level starts, tries to read a file named maps/<mapname><suffix>
        for a description of the entities that will appear on the map.  
                
        The value of <suffix> is initially just ".xml" but that can be changed
        with the SVCMD
          
          sv <alias>.suffix <newsuffix>
          
        Where <alias> is the alias of a XMLMaps gamelet (you can load multiple
        instances now). So for example, you might do something like this:
        
          sv addgamelet barryp.map.XMLMaps xml
          sv addgamelet barryp.map.XMLMaps xml2
          sv xml2.suffix -ctf.xml
          
        To have the server read in <mapname>.xml and <mapname>-ctf.xml
        files.
        
        The gamelet can also generate XML files based on the information
        embedded in the .bsp files, by calling
        
          sv <alias>.makexml yes
          
        a new file named sandbox/<mapname><suffix> will be created, which an 
        admin can then move to the "maps" directory and alter as they see fit.
        
        Executing that same SVCMD with "no" will turn off XML generation.
        
        
    barryp.map.MapCVars (only useful if XMLMaps or similar Gamelet is also loaded)
    
        Looks for tags of the form: 
        
            <cvar name="xxx" value="yyy"/>
           
        For each one it finds, it sets the named cvar to the specified value
        before a level starts, and restores it to its original value when
        the map ends.  Handy for things like setting "fraglimit" and 
        "timelimit" to a specific value for a given map (but not limited to
        those cvars)
    

    barryp.map.MapGamelets (only useful if XMLMaps or similar Gamelet is also loaded)
    
        Looks for tags of the form:                     
        
            <gamelet class="xxx" alias="yyy"/>
            
        For each one it finds, it loads and initializes the gamelet before
        the map starts, and unloads it when the map is finished.   Great
        for associating a gamelet like "barryp.flashgrenade.FlashGrenades"
        or "q2java.ctf.CTF" with certain maps.
        
-----------------------
Gamelets by Pete Donald 
-----------------------

    donaldp.fixedskin.GameModule
    
        Prevents players from changing skins

    
    donaldp.gibstat.GameModule
    
        Generate Gibstats from a running game
        
        
    donaldp.ipban.GameModule
    
        Implements IP/Name banning to keep obnoxious pukes out.      
        
--------------
Older gamelets
--------------

    barryp.autoload.GameModule

        Simple gamelet that automatically exec's a file named "autoload.cfg" 
        as soon as possible once the game is running.  Great for loading 
        other gamelets like barryp.telnet.GameModule.   
        
        For example, on my test server, I have a batch file that loads 
        Q2Java with the parameter: 
        
            +set gamelets q2java.baseq2.BaseQ2+barryp.autoload.GameModule
            
        and have a file named "autoload.cfg" that looks something like 
        this:    
        
            sv addgamelet barryp.telnet.GameModule telnet 
            sv telnet.start 1100 -nocmd 
            sv telnet.log on 
            set timelimit 15 
            gamemap q2dm1

        so that after the game has started, the "barryp.telnet.GameModule" 
        gamelet is loaded with the alias "telnet", then the "telnet" gamelet 
        is given a few commands to start listening to port 1100 and to start 
        logging connections.  Finally the timelimit CVAR is set, and the map 
        is set to q2dm1.

    barryp.bountyhunters.BountyHunters
    
        Changes the rules of DM so that players are assigned particular
        victims.  A Direction indicator and Range indicator help in
        finding your target, and a flashing crosshair helps confirm you're
        aiming at the right guy.  The complication is that while you're
        hunting a particular player, someone is hunting -you-.  You get
        points for killing your assigned victim or your stalker, and lose
        points for killing innocent victims.        
        
    barryp.flashgrenade.FlashGrenades
    
        Replaces the baseq2.HandGrenade class to add the extra behavior
        of temporarily blinding enemies - based on how far they are
        from the explosion, and what direction they're looking.

    barryp.paranoia.Paranoia
    
        Changes the rules of DM so that players are paired off, one
        is assigned as a stalker, the other as a paranoid victim.  
        A Direction indicator helps the stalker find his victim and a 
        flashing crosshair helps confirm they're aiming at the right guy.
        A Range indicator give the victim a sense of how close his stalker is.
        You get points for killing your assigned victim or your stalker, 
        and lose points for killing innocent victims.  Players that aren't
        paired off with another player are "loose cannons", and can kill or
        be killed by anyone for a smaller number of points.
               
    barryp.persist.GameModule
    
        After this gamelet is loaded, any player that connects is a 
        "persistant" player - meaning that when they quit, their settings 
        (including weapons, ammo, current health, etc.) are saved in a file 
        (in the sandbox directory), and when they reconnect - their 
        settings are automatically restored.   (Being able to store and 
        retrieve a player's state is the first step towards multiserver 
        clustering)

    barryp.rocketmania.GameModule

        Demonstrates replacement of the basic game's weapons.  Includes a 
        blaster with that fires small rockets, a machinegun that fires 
        rockets as well as bullets, and a rocketlauncher that fires more 
        powerful rockets.

    barryp.telnet.GameModule

        Allows telnet or MUD clients to act as remote consoles. 
        
        To enable the telnet server you'll have to set the game
        to run at either security level 0 or 1, the default level
        of 2 will prevent the Telnet server from running.  
        
        For JDK 1.2, you'll need to edit your security policy file to 
        allow access to some network ports.  The sample policy file 
        contains a commented-out line showing what's necessary
        
        This is one of the oldest gamelets, and configuration is a bit 
        awkward.  It really needs to be reworked to take advantage of 
        the new property file support added with Q2Java 0.7.  What 
        follows are the old instructions for usage....
        
            ----------------------
        
        You can load the Telnet server package at the command line
        with a statement such as:

            +set gamelets q2java.baseq2.BaseQ2+barryp.telnet.GameModule[telnet]

        To actually start a server session, set the port you want to 
        run the server on (for example: 1200) at the command line with 
        the option:

            +set telnet_port 1200

        where <n> is a port number (greater than 1023 if in security level 1)

        You can password-protect (for example, the password: foobar) the 
        Telnet server with the option:

            +set telnet_password foobar

        You can also load the Telnet server package and start a session
        after the game has started, by typing on the console:

            sv addgamelet barryp.telnet.GameModule telnet
            sv telnet.start 1200 -pass foobar
       
        The Telnet server will relay all Game output to any number of
        connected telnet clients, and allow the client to send chat
        messages or issue commands to the game.

        Unfortunately, the Telnet server has no way to intercept
        output from the Quake2.exe itself, so it's not -quite-
        a perfect remote console..but it's still useful, especially
        for debugging.  MUD clients work well with the server, since
        they usually have large scrollback buffers, and separate
        input and output windows.

        If you're using a stock Telnet client, turn the "local-echo"
        feature on to see what you're typing. MUD clients usually operate
        this way by default.
        

    barryp.testbot.GameModule

        A very very very simple bot that just stands where it's spawned, 
        but it demonstrates subclassing the q2java.baseq2.Player class to 
        create somthing that looks and mostly acts like a player, even though 
        nobody's actually controlling it though a Q2 client program.

        You have to be running Quake2 in server mode (as opposed to         
        single-player mode) in order to spawn bots.  Once the game is 
        started, drop down the console and type something like:

            sv addgamelet barryp.testbot.GameModule fred             
            sv addgamelet barryp.testbot.GameModule barney

        to create a bots named "fred" and "barney".  They will be standing         
        on map spawnpoints (finding them bot can be a pain on some maps), 
        and you can issue some commands to them like:

            sv barney.help      // gets barney's current status             
            sv fred.skin <skin> // changes the bot's skin, try something like 
                                   "female/athena" to give fred a new look.

            sv fred.cmd <command>  // cause the bot to execute a                                       
                                      player-command                                  

            sv fred.locale         // will tell you what locale fred uses                                       
                                      when speaking

            sv fred.locals <new-locale> // changes fred's locale

        The locales are strings that are either:

            "<language-code>" or "<language-code>_<country-code>" or             
            "<language-code>_<country-code>_<variant>"

        The language codes are two-letter ISO language codes, such as "en"         
        for english and "fr" for french.  The country codes are two-letter 
        ISO country codes like "US" for the United States, "CA" for Canada, 
        "FR" for France and so on. The variants are user-defined.  So, a 
        bot might have its locale set to things like:
        
            en                - English in general
            en_US             - English as spoken in the U.S.
            en_US_surferdude  - Surfer Dude variant of U.S. English
            en_CA             - English as spoken in Canada
            fr                - French in general
            fr_CA             - French Canadian
            fr_FR             - French as spoken in France
            
        Anyhow, the bot doesn't actually speak all those languages, but 
        they could be easily added - look in the 
        <gamedir>\classes\barryp\testbot directory for the files named 
        talk*.properties to see which locales are currently supported, and 
        feel free to create your own.            
        
        To cause the bot to speak, injure it

------------------------------------        

Enjoy
        
        Barry