GAMEMODE: Difference between revisions

From Zandronum Wiki
(Added a list of built-in CVars that are supported by GAMEMODE in Zandronum 3.2.)
(Add special lump warning box)
Tag: Source edit
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This special lump allows the current SkullTag game modes to be reconfigured.  Such game modes can be Deathmatch, Duel, SkullTag, Capture the Flag, Possession, etc....
{{SpecialLumpWarning}}
The hard coded game modes internally use a bunch of flags to configure certain stuff and to share code. The GAMEMODE lump allows you to alter the flags a game mode uses so that you can combine game mode traits. The syntax for the lump is as follows:
'''GAMEMODE''' is a special lump that allows mods to change the attributes of [[Zandronum]]'s existing [[Game modes|game modes]], and initialise and enforce certain settings when certain game modes are in use.


<pre>
The full syntax of the lump is as such:
GAMEMODENAME
{
    RemoveFlag FLAGNAME1
    AddFlag FLAGNAME2
    Property "Value"


    GameSettings
GAMEMODENAME
    {
{
        flagname1 = <true/false>
    RemoveFlag FLAGNAME1
        flagname2 = <true/false>
    AddFlag FLAGNAME2
    }
    Property "Value"
 
    LockedGameSettings
    GameSettings
    {
    {
        flagname3 = <true/false>
        CVar1 = <value>
    }
        CVar2 = <value>
}
</pre>
        offlineonly {{Devfeature|3.2|alpha}}
        {
            CVar3 = <value>
            CVar4 = <value>
        }
       
        onlineonly {{Devfeature|3.2|alpha}}
        {
            CVar5 = <value>
            CVar6 = <value>
        }
    }
    LockedGameSettings
    {
        CVar7 = <value>
    }
}


