MultiPlayer Tutorial Part VI

In Part VI we will examine the non-ingame createserver menu and its associated popup menus to see any special features they may contain.

The createserver Menu

This is the menu used when we wish to create our own multiplayer game. Because we will be selecting from the maps that are avalible we must load the information about those maps when the menu opens. In the onOpen script we execute the uiScript loadArenas createserver command to do this. One of the oddities of the loadArenas command is that it is meant to be used, by default, from a menu named createserver. If you want to use it from a menu with another name then you must specify the menu name after the command. In this case, the createserver name has been added just to demonstrate the correct format. Only the version of the dll or qvm file avalible on this site allows the specifying of the menu name.

The Freeze Tag mod we are using as an example for this tutorial does not support some of the game types which are defined in the gameinfo.txt file. Specifically, it doesn't support One Flag CTF, Overload and Harvester (game types 5, 6 and 7). Since we don't want these games to appear when we are selecting our game type (using the ownerdraw UI_NETGAMETYPE command) we must mask them off using the uiScript maskGameType 5 6 7 command in the onOpen script. This will keep game types 5, 6 and 7 from appearing in our list of game types. Since we shouldn't leave these game types masked off after the menu is closed, in the onClose script we execute the uiScript unmaskGameType command to clear out the mask.

To display a picture of the maps we use the mappreview item, which uses the ownerdraw UI_STARTMAPCINEMATIC command to draw a cinematic or levelshot of the map we have selected from our list box. The mapback item draws a frame overtop of the map picture and also provides a background for the list box. The maplist item is a list box that uses the feeder FEEDER_ALLMAPS command to display a text listing of the maps we loaded using the uiScript loadArenas command back in the onOpen script. We use the columns command to format the text listing of the map names, moving it 5 pixels over from the right side of the list box and limiting the name to a maximum of 40 characters.

The varback item is used to display a background for the information we provide when creating the game. This information is entered or set using the following items.

The hostname item is an Editfield item attached to the sv_hostname cvar that is used to hold the name we wish to call our game.

The timelimit item is a Numeric Editfield item attached to the timelimit cvar which sets the time limit for the game.

The maxplayers item is also a Numeric Editfield item attached to the sv_maxclients cvar that sets the maximum number of clients that can join this game.

The reqpassword item is a Yes/No item attached to the g_needpass cvar that tells us if a password is required to join this game. The password item is an Editfield item attached to the g_password cvar that hold the password, if one is required.

The fraglimit item is a Numeric Editfield item attached to the fraglimit cvar which sets the frag limit for the game.

There are two items named gametype that allow us to select the type of game we wish to start. One just displays the "GameType:" text, while the other uses the ownerdraw UI_NETGAMETYPE command to allow us to select the correct game type. The mask we created with the uiScript maskGameType command back in the onOpen script affects what game types we can select from.

The punkbuster item is a Multi item attached to the sv_punkbuster cvar that is used to enable or disable Punkbuster for the game. If this item is set to Enabled then the clients must have Punkbuster enabled before they can join the game.

The pure item is a Yes/No item attached to the sv_pure cvar and is used to determine if this server is pure, which requires the clients to meet the standars for a pure game.

The dedicated item is a Multi item attached to the ui_dedicated cvar. This is a special cvar that allows us to delay starting a dedicated server until we are ready. You can chose between a Lan server or an Internet server if you want a dedicated server.

The autodown item is a Yes/No item attached to the sv_allowdownload cvar that indicates whether or not the client can download content from this server.

The minping item is a Numeric Editfield item attached to the sv_minping cvar that allows us to set the minimum ping allowed to a client attempting to join the game.

The maxping item is a Numeric Editfield item attached to the sv_maxping cvar that allows us to set the maximum ping allowed to a client attempting to join the game.

The synclient item is a Yes/No item attached to the g_synchronousclients cvar that indicates if we should use synchronise the clients.

The maxrate item is a Numeric Editfield item attached to the sv_maxrate cvar that allows us to set the maximum allowable transfer rate a client can have.

