Gamemode content such as maps, models and sounds should be placed in
gamemodes/content/ folder. (i.e.
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
superkillers. Then inside that folder I would create a text file called
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.
.txt file you created needs to be a keyvalues file.
|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|
|workshopid||Optional. If your gamemode is on Workshop then this should be the workshopid of the file. (You won't have a workshopid until you upload - so you will need to set this in an update)|
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.
|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. These are case-sensitive!|
|default||The default value for the convar|
|singleplayer||Whether this convar should show up for singleplayer, just having this key will enable it, it doesn't matter what the value is|
If you want to include backgrounds with your gamemode place them in
gamemodes/<yourgamemode>/backgrounds/. They must all be jpg images.
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.
To supply a menu icon place a
.png file in
gamemodes/<yourgamemode>/icon24.png. This image should ideally be 24x24 pixels but it can be up to 32x32. The server list displays the icons at 24x24 while the gamemode selection uses 32x32. Here's where it will appear.
Three files are needed for your gamemode to function properly. These go into your
Please note, that while we use
shared.lua in the example below, it is completely optional.
cl_init.lua are not!
This file is called when the server loads the gamemode. The example below tells the resource system to send the two files to the client, and then loads shared.lua.
This file sets some common variables and creates the Initialize function. This is the only function you NEED to define. All others will be called from the base gamemode.
This file is called when the client loads the gamemode. You would put client specific things in here. We load shared.lua. Note that you can only 'include' files here that have been 'AddCSLuaFile'd on the server.
This is a variable that will return the current folder name of the gamemode being run.
For example, If you are playing the gamemode
Trouble In Terrorist Town this variable will equal to
If you are deriving your gamemode from something other than base, use this function to tell the engine that we do.
You must call the function on both, client and server, and since our
shared.lua is included from both,
init.lua, we can do it once, in
In the example below, let's say we derive our gamemode from sandbox, so we add this to our
shared.lua, somewhere above all function definitions is a good place:
If you wish to edit a gamemode but you do not want it to appear under a different category in the server browser and you do not want the edited version to override the original, in cases like editing
Trouble In Terrorist Town where a game update could undo your edits, you can copy the gamemode as usual and append
_modded to the gamemode's folder name, for example
terrortown_modded. This includes the
.txt file and its contents. (Verify this)
You will still load it as
terrortown_modded on your server, but it will appear as
terrortown to the rest of the world.
Your Gamemode Text File is invalid or was not found.
The game could not find
init.lua of your gamemode. Make sure these files exist in the correct place:
You have not assigned a playermodel to the player.