Skip to main content

Prerequisites

Before starting, ensure you have:

Compiled Server

Follow the Installation Guide to compile the server binary

CoD4 Game Files

Original Call of Duty 4 dedicated server files (main, zone, usermaps folders)
You need the original CoD4 dedicated server files. CoD4 Unleashed replaces the server executable but requires the game data files.

Quick Setup

1

Prepare Server Directory

Create or navigate to your CoD4 dedicated server directory:
mkdir -p ~/cod4-server
cd ~/cod4-server
Your directory should contain:
  • main/ - Game assets and IWD files
  • zone/ - Zone files
  • usermaps/ - Custom maps (optional)
  • Server configuration files
2

Copy CoD4 Unleashed Binary

Copy the compiled binary to your server directory:
cp /path/to/source/bin/cod4u_lnx ~/cod4-server/
chmod +x ~/cod4-server/cod4u_lnx
3

Create Server Configuration

Create a server.cfg file in the main directory:
mkdir -p main
nano main/server.cfg
Add basic server configuration:
// Server Settings
set sv_hostname "CoD4 Unleashed Server"
set sv_maxclients 32
set g_password ""
set rcon_password "your_secure_password"

// Game Settings
set g_gametype "dm"  // dm, tdm, sd, sab, koth, etc.
set sv_maprotation "gametype dm map mp_strike map mp_crash map mp_backlot"

// Network Settings
set net_port 28960
set sv_fps 20

// Logging
set g_logsync 1
set logfile 1
set g_log "games_mp.log"

// Server Rules
set sv_pure 1
set sv_punkbuster 0
Change rcon_password to a strong, unique password. This provides administrative access to your server.
4

Launch the Server

Start your CoD4 Unleashed server:
./cod4u_lnx +set dedicated 2 +set net_ip 0.0.0.0 +set net_port 28960 +exec server.cfg +map_rotate
  • +set dedicated 2 - Run as dedicated server (2 = internet server, 1 = LAN server)
  • +set net_ip 0.0.0.0 - Bind to all network interfaces
  • +set net_port 28960 - Set server port (default CoD4 port)
  • +exec server.cfg - Execute configuration file
  • +map_rotate - Start map rotation
5

Verify Server is Running

Check that your server is accessible:
ps aux | grep cod4u
Expected output should show the server listening on port 28960.

Using Unleashed Features

JSON Module

CoD4 Unleashed includes a powerful JSON module for GSC scripting:
#include unleashed\json;

init()
{
    level thread testJSON();
}

testJSON()
{
    // Parse JSON string
    jsonString = "{\"name\":\"Player1\",\"score\":100}";
    data = json_parse(jsonString);
    
    // Access values
    playerName = data["name"];
    playerScore = data["score"];
    
    iPrintLnBold("Player: " + playerName + " - Score: " + playerScore);
}
The JSON module files are located in bin/main/unleashed/json

HTTP/HTTPS Requests

Make web requests directly from GSC:
onPlayerConnect()
{
    player thread authenticatePlayer();
}

authenticatePlayer()
{
    self endon("disconnect");
    
    // HTTPS request example
    guid = self getGuid();
    url = "https://api.yourserver.com/auth?guid=" + guid;
    
    response = httpGet(url);
    
    if(isDefined(response) && response != "")
    {
        // Process authentication response
        data = json_parse(response);
        // ... handle authentication
    }
}

Performance Monitoring

Monitor server performance with enhanced FPS functions:
monitorPerformance()
{
    level endon("game_ended");
    
    while(true)
    {
        fps = getCountedFps();  // Accurate FPS with lag spike detection
        
        if(isLagging())
        {
            logPrint("WARNING: Server is lagging! FPS: " + fps);
            // Take action to reduce load
        }
        
        wait 5;
    }
}

Protocol Detection

Detect player protocol versions:
onPlayerConnect()
{
    protocol = self getProtocol();
    
    if(protocol == 6)  // CoD4 1.7
        iPrintLn(self.name + " connected using CoD4 1.7");
    else if(protocol == 7)  // CoD4 1.8 (Steam)
        iPrintLn(self.name + " connected using CoD4 1.8 (Steam)");
}

Advanced Configuration

Running as System Service (Linux)

Create a systemd service for automatic startup:
1

Create Service File

sudo nano /etc/systemd/system/cod4-unleashed.service
Add the following:
[Unit]
Description=CoD4 Unleashed Dedicated Server
After=network.target

[Service]
Type=simple
User=cod4server
WorkingDirectory=/home/cod4server/cod4-server
ExecStart=/home/cod4server/cod4-server/cod4u_lnx +set dedicated 2 +set net_ip 0.0.0.0 +set net_port 28960 +exec server.cfg +map_rotate
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
2

Enable and Start Service

sudo systemctl daemon-reload
sudo systemctl enable cod4-unleashed
sudo systemctl start cod4-unleashed
3

Check Service Status

sudo systemctl status cod4-unleashed

Firewall Configuration

Ensure your firewall allows CoD4 traffic:
sudo ufw allow 28960/udp comment 'CoD4 Unleashed Server'
sudo ufw reload

Custom Mods and Scripts

Place your custom GSC scripts in the appropriate location:
main/
├── maps/
   └── mp/
       ├── gametypes/
   └── _yourgametype.gsc
       └── _yourmapscript.gsc
├── unleashed/
   └── json/  # JSON module
└── server.cfg

Testing Your Server

1

Connect from Game Client

Launch Call of Duty 4 and open the console (~):
/connect your_server_ip:28960
2

Test RCON Access

In-game console:
/rcon login your_secure_password
/rcon status
3

Monitor Server Logs

tail -f main/games_mp.log

Troubleshooting

Problem: Missing CoD4 game files.Solution: Ensure all original CoD4 dedicated server files are present, especially:
  • main/iw_*.iwd files (IWD 00-14)
  • zone/ directory with zone files
Problem: Firewall or port forwarding not configured.Solution:
  1. Open UDP port 28960 in your firewall
  2. Forward port 28960 UDP in your router to your server
  3. Set +set net_ip 0.0.0.0 in startup command
Problem: sv_maxclients set too low or sv_privateClients misconfigured.Solution: In server.cfg:
set sv_maxclients 32  // Increase as needed
set sv_privateClients 0
Problem: JSON module not loaded.Solution: Include the JSON module in your GSC:
#include unleashed\\json;
Ensure bin/main/unleashed/json files are present.
Problem: libcurl shared library not found.Solution:
sudo apt-get install libcurl4:i386

Next Steps

Scripting API

Explore the complete GSC scripting API documentation

Configuration Reference

Deep dive into server configuration options

Plugin Development

Learn how to create custom plugins for CoD4 Unleashed

Community Forum

Get help and share your server setup

Build docs developers (and LLMs) love