by Pivec Labs
🌐 Server Deployment Guide

Deployment Guide

Move your NetCrafter multiplayer game from local development to a remote server so real players around the world can connect. This guide covers SmartFoxServer 3 setup, zone and extension deployment, and the one Unity setting you need to change.

Time: 30–60 minutes 10 steps Applies to: All Tutorials
00

Introduction

During development you run SmartFoxServer 3 on your own machine and connect via 127.0.0.1. Once your game is working locally, moving to production requires three things:

  1. A remote server running SmartFoxServer 3 with the correct ports open
  2. Your zone config and Java extension deployed to that server
  3. Your Unity build pointing to the server’s public IP address

This guide covers all three steps. The process is identical for all NetCrafter tutorials (Chat, Racing, Character) — the only differences are the zone name and extension name, which come from your schema settings.

Looking for player-hosted sessions?

See the Player Hosting Guide — players can host SFS3 on their own machine with manual port forwarding. For smaller games that don’t need SmartFoxServer, NetCrafter Relay is a separate asset.

Before you start

Complete a tutorial first (Chat, Racing, or Character) and confirm the game works with a local SFS3 instance before attempting remote deployment. Debugging connection issues is much harder when you also have a remote network to rule out.

01

Choose a Server

You need a machine with a static public IP address that you can SSH into (Linux) or RDP into (Windows). Any VPS (Virtual Private Server) from any provider that gives you full OS access will work.

Operating system

SFS3 runs on any platform that supports Java 21. The recommended choices are:

  • Linux — Ubuntu 22.04 LTS (recommended): lowest cost, well-documented, easiest firewall management with UFW.
  • Windows Server 2022: familiar if your team works primarily on Windows; SFS3 can be installed as a Windows Service for auto-start.

Minimum specifications (SFS3 Community Edition, 100 users)

CPU

1 vCPU — sufficient for development and small player counts. Add cores as player count grows.

RAM

2 GB minimum. SFS3 recommends 512 MB per 1,000 concurrent users. Plan accordingly.

Disk

20 GB — SFS3 installation is small; budget for logs and future growth.

Network

Static public IP address (required). Any bandwidth tier is fine for low player counts.

⚠
SFS3 Community Edition supports up to 100 concurrent users. For higher limits, see SmartFoxServer Pro licensing at smartfoxserver.com.

No endorsement

Any VPS provider that gives you a static IP and SSH/RDP access will work — DigitalOcean, Linode, Vultr, AWS EC2, Azure VMs, Hetzner, and others. Choose based on your region and budget. This guide does not endorse any specific provider.

02

Install SmartFoxServer 3

Download SmartFoxServer 3 from smartfoxserver.com → Downloads. Choose the package that matches your server OS.

Linux (Ubuntu 22.04)

bash
# 1. Install Java 21 (required by SFS3)
sudo apt update
sudo apt install -y openjdk-21-jdk

# Confirm Java version — should print "openjdk 21..."
java -version

# 2. Download SFS3 for Linux from smartfoxserver.com/downloads
#    Choose the Linux / Mac ZIP package
#    Upload it to your server via SCP or wget from the direct link
#    provided after registration on the SFS3 download page.
#    Example (replace with the actual filename you downloaded):
unzip SFS3_3_x_x.zip
cd SFS3_3_x_x/

# 3. Start SFS3
chmod +x start.sh stop.sh
./start.sh

SFS3 runs in the foreground by default. For a persistent background process, see What’s Next → Auto-restart.

Windows Server

  1. Install Java 21 JDK from adoptium.net (Eclipse Temurin recommended)
  2. Download the Windows installer from smartfoxserver.com → Downloads
  3. Run the installer as Administrator
  4. Install to C:\SFS3\ or your preferred location
  5. Start via C:\SFS3\start.bat
  6. Optionally, register SFS3 as a Windows Service for auto-start after reboot (see SFS3 documentation → Running as a Service)

