Gamemode Creation
Contents |
Gamemode Content
Gamemode content such as maps, models and sounds should be placed in the root garrysmod folder. Or if you're making a workshop addon - in the root folder.
In previous versions of Garry's Mod you would be able to put this content in a gamemodes/<gamemode>/content folder. This method was removed in Garry's Mod 13 to reduce load-times by decreasing the number of search paths.
Note: As of Beta Update 15 the gamemode content folder has been restored!
Gamemode Folder
To create a new gamemode you need to create a new folder in the gamemodes folder. The folder should take the name of your gamemode. Inside of that folder there should be a text file named whatever your folder is.
For instance, if my gamemode was called "SuperKillers", I would create a folder in "garrysmod/gamemodes/" called "superkillers". Then inside that folder I would create a text file called "superkillers.txt".
Note that in previous versions of Garry's Mod this file was always called "info.txt" - but was changed in Version 13 to reflect the changes to the content.
Gamemode Text File
The .txt file you created needs to be a keyvalues file.
"Gamemode"
{
"base" "base"
"title" "Super Killers"
"maps" "^sk_"
"menusystem" "1"
"settings"
{
1
{
"name" "sk_maxfrags"
"text" "Max Frags"
"help" "The maxiumum number of frags before a map change"
"type" "numeric"
"default" "20"
}
2
{
"name" "sk_grenades"
"text" "Allow Grenades"
"help" "If enabled then grenades are enabled"
"type" "checkbox"
"default" "1"
}
}
}
| key | description |
|---|---|
| base | The gamemode you're deriving from. This will usually be base. |
| title | The 'nice' title of your gamemode. Can contain spaces and capitals. |
| maps | The map filter for your gamemode. This is used to correctly categorise maps in the map selector. This should only be set if the maps are unique to your gamemode. |
| menusystem | Include and set to 1 if this gamemode should be selectable from the main menu |
| settings | See Below |
Settings
The settings table allows you to create server configuration convars for your gamemode. It's completely optional. Your text file doesn't have to have a settings section.
In previous versions of GMod this section used to have its own file, in gamemode/<gamemode>/content/settings/server_settings/. It was moved to the root folder to decrease load times.
These settings are configurable in the main menu in GMod. Each entry has a number of fields.
| key | description |
|---|---|
| name | The name of the convar |
| text | The text to show in game to describe this convar |
| help | The help text to show on the convar (in the console) |
| type | Either text, checkbox or numeric |
| default | The default value for the convar |
Menu Background Images
If you want to include backgrounds with your gamemode place them in gamemodes/<yourgamemode>/backgrounds/. They must all be jpg images.
Menu Logo Image
To supply a menu logo image place a png file in gamemodes/<yourgamemode>/logo.png. This image should be 128 pixels high and up to 1024 pixels wide. The default logo is 288 x 128.
Menu Icon
To supply a menu icon place a png file in gamemodes/<yourgamemode>/icon24.png. This image should ideally be 24x24. Here's where it will appear.