The reconnect item is a Numeric Editfield item attached to the sv_reconnectlimit cvar that allows us to set the maximum number times a client can recconect to the server.

The above items allow us to setup the game in the form we desire. Since there are many more cvars that can be set to customize the game than can be fitted onto a menu screen, we only included those cvars that are important or may be changed often. We handle the other cvars from the createbutton item. This item is a button item and it's action script is important.

In the action script we first close the menu. This not really necessary but it is good practice. The next command, exec "exec ft.cfg", is somewhat strange. What we attempting to do is to simulate typing exec ft.cfg in the console. That is what the exec command does, execute the following string as if it was typed at the console. And what does (simulating) typing exec ft.cfg in the console do you ask? Well, there are a number of cvars that should be set before starting our game but we didn't have the room to do it in this menu. Instead we put the cvar setting commands into a file, in this case called ft.cfg, in the baseq3 folder and then process that file using the (console) exec command. A quick look at this file reveals this :

    seta g_motd "Happy Freezing!"
    seta sv_privatePassword ""
seta sv_privateClients "0"
seta dmflags "0"
seta capturelimit "8" seta rconPassword "none"
    seta g_friendlyFire "0"
    seta g_teamAutoJoin "1"
    seta g_teamForceBalance "0"
    seta g_warmup "20"
    seta g_doWarmup "0"
    seta g_log ""
    seta g_banIPs ""
    seta g_filterBan "1"
    seta g_speed "320"
    seta g_gravity "800"
    seta g_knockback "1000"
    seta g_quadfactor "3"
    seta g_weaponrespawn "5"
    seta g_weaponTeamRespawn "5"
    seta g_forcerespawn "20"
    seta g_inactivity "60"
    seta g_allowVote "1"
    seta votelimit "50"
    seta bot_nochat "0"
    seta bot_minplayers "0"
    seta g_spSkill "4"
    seta bot_enable "1"
    seta com_hunkMegs "100"
    seta com_soundMegs "8"
    seta com_zoneMegs "16"
    seta com_maxfps "85"
    seta sv_floodProtect "1"

These are all cvars that probably won't change much from game to game so we can put them into this file and have them set when the game starts. This is a good compromise between setting everything in the menu and doing it all in a config file.

The last thing we do in the action script is to start the game, using the uiScript StartServer command. This creates the game, using all the cvars we previously set and using the map we had selected from the maplist item. It will also add bots to the game to fill client slots, if we have defined them as members of a team.

The teamsbutton item is a button item who's action script is used to open a popup menu named teams, which is used to add bots to the two teams. We'll look at that menu later.

The backbutton item is a button item used to close this menu and open the multi menu, returning us to the previous menu.


The teams Menu

This menu is a popup menu that is opened by the teamsbutton item in the createserver menu. For that reason, we include the popup command in the Overall Menu Information section. The background item and the title item are used to create the menu's background graphics.

This menu is used to select what bots, if any, we want to include in our game. It is broken down into two sections, team members for the Blue team and team members for the Red team. The items named teamblue are for the the Blue team and items named teamred are for the Red team. One item of each of these groups is used to create the title above each team list. It is a simple text item displaying the team name.

The rest of the items are just variations on the same theme. They use the ownerdraw UI_BLUETEAMx and ownerdraw UI_REDTEAMx commands to allow us to select a bot to fill a team slot. The list of bots we can select from is determined by the type of game we have selected in the createserver menu. If the game type is FFA or Tournament then we select from the bots defined in the scripts/bots.txt. If it is a team type game then we can only select from the bots defined in the characters section of the teaminfo.txt file.

There is also a backbutton item, which is a button item used to close this menu and open the createserver menu. Popup menus must be exitted this way in order to work correctly.

 

Part VII : Skirmish Menu

 

[Part I] [Part II] [Part III] [Part IV] [Part V] [Part VI] [Part VII] [Part VIII] [Part IX] [Part X]

 

Return to Home Page