Garry's Mod
The ultimate Source Engine sandbox. Host and manage servers with unlimited Lua customization possibilities.
Overview
Release Date: November 29, 2006
Platform: PC (Steam, Linux servers supported)
Engine: Source Engine (Modified)
Scripting: Lua (100% customizable)
Max Players: 32+ (unlimited with resources)
System Requirements
Minimum
- OS: Windows/Linux 32-bit or 64-bit
- CPU: Pentium 4 3.0 GHz
- RAM: 2GB minimum (4GB+)
- Storage: 4GB SSD
- Connection: 20Mbps upload
Recommended
- OS: Linux (Ubuntu 20.04 LTS)
- CPU: Intel i7 / Ryzen 7
- RAM: 16GB+
- Storage: 50GB+ SSD
- Connection: 100Mbps+ upload
Installation Guide
Download Server Files
Use SteamCMD to download Garry's Mod dedicated server files
Add Addons
Place Workshop addons in garrysmod/addons directory
Configure Server
Create server.cfg and startup parameters
Launch Server
Run srcds.exe with appropriate game mode parameters
Server Configuration
Common Bugs & Issues
Addon Load Errors
Addons fail to load due to missing dependencies or corrupt files. Check debug logs.
Lua Scripting Errors
Custom Lua scripts produce errors on player join. Enable developer mode.
FastDL Issues
Players download custom content slowly or fail. Configure FastDL properly.
Map Validation Failures
VPK or map files fail CRC check. Verify map integrity.
Troubleshooting
Server Crashes on Startup
- Check for corrupted addons
- Review console output for errors
- Disable recently added addons
- Update Garry's Mod to latest version
Players Cannot Connect
- Check firewall and port forwarding
- Verify STEAM_ID authentication
- Check server console for connection errors
- Restart server completely
Performance Optimization
Addon Optimization
- Remove unused addons
- Disable problematic Workshop addons
- Use lightweight gamemodes
- Monitor addon startup time
Server Settings
- Reduce ticks_per_frame for better CPU usage
- Optimize entity count limits
- Lower max physics objects
- Use Linux for better performance
Addon Development
Garry's Mod has the most extensive addon ecosystem with 10000+ community-created missions and gamemodes.
Popular Gamemodes
DarkRP, TTT, Prop Hunt, Murder, Wiremod
Development Tools
Hammer Editor, Lua scripting, Entity system
Advanced Troubleshooting
Lua Script Errors & Stack Traces
sv_logecho = 1
developer = 2
-- Comprehensive error handling
local status, err = pcall(function()
table.insert(nil, 1) -- Will error
end)
if not status then
print("Error: " .. err)
end
-- Stack trace generation
debug.traceback("Custom message")
- Nil Table Access: Check table exists before indexing, use if tbl then pattern
- Function Parameters: Validate argument types, use local copies for safety
- Reference Cycles: Avoid circular table references, clean up metatable __gc handlers
- Callback Crashes: Wrap callbacks in pcall(), verify entity/player still exists
Addon Loading & CRC Mismatch Resolution
for _, addon in ipairs(engine.GetAddons()) do
print("Addon: " .. addon.title .. " - " .. addon.status)
end
-- Verify gamemode dependencies
GAMEMODE = GAMEMODE or {}
if not gamemode.teamBased then
error("Gamemode missing: teamBased")
end
-- FastDL file validation
// Check server.cfg:
sv_downloadurl "http://fastdl.example.com/gmod/"
sv_allowdownload 1
- CRC Mismatches: Clear client cache (steamapps/common/GarrysMod/garrysmod/cache), reinstall addon
- Missing Addon Dependency: Check if parent addon properly subscribed/installed on all clients
- Corrupted FastDL: Regenerate file list, ensure correct mime-types in web server
- Version Conflicts: Run addon compatibility test, check Workshop for newer versions
Entity Networking & Datastream Debugging
function ENT:SendNetData()
self:SetNWString("DebugData", "test")
print("[" .. self:GetClass() .. "] Sync sent")
end
-- Receive net data safely
net.Receive("EventName", function(len, ply)
if not ply or not ply:IsValid() then return end
local data = net.ReadString()
end)
-- Monitor bandwidth
concommand.Add("net_debug", function()
print("Entities networked: " .. #ents.GetAll())
end)
- Desync Issues: Sync positions more frequently for player-controlled entities, use callbacks
- Silent Failures: Wrap net receives with error checking, verify client receives callback
- Bandwidth Limits: Reduce sync frequency for static entities, batch multiple updates
- Entity Reference Stale: Always IsValid() check before using entities, cache entity tables safely
FastDL Server Configuration & Optimization
server {
listen 8080;
root /var/www/gmod_fastdl;
# Gzip for better compression
gzip on;
gzip_types application/* text/*;
# Cache headers
expires 7d;
}
# Generate file list
# Use create_addon.lua script or manual FTP upload
- Slow Download Speeds: Check server bandwidth, enable gzip compression, use CDN
- Missing Files: Verify all BSP materials/models uploaded, check file permissions (644)
- MIME Type Errors: Configure .mdl/.vmt/.vtf MIME types in web server
- Concurrent Connections: Limit per IP with nginx rate_limit, increase worker processes
Server Lag & Resource Profiling
local start = SysTime()
for i = 1, 10000 do
local ent = Entity(i)
if ent and ent:IsValid() then
ent:GetPos() -- Actual work
end
end
print("Took: " .. (SysTime() - start) * 1000 .. "ms")
-- Monitor server ConVars
sv_cheats = 0
developer = 2 -- More logging
sv_timeout 300 -- Disconnect timeout
- Frame Rate Drops: Profile Think hooks, remove expensive loops in OnEntityCreated
- Memory Bloat: Check for table references not cleared, use collectgarbage("collect")
- Collision Issues: Reduce phantom collisions with SetSolid(SOLID_NONE), use OBB efficiently
- Player Crashes: Server-side check for malformed net messages, validate all client input
Pro tip: Always wrap external function calls in pcall(). Use dedicated FastDL servers for large addons. Monitor console.log for silent errors.
Developer Resources
Lua API
Comprehensive Lua API with 3000+ functions for game customization
Gamemode Framework
DarkRP and other popular frameworks for rapid server development
Workshop Integration
One-click addon distribution via Steam Workshop to millions of players
FAQ
Why are my servers listed as LAN?
Set sv_region properly and ensure dedicated server is running. LAN shows only locally without proper setup.
How do I update addons automatically?
Use Workshop subscriptions and enable auto-update in server.cfg with workshop_autoupdate convar.