User:Tatsuru/Custom gametype documentation

From SRB2 Wiki
Jump to navigation Jump to search

Attributes

  • TypeOfLevel: The level types this gametype is allowed to use. It is also possible to declare custom TypeOfLevel constants via freeslots.
  • Identifier: This generates the constant to which the gametype will be referred to in code. Identifier = "hangout" will create a corresponding gametype constant GT_HANGOUT.
  • Rules: The gametype's rules, which govern the most basic aspects of how the gametype is supposed to play. The bitwise OR | operator should be used on these values to combine them, e.g. GTR_SPECTATORS|GTR_RINGSLINGER|GTR_TEAMS.
Keyword Explanation
GTR_CAMPAIGN This gametype ensures linear progression through levels, not allowing random picks. Only used by Co-op.
GTR_RINGSLINGER This is a gametype where players can throw rings to attack. Can be overriden by the value of the ringslinger variable. Used by Match, Team Match, Tag, Hide & Seek and CTF.
GTR_SPECTATORS This gametype allows players to spectate. Used by all GTR_RINGSLINGER gametypes.
GTR_LIVES This gametype features lives. Used by Co-op and Competition.
GTR_TEAMS This gametype features teams. Used by Team Match and CTF.
GTR_FIRSTPERSON This gametype defaults the player's camera to first person view. Used by all GTR_RINGSLINGER gametypes.
GTR_POWERSTONES Multiplayer Emeralds are allowed to spawn in this gametype. Used by Match and CTF.
GTR_TEAMFLAGS Team flags are allowed to spawn in this gametype. Used by CTF only.
GTR_FRIENDLY This gametype is non-competitive. Used by Co-op only.
GTR_SPECIALSTAGES This gametype allows Special Stages to be accessed via Emerald Tokens. Used by Co-op only.
GTR_EMERALDTOKENS Emerald Tokens are allowed to spawn in this gametype. Used by Co-op and Competition.
GTR_EMERALDHUNT This gametype will start an Emerald Hunt if any Emerald Hunt Locations are placed, and end the level when three Chaos Emeralds are found. Used by Co-op only.
GTR_RACE This gametype is a race with an initial countdown. Levels will end 60 seconds after the first player finishes the circuit. Used by Race and Competition.
GTR_TAG This gametype is a game of Tag. Used by Tag and Hide & Seek.
GTR_POINTLIMIT This gametype can end levels when a point limit is reached. Used by all GTR_RINGSLINGER gametypes.
GTR_TIMELIMIT This gametype can end levels when a time limit is reached. Used by all GTR_RINGSLINGER gametypes.
GTR_OVERTIME This gametype will start an overtime when both teams, or two or more players are tied. Can be overriden by the overtime variable.
GTR_HURTMESSAGES This gametype will display a battle log in the console. Used by all GTR_RINGSLINGER gametypes.
GTR_FRIENDLYFIRE This gametype allows players to attack other players by throwing rings regardless of team. Can be overriden by the value of the friendlyfire variable.
GTR_STARTCOUNTDOWN This gives GTR_TAG gametypes an initial countdown for players to flee and hide from the "it".
GTR_HIDEFROZEN In GTR_TAG gametypes, players won't be allowed to move after GTR_STARTCOUNTDOWN has elapsed, or not been set. Used by Hide & Seek only.
GTR_BLINDFOLDED In GTR_TAG gametypes, this will blindfold the "it" player during fleeing/hiding time if GTR_STARTCOUNTDOWN has been set.
GTR_RESPAWNDELAY This gametype makes use of the respawndelay variable to set a timer before players can respawn. Used by all GTR_RINGSLINGER gametypes.
GTR_PITYSHIELD This gametype makes use of the pity counter to award losing players a Pity Shield. Used by Match, Team Match and CTF.
GTR_DEATHPENALTY This gametype penalizes players by 50 points for dying. Used by Match only.
GTR_NOSPECTATORSPAWN Players spawn in the game by default, instead of as spectators. Must be coupled with GTR_SPECTATORS.
GTR_DEATHMATCHSTARTS This gametype uses Deathmatch spawns as a first option for spawning players.
GTR_SPAWNINVUL This gametype spawns players with temporary invincibility. Used by all vanilla gametypes except Co-op.
GTR_SPAWNENEMIES Enemies are allowed to spawn in this gametype. Used by Co-op, Competition and Race.
GTR_ALLOWEXIT Players can end a level by touching an Exit Sector. Used by Co-op, Competition and Race.
GTR_NOTITLECARD This gametype does not display a title card.
GTR_CUTSCENES This gametype allows cutscenes, the ending sequence, credits and the secrets evaluation screen to be displayed. Used by Co-op only.
  • DefaultTimeLimit: If the rule GTR_TIMELIMIT is present, this will set a default time limit for the gametype's matches, in minutes.
  • DefaultPointLimit: if the rule GTR_POINTLIMIT is present, this will set a default point limit for the gametype's matches.
  • Description: The description of the gametype in the level select platter. Defaults to "???" if not specified.
  • HeaderColor: The bar color of the gametype in the level select platter. This overrides HeaderLeftColor and HeaderRightColor.
  • HeaderLeftColor: The color of the first half of the gametype's bar in the level select platter. Used in vanilla for CTF.
  • HeaderRightColor: The color of the second half of the gametype's bar in the level select platter. Used in vanilla for CTF.
  • RankingType: The type of ranking the gametype will use in the Multiplayer score tally when Tab is held. Can use one of the vanilla GT_ constants.
  • IntermissionType: The type of intermission the gametype will use between levels. Can use one of the constants in the table below.
Constant Type
int_none No intermission, skips straight to the next level
int_coop Single Player and Co-op "Sonic got through the act" style intermission
int_match Match, Tag and Hide & Seek score tally
int_teammatch Team Match score tally
int_ctf Capture the Flag score tally
int_race Race score tally
int_competition Competition score tally
int_spec Special Stage intermission, displays the amount of emeralds the player has

SOC definition

This is an example of a gametype definition written with SOC and the syntax it uses.

GameType Hangout
TypeOfLevel = Coop,Hangout
Identifier = "hangout"
Rules = GTR_SPECTATORS|GTR_FRIENDLY|GTR_NOSPECTATORSPAWN|GTR_NOTITLECARD
IntermissionType = int_none
HeaderColor = 103
Description = "Chill out from the battles and races and relax with your friends in your favorite levels without a care in the world."

Lua definition

This is an example of a gametype definition written with Lua. It must be done in the form of a table passed to the function G_AddGametype. Note that all attributes need to be in lowercase.

G_AddGametype({
    name = "Hangout",
    identifier = "hangout",
    typeoflevel = TOL_COOP|TOL_HANGOUT,
    rules = GTR_SPECTATORS|GTR_FRIENDLY|GTR_NOSPECTATORSPAWN|GTR_NOTITLECARD,
    intermissiontype = int_none,
    headercolor = 103,
    description = "Chill out from the battles and races and relax with your friends in your favorite levels without a care in the world."
})