SFS3 file layout

On both platforms, SFS3 unpacks to a folder with this structure:
server/zones/ — zone XML configs go here
server/extensions/ — extension JARs go here
server/lib/ — SFS3 runtime JARs (do not modify)
logs/ — server log files

03

Open Required Ports

This is the most common reason remote connections fail. Your server’s firewall must allow incoming connections on the SFS3 port before any client can connect.

PortProtocolPurposeRequired?
9977TCPSFS3 default connection port✓ Yes
9977UDPSFS3 UDP transport (if enabled)Recommended
8080TCPSFS3 Admin Tool web interfaceOptional — restrict access

Linux (UFW firewall)

bash
sudo ufw allow 9977/tcp
sudo ufw allow 9977/udp
sudo ufw reload
sudo ufw status

Windows Server (Windows Defender Firewall)

  1. Open Windows Defender Firewall with Advanced Security
  2. Click Inbound Rules → New Rule…
  3. Select Port → TCP → enter 9977 → Allow the connection
  4. Repeat for UDP 9977
⚠
Also check your hosting provider’s network firewall.

Most VPS providers have a separate network-level firewall (AWS Security Groups, DigitalOcean Firewall, Linode Cloud Firewall, etc.) in addition to the OS-level firewall. Both must allow port 9977. Check your provider’s control panel if connections still fail after updating UFW or Windows Firewall.

To verify port 9977 is reachable from the outside, use an online port checker (search “open port checker”) and enter your server’s public IP and port 9977 after SFS3 is running.

04

Deploy Your Zone Config

The zone XML generated by NetCrafter’s Config Generator must be copied to the remote server’s server/zones/ folder.

Generate the zone file

  1. In Unity, open the NetCrafter window: Tools → Pivec Labs → NetCrafter Pro
  2. Select your schema and go to the Code → Config Generator tab
  3. Confirm your SmartFox Settings are correct:
    • Zone Name matches your game (e.g. ChatRoomZone, RacingZone, CharacterZone)
    • Extension Name and Extension Class are set correctly
  4. Click Refresh Preview to verify the generated XML
  5. Click Generate Config — the file is written to:
    Assets/PivecLabs/NetCrafter/Definitions/{SchemaName}/Generated/Config/{ZoneName}.zone.xml
⚠
Deploy Config to SFS3 deploys to your local SFS3 only. For a remote server you must copy the file manually as described below.

Copy to the remote server

bash — Linux (SCP)
# Replace placeholders with your actual values
scp {ZoneName}.zone.xml user@YOUR_SERVER_IP:/path/to/sfs3/server/zones/

On Windows, use WinSCP, FileZilla, or any SFTP client to copy the file to /path/to/sfs3/server/zones/ on the remote server.

Zone XML must be complete

SFS3 does not fill in defaults for missing XML elements — it throws a NullPointerException on startup if required stubs are absent. NetCrafter generates all required elements automatically (wordsFilter, floodFilter, privilegeManager, buddyList, databaseManager, udpSettings). Do not strip any elements from the generated file.