=Flags=
=Flags=
*''COOPERATIVE''
*<code>'''COOPERATIVE'''</code>
Cooperative is a flag that distinguishes the coop modes ([[Game_Modes#Cooperative|Cooperative]], [[Game_Modes#Cooperative_Survival|Survival]], [[Game_Modes#Invasion|Invasion]]) from others game modes.
Cooperative is a flag that distinguishes the coop modes ([[Game_Modes#Cooperative|Cooperative]], [[Game_Modes#Cooperative_Survival|Survival]], [[Game_Modes#Invasion|Invasion]]) from others game modes.
*''DEATHMATCH''
*<code>'''DEATHMATCH'''</code>
Players are spawned at deathmatch starts (needs Zandronum 3.0 to work properly).
Players are spawned at deathmatch starts (needs Zandronum 3.0 to work properly).  
*''TEAMGAME''
*<code>'''TEAMGAME'''</code>
Players are spawned at team starts (needs Zandronum 3.0 to work properly).
Players are spawned at team starts (needs Zandronum 3.0 to work properly).
*''USEFLAGASTEAMITEM''
*<code>'''USEFLAGASTEAMITEM'''</code>
*''PLAYERSEARNKILLS''
Forces a game mode to use a team's flag item or icon instead of their skull.
Display the players kills (monsters) on the scoreboard
*<code>'''PLAYERSEARNKILLS'''</code>
*''PLAYERSEARNFRAGS''
Players earn kills from monsters. This also displays their kills on the scoreboard.
Display the players frags on the scoreboard
*<code>'''PLAYERSEARNFRAGS'''</code>
*''PLAYERSEARNPOINTS''
Players/teams win the game by killing enemy players.
Display the players points (score in ctf)
*<code>'''PLAYERSEARNPOINTS'''</code>
*''PLAYERSEARNWINS''
Players or teams win the game by earning points (e.g. capturing the flag in CTF). This also displays how many points a player or team has on the scoreboard.
Display the players wins on the scoreboard (used in lms)
*<code>'''PLAYERSEARNWINS'''</code>
*''DONTSPAWNMAPTHINGS''
Players or teams win the game by winning rounds (particularly used in LMS). This also displays how many wins a player or team has on the scoreboard
Items and weapons aren't spawned (monsters are still spawned)
*<code>'''DONTSPAWNMAPTHINGS'''</code>
*''MAPRESETS''
Items and weapons aren't spawned (monsters are still spawned).
*''DEADSPECTATORS''
*<code>'''MAPRESETS'''</code>
*''PLAYERSONTEAMS''
The map can be reset to the same state that it was when it was first started. The [[ResetMap]] ACS function and "ResetMap" CCMD require this flag to be added to work.
Display the team selection menu when pressing the spacebar (joining)
*<code>'''DEADSPECTATORS'''</code>
*''USEMAXLIVES''
Enables support for dead spectators, which are players that are dead and cannot rejoin until the round is over.
*''USETEAMITEM''
*<code>'''PLAYERSONTEAMS'''</code>
*''MAPRESET_RESETS_MAPTIME''
Players are organized into teams, and displays the team selection menu when pressing the spacebar to join the game.
*''DONTPRINTPLAYERSLEFT''
*<code>'''USEMAXLIVES'''</code>
Players have a limited number of lives, controlled by the [[Server_Variables#sv_maxlives|sv_maxlives]] CVar.
*<code>'''USETEAMITEM'''</code>
Enables support for a team's flag or skull item in CTF and Skulltag respectively, or the white flag in 1-flag CTF.
* <code>'''MAPRESET_RESETS_MAPTIME'''</code>
Resetting the map also resets the level time. This also prevents the time limit from being active while the game isn't in progress.
* <code>'''DONTPRINTPLAYERSLEFT'''</code>
Prevents the "x allies/opponents left" message from being drawn on the screen.
Prevents the "x allies/opponents left" message from being drawn on the screen.


=Properties=
=Properties=
*''Name''
* <code>'''Name'''</code>
The name of the game mode as it appears on the scoreboard, countdown screen, and server console window.
The name of the game mode as it appears on the scoreboard, countdown screen, and server console window.  
*''ShortName''
*<code>'''ShortName'''</code>
This is generally a shorter and abbreviated version of the game mode's name. This is only used in the built-in server browser.
This is generally a shorter and abbreviated version of the game mode's name. This is only used in the built-in server browser.  
*''F1Texture''
*<code>'''F1Texture'''</code>
The graphic that will be drawn in the "Read This!" menu in non-single player games if no other help page is defined.
The graphic that will be drawn in the "Read This!" menu in non-single player games if no other help page is defined.
*<code>'''WelcomeSound'''</code> {{Devfeature|3.2|alpha}}
The announcer sound that's played at the start of a new game. For example, "welcome to capture the flag" or "welcome to Skulltag" in CTF and Skulltag respectively.


=Gameplay and compatibility settings=
=Gameplay and Compatibility Settings=
You can initialize any flags belonging to gameplay or compatibility flagsets for a particular game mode. The flagsets that are currently supported are:
You can initialize any flags belonging to gameplay or compatibility flagsets for a particular game mode. The flagsets that are currently supported are:
*[[DMFlags#DMFlags|DMFlags]]
*[[DMFlags#DMFlags|DMFlags]]
*[[DMFlags#DMFlags2|DMFlags2]]
*[[DMFlags#DMFlags2|DMFlags2]]
Line 71: Line 91:
{{Devfeature|3.2|alpha}} The following CVars are also supported:
{{Devfeature|3.2|alpha}} The following CVars are also supported:


* [[Console Variables|Buckshot]]
*[[Console Variables|AlwaysApplyDMFlags]]
* [[Console Variables|Instagib]]
*[[Console Variables|Buckshot]]
* [[Server Variables#sv aircontrol|SV_AirControl]]
*[[Console Variables|DuelLimit]]
* [[Server Variables#sv artifactreturntime|SV_ArtifactReturnTime]]
*[[Console Variables|FragLimit]]
* [[Server Variables#sv coop damagefactor|SV_Coop_DamageFactor]]
*[[Console Variables|Instagib]]
* [[Server Variables#sv duelcountdowntime|SV_DuelCountdownTime]]
*[[Console Variables|PointLimit]]
* [[Server Variables#sv forcerespawntime|SV_ForceRespawnTime]]
*[[Server Variables#sv aircontrol|SV_AirControl]]
* [[Server Variables#sv flagreturntime|SV_FlagReturnTime]]
*[[Server Variables#sv artifactreturntime|SV_ArtifactReturnTime]]  
* [[Server Variables#sv gravity|SV_Gravity]]
*[[Server Variables#sv coop damagefactor|SV_Coop_DamageFactor]]
* [[Server Variables#sv invasioncountdowntime|SV_InvasionCountdownTime]]
*[[Server Variables#sv duelcountdowntime|SV_DuelCountdownTime]]
*[[Server Variables#sv fastweapons|SV_FastWeapons]]  
*[[Server Variables#sv forcerespawntime|SV_ForceRespawnTime]]
*[[Server Variables#sv flagreturntime|SV_FlagReturnTime]]
*[[Server Variables#sv gravity|SV_Gravity]]
*[[Server Variables#sv invasioncountdowntime|SV_InvasionCountdownTime]]
* [[Server Variables#sv lmscountdowntime|SV_LMSCountdownTime]]
* [[Server Variables#sv lmscountdowntime|SV_LMSCountdownTime]]
* [[Server Variables#sv maprotation|SV_MapRotation]]
*[[Server Variables#sv maprotation|SV_MapRotation]]
* [[Server Variables#sv maxlives|SV_MaxLives]]
*[[Server Variables#sv maxlives|SV_MaxLives]]
* [[Server Variables#sv maxplayers|SV_MaxPlayers]]
*[[Server Variables#sv maxplayers|SV_MaxPlayers]]
* [[Server Variables#sv maxteams|SV_MaxTeams]]
*[[Server Variables#sv maxteams|SV_MaxTeams]]  
* [[Server Variables#sv possessioncountdowntime|SV_PossessionCountdownTime]]
*[[Server Variables#sv possessioncountdowntime|SV_PossessionCountdownTime]]  
* [[Server Variables#sv possessionholdtime|SV_PossessionHoldTime]]
*[[Server Variables#sv possessionholdtime|SV_PossessionHoldTime]]
* [[Server Variables#sv randomcoopstarts|SV_RandomCoopStarts]]
*[[Server Variables#sv randomcoopstarts|SV_RandomCoopStarts]]
* [[Server Variables#sv randommaprotation|SV_RandomMapRotation]]
* [[Server Variables#sv randommaprotation|SV_RandomMapRotation]]
* [[Server Variables#sv respawndelaytime|SV_RespawnDelayTime]]
*[[Server Variables#sv respawndelaytime|SV_RespawnDelayTime]]
* [[Server Variables#sv suddendeath|SV_SuddenDeath]]
*[[Server Variables#sv suddendeath|SV_SuddenDeath]]
* [[Server Variables#sv survivalcountdowntime|SV_SurvivalCountdownTime]]
*[[Server Variables#sv survivalcountdowntime|SV_SurvivalCountdownTime]]
* [[Server Variables#sv usemapsettingspossessionholdtime|SV_UseMapSettingsPossessionHoldTime]]
*[[Server Variables#sv usemapsettingspossessionholdtime|SV_UseMapSettingsPossessionHoldTime]]
* [[Server Variables#sv usemapsettingswavelimit|SV_UseMapSettingsWaveLimit]]
*[[Server Variables#sv usemapsettingswavelimit|SV_UseMapSettingsWaveLimit]]
* [[Server Variables#sv useteamstartsindm|SV_UseTeamStartsInDM]]
*[[Server Variables#sv useteamstartsindm|SV_UseTeamStartsInDM]]
*[[Console Variables|TeamDamage]]
*[[Console Variables|TimeLimit]]
*[[Console Variables|WaveLimit]]
*[[Console Variables|WinLimit]]


There are two different blocks that are used to initialize these flags, with different attributes:
There are two different blocks that are used to initialize these flags, with different attributes:  
* '''GameSettings''' - flags can still be changed during gameplay. This is useful for mods that want to change certain flags by default but still allow the host to change as they see fit.
*'''GameSettings''' - flags can still be changed during gameplay. This is useful for mods that want to change certain flags by default but still allow the host to change as they see fit.
* '''LockedGameSettings''' - flags can never be changed, and attempting to do so will print an error message. This is useful for mods that need certain flags enabled or disabled and don't want the host to mess with those settings.
*'''LockedGameSettings''' - flags can never be changed, and attempting to do so will print an error message. This is useful for mods that need certain flags enabled or disabled and don't want the host to mess with those settings.


If you want to initialize flags universally for your mod, you can add the '''DefaultGameSettings''' or '''DefaultLockedGameSettings''' blocks at the beginning of the file, which are applied across all game modes. You may then override some of these flags by also adding them to specific game modes. Additionally, if you want to remove a flag from a game mode, use '''RemoveGameSetting''' followed by the flag's name. Flags are enabled using either <code>true</code> or <code>1</code>, or disabled using either <code>false</code> or <code>0</code>.
If you want to initialize flags universally for your mod, you can add the '''DefaultGameSettings''' or '''DefaultLockedGameSettings''' blocks at the beginning of the file, which are applied across all game modes. You may then override some of these flags by also adding them to specific game modes. Additionally, if you want to remove a flag from a game mode, use '''RemoveGameSetting''' followed by the flag's name. Flags are enabled using either <code>true</code> or <code>1</code>, or disabled using either <code>false</code> or <code>0</code>.
Line 105: Line 134:
'''Note:''' loading another '''DefaultGameSettings''' or '''DefaultLockedGameSettings''' block in a subsequent GAMEMODE lump will reset all the flags and their attributes back to zero.
'''Note:''' loading another '''DefaultGameSettings''' or '''DefaultLockedGameSettings''' block in a subsequent GAMEMODE lump will reset all the flags and their attributes back to zero.


=Gamemode names=
=Settings for Offline or Online Games Only=
{{Devfeature|3.2|alpha}} By default, CVars are always initialized, for both offline (i.e. singleplayer or if multiplayer emulation is enabled) and online games. However, if a mod needs certain CVars to be set up differently for offline games or online games, then it's possible to insert two kinds of sub-blocks: 
 
*'''OfflineOnly''' - CVars in this block will be initialized in offline games only.
*'''OnlineOnly''' - CVars in this block will be initialized in online games only.
 
The same CVar can be inserted in an '''OfflineOnly''' and '''OnlineOnly''' sub-block at the same time. It's guaranteed that the value specified in the former will be applied in offline games, while the value specified in the latter will be applied in online games. It's also possible to add these sub-blocks inside the '''DefaultGameSettings''' or '''DefaultLockedGameSettings''' blocks, which will be applied to all game modes.
 
=Game Mode Names=
Must be one of the following:
Must be one of the following:
*[[Game_Modes#Cooperative|Cooperative]]
*[[Game_Modes#Cooperative|Cooperative]]
Line 145: Line 182:
</pre>
</pre>


This initializes some [[LMSFlags|LMSFlags]] for the Last Man Standing game mode. By default, players can't start with a pistol or chainsaw, but they are guarantee to start with a plasma rifle. In addition, spectators are free to view and chat with live players. Note that here, the server host is allowed to modify ''lms_allowpistol'' and ''lms_spectatorchat'', but is forbidden from changing ''lms_allowchainsaw'', ''lms_allowplasma'', and ''lms_spectatorview''.
This initializes some [[LMSFlags]] for the Last Man Standing game mode. By default, players can't start with a pistol or chainsaw, but they are guarantee to start with a plasma rifle. In addition, spectators are free to view and chat with live players. Note that here, the server host is allowed to modify ''lms_allowpistol'' and ''lms_spectatorchat'', but is forbidden from changing ''lms_allowchainsaw'', ''lms_allowplasma'', and ''lms_spectatorview''.
<pre>
<pre>
LastManStanding
LastManStanding

Latest revision as of 20:29, 2 January 2023

This article documents a Zandronum-specific special lump which may not be supported by ZDoom and its other child ports.

GAMEMODE is a special lump that allows mods to change the attributes of Zandronum's existing game modes, and initialise and enforce certain settings when certain game modes are in use.

The full syntax of the lump is as such:

GAMEMODENAME
{
    RemoveFlag FLAGNAME1
    AddFlag FLAGNAME2
    Property "Value"

    GameSettings
    {
        CVar1 = <value>
        CVar2 = <value>

        offlineonly (development version 3.2-alpha and above only)
        {
            CVar3 = <value>
            CVar4 = <value>
        }
        
        onlineonly (development version 3.2-alpha and above only)
        {
            CVar5 = <value>
            CVar6 = <value>
        }
    }

    LockedGameSettings
    {
        CVar7 = <value>
    }
}

Flags

  • COOPERATIVE

Cooperative is a flag that distinguishes the coop modes (Cooperative, Survival, Invasion) from others game modes.

  • DEATHMATCH

Players are spawned at deathmatch starts (needs Zandronum 3.0 to work properly).

  • TEAMGAME

Players are spawned at team starts (needs Zandronum 3.0 to work properly).

  • USEFLAGASTEAMITEM

Forces a game mode to use a team's flag item or icon instead of their skull.

  • PLAYERSEARNKILLS

Players earn kills from monsters. This also displays their kills on the scoreboard.

  • PLAYERSEARNFRAGS

Players/teams win the game by killing enemy players.

  • PLAYERSEARNPOINTS

Players or teams win the game by earning points (e.g. capturing the flag in CTF). This also displays how many points a player or team has on the scoreboard.

  • PLAYERSEARNWINS

Players or teams win the game by winning rounds (particularly used in LMS). This also displays how many wins a player or team has on the scoreboard.

  • DONTSPAWNMAPTHINGS

Items and weapons aren't spawned (monsters are still spawned).

  • MAPRESETS

The map can be reset to the same state that it was when it was first started. The ResetMap ACS function and "ResetMap" CCMD require this flag to be added to work.

  • DEADSPECTATORS

Enables support for dead spectators, which are players that are dead and cannot rejoin until the round is over.

  • PLAYERSONTEAMS

Players are organized into teams, and displays the team selection menu when pressing the spacebar to join the game.

  • USEMAXLIVES

Players have a limited number of lives, controlled by the sv_maxlives CVar.

  • USETEAMITEM

Enables support for a team's flag or skull item in CTF and Skulltag respectively, or the white flag in 1-flag CTF.

  • MAPRESET_RESETS_MAPTIME

Resetting the map also resets the level time. This also prevents the time limit from being active while the game isn't in progress.

  • DONTPRINTPLAYERSLEFT

Prevents the "x allies/opponents left" message from being drawn on the screen.

Properties

  • Name

The name of the game mode as it appears on the scoreboard, countdown screen, and server console window.

  • ShortName

This is generally a shorter and abbreviated version of the game mode's name. This is only used in the built-in server browser.

  • F1Texture

The graphic that will be drawn in the "Read This!" menu in non-single player games if no other help page is defined.

  • WelcomeSound (development version 3.2-alpha and above only)

The announcer sound that's played at the start of a new game. For example, "welcome to capture the flag" or "welcome to Skulltag" in CTF and Skulltag respectively.

Gameplay and Compatibility Settings

You can initialize any flags belonging to gameplay or compatibility flagsets for a particular game mode. The flagsets that are currently supported are:

(development version 3.2-alpha and above only) The following CVars are also supported:

There are two different blocks that are used to initialize these flags, with different attributes:

  • GameSettings - flags can still be changed during gameplay. This is useful for mods that want to change certain flags by default but still allow the host to change as they see fit.
  • LockedGameSettings - flags can never be changed, and attempting to do so will print an error message. This is useful for mods that need certain flags enabled or disabled and don't want the host to mess with those settings.

If you want to initialize flags universally for your mod, you can add the DefaultGameSettings or DefaultLockedGameSettings blocks at the beginning of the file, which are applied across all game modes. You may then override some of these flags by also adding them to specific game modes. Additionally, if you want to remove a flag from a game mode, use RemoveGameSetting followed by the flag's name. Flags are enabled using either true or 1, or disabled using either false or 0.

Note: loading another DefaultGameSettings or DefaultLockedGameSettings block in a subsequent GAMEMODE lump will reset all the flags and their attributes back to zero.

Settings for Offline or Online Games Only

(development version 3.2-alpha and above only) By default, CVars are always initialized, for both offline (i.e. singleplayer or if multiplayer emulation is enabled) and online games. However, if a mod needs certain CVars to be set up differently for offline games or online games, then it's possible to insert two kinds of sub-blocks:

  • OfflineOnly - CVars in this block will be initialized in offline games only.
  • OnlineOnly - CVars in this block will be initialized in online games only.

The same CVar can be inserted in an OfflineOnly and OnlineOnly sub-block at the same time. It's guaranteed that the value specified in the former will be applied in offline games, while the value specified in the latter will be applied in online games. It's also possible to add these sub-blocks inside the DefaultGameSettings or DefaultLockedGameSettings blocks, which will be applied to all game modes.

Game Mode Names

Must be one of the following:

Example

For instance, if you would like to have teams in coop, the lump needs to be:

cooperative {
    addflag PLAYERSONTEAMS
}

A cooperative-based mod might want players to be able to walk and shoot through their teammates, and also prevent their attacks from pushing them around. Note that here, the server host has the option to enable or disable these flags if they feel like it.

Cooperative
{
    GameSettings
    {
        sv_unblockallies = true
        sv_shootthroughallies = true
        sv_dontpushallies = true
    }
}

This initializes some LMSFlags for the Last Man Standing game mode. By default, players can't start with a pistol or chainsaw, but they are guarantee to start with a plasma rifle. In addition, spectators are free to view and chat with live players. Note that here, the server host is allowed to modify lms_allowpistol and lms_spectatorchat, but is forbidden from changing lms_allowchainsaw, lms_allowplasma, and lms_spectatorview.

LastManStanding
{
    GameSettings
    {
        lms_allowpistol = false
        lms_spectatorchat = true
    }
	
    LockedGameSettings
    {
        lms_allowchainsaw = false
        lms_allowplasma = true
        lms_spectatorview = true
    }
}