The filename must end in .zone.xml. SFS3 scans server/zones/*.zone.xml on startup and ignores files that do not match this pattern.

05

Deploy Your Java Extension

The JAR built by NetCrafter must be copied to a named folder inside the remote server’s server/extensions/ directory.

Build the JAR locally

  1. In the NetCrafter window, go to Code → Server Code
  2. Confirm SFS3 Lib Path points to your local SFS3 lib/ folder (used for compilation only)
  3. Click Build JAR (mvn package) and wait for BUILD SUCCESS
  4. The built JAR is at:
    Assets/PivecLabs/NetCrafter/Definitions/{SchemaName}/Generated/Server/target/{SchemaName}Extension.jar

Copy to the remote server

bash — Linux (SSH + SCP)
# Create the extension folder on the remote server
# (the folder name must match the Extension Name in your schema settings)
ssh user@YOUR_SERVER_IP \
  "mkdir -p /path/to/sfs3/server/extensions/{ExtensionName}"

# Copy the JAR
scp {SchemaName}Extension.jar \
  user@YOUR_SERVER_IP:/path/to/sfs3/server/extensions/{ExtensionName}/

On Windows, use WinSCP or FileZilla. Copy the JAR to:
C:\SFS3\server\extensions\{ExtensionName}\{SchemaName}Extension.jar

⚠
Stop SFS3 before copying the JAR.

Never overwrite the JAR while SFS3 is running — the JVM holds a file lock and the copy may silently fail or corrupt the extension. Stop SFS3, copy the JAR, then restart.

JAR naming requirement

The JAR filename must end in Extension.jar (e.g. CharacterExtension.jar). SFS3’s Admin Tool only discovers JARs with this suffix. NetCrafter enforces this naming automatically — the output file is always {SchemaName}Extension.jar.

06

Update Unity SmartFox Settings

This is the only change needed in your Unity project to connect to a remote server. Change the Host field from the localhost address to your server’s public IP.

  1. Open the NetCrafter window: Tools → Pivec Labs → NetCrafter Pro
  2. Select your schema
  3. Go to Settings → SmartFox Settings
  4. Change Host from:
Before (local)
127.0.0.1

To your server’s public IP address:

After (remote)
203.0.113.42  ← example only — use your actual server IP
  1. Click Save Settings
  2. Click Code → Build Code → Generate All Files to regenerate SmartFoxConnectionManager.cs with the new host embedded
  3. Rebuild your Unity client: File → Build
⚠
Always use the SmartFox Settings tab — never hardcode the IP in your scripts.

The host is embedded in the generated SmartFoxConnectionManager.cs at generation time. Change it in one place (the Settings tab), regenerate, and all connections update automatically. Hardcoding the IP in game scripts creates a maintenance burden and makes switching between local and remote testing difficult.

07

Restart SFS3 and Test

After deploying the zone config and JAR, restart SFS3 on the remote server so it picks up the new files.

Linux

bash
# Stop SFS3
./stop.sh

# Start SFS3
./start.sh

# Stream the log to watch for errors
tail -f logs/smartfox.log

Windows Server

If installed as a Windows Service: open Services, find SmartFoxServer 3, click Restart. Otherwise stop and start start.bat.

Check the log at C:\SFS3\logs\smartfox.log.

What to look for in the log

Log output (expected on clean start)
Loading: zones/{ZoneName}.zone.xml
Zone: {ZoneName}
{ExtensionName}: {ExtensionClass} initialized
SmartFoxServer 3 READY

If you see NullPointerException during zone loading, the zone XML is missing a required element — regenerate the config from NetCrafter and redeploy.

If the extension class is not found, confirm the JAR is in server/extensions/{ExtensionName}/ and that the Extension Class in your schema settings matches the fully-qualified class name in the zone XML.

08

Test the Connection

Run your Unity build and watch both the Unity Console and the remote SFS3 log.

Expected Unity Console output

Unity Console
[SFS3] Connected — waiting for Login()
[SFS3] Login() called with: YourName
[SFS3] OnLogin fired
[SFS3] OnRoomJoin fired

Expected SFS3 server log output

Server log
Session created: { IP: YOUR_LOCAL_IP }
User login: { Zone: {ZoneName} }

Troubleshooting

SymptomLikely causeFix
Connection times outPort 9977 blockedOpen port in OS firewall AND hosting provider firewall
Connection refusedSFS3 not runningCheck SFS3 start output; check the log for startup errors
Login fails immediatelyZone name mismatchConfirm zone XML filename and <name> element match your schema settings
Extension not foundJAR not in correct folder or wrong class nameConfirm server/extensions/{ExtensionName}/{SchemaName}Extension.jar exists and the class FQN is correct
Connected but events don’t fireExtension class loaded but crashed on initCheck SFS3 log for exceptions after the zone starts

Quick connectivity check

Before running Unity, confirm basic reachability with:
ping YOUR_SERVER_IP — confirms the server is online
telnet YOUR_SERVER_IP 9977 — confirms the port is open
Or use an online port checker tool and enter your server IP and port 9977.

09

Multiple Players from Different Locations

Once your server is running and one client can connect, getting additional players in is straightforward.

  1. Share your server’s public IP address with other players
  2. Each player updates their SmartFox Settings → Host to the same IP and regenerates client code
  3. Each player builds and runs the Unity client
  4. All players connect to the same SFS3 zone and room — the server handles routing

Players do not need to know anything about the server setup beyond the IP address and port. The port (9977) is already embedded in the generated SmartFoxConnectionManager.cs via your schema settings.

⚠
SFS3 Community Edition: 100 concurrent user limit. All users across all zones and rooms on the server count toward this total. If you need more capacity, see SmartFoxServer Pro licensing at smartfoxserver.com.

Run In Background

When testing with multiple Unity Editor instances on the same machine (one as the “remote” player), enable Edit → Project Settings → Player → Resolution and Presentation → Run In Background. This keeps the network alive when the Editor window loses focus.

10

Security Considerations

A production game server is publicly reachable. These steps reduce your attack surface.

Change the Admin Tool default credentials

SFS3 ships with default Admin Tool credentials. Change them immediately after installation:

  1. Open the SFS3 Admin Tool at http://YOUR_SERVER_IP:8080/admin
  2. Go to Server Settings → Remote Admin
  3. Change the username and password to strong, unique values
  4. Save and restart SFS3

Restrict Admin Tool access (port 8080)

Do not expose port 8080 to the public internet. Two safe approaches:

  • SSH tunnel: access the Admin Tool over an SSH tunnel from your local machine — port 8080 never needs to be open on the firewall
  • IP allowlist: in UFW or your hosting provider’s firewall, allow port 8080 only from your own IP address
bash — SSH tunnel to Admin Tool
# Run this on your LOCAL machine
# Then open http://localhost:8080/admin in your browser
ssh -L 8080:localhost:8080 user@YOUR_SERVER_IP

Use SSL / WSS for production

SFS3 supports HTTPS and WebSocket Secure (WSS) connections. For a publicly released game, use WSS to encrypt traffic between clients and the server. See the SFS3 documentation for SSL certificate setup.

Keep SFS3 updated

Check the SmartFoxServer release page periodically and update to the latest stable version to pick up security patches and bug fixes. Test updates on a staging server before applying to production.


NEXT

What’s Next

Your server is live. Here are the natural next steps for a production-ready deployment:

SSL / WSS

Encrypt all traffic between clients and the server with a TLS certificate. SFS3 supports HTTPS and WebSocket Secure (WSS). See the SFS3 documentation for Let’s Encrypt integration.

Monitoring

The SFS3 Admin Tool (:8080/admin) shows real-time user counts, room lists, and server stats. Access it securely via SSH tunnel or IP-restricted firewall rule.

Auto-restart

Configure SFS3 as a systemd service (Linux) or Windows Service so it restarts automatically after a server reboot or crash. See the SFS3 documentation for service configuration.

NAT Traversal

Players behind symmetric NAT routers may have difficulty connecting via UDP. SFS3’s TCP fallback handles most cases. For full UDP penetration, evaluate TURN relay options.

Scaling

SFS3 Community Edition supports up to 100 concurrent users. For higher player counts, upgrade to SmartFoxServer Pro, which supports clustering and server-to-server communication.

CI/CD Pipeline

Automate JAR builds and deployment with a CI/CD pipeline (GitHub Actions, GitLab CI, etc.). On each push to main, build the JAR with Maven and SCP it to the server automatically.