In this section, you will learn how to configure your server’s .env
file. This file allows you to set the server name, customize the Discord and welcome messages, and specify the server’s IP address.
Before proceeding, ensure you have a local or dedicated server running. Also, make sure the .env
file exists in your server directory. Since the file is considered hidden, you may need to adjust your file explorer settings to view hidden files.
Open you .env file and you should be able to see a similar content:
#Used for production depending on gamemode if servers are hosted on same machine#
SERVER_PORT=7337
#Used for encryption between game client and server
SERVER_SECRET=YourSecretEncryptionKey123456789
#Name displayed on the servers list
SERVER_NAME="My Stickforge Server"
SERVER_MENU_TEXT="Welcome to the My Stickforge server! ✨"
SERVER_WELCOME_GAME_TEXT="Welcome to the My Stickforge server! Remember to always be polite with your fellow players. Have fun!"
SERVER_END_GAME_TEXT="Game ended! The room will be closed in {{secondsRemaining}} seconds."
SERVER_SOCIAL_DISCORD_TEXT="Stickforge Discord Server"
SERVER_SOCIAL_DISCORD_LINK="https://discord.gg/CtguH3E8aG"
#IP binding, used for the client to connect to the server, that will be the IP displayed by the master server in the servers list
SERVER_IP="127.0.0.1"
#Will the server be displayed on the servers list in Stickforge game
# 1 - Server will be displayed (default)
# 0 - Server will be hidden
SERVER_PUBLIC=1
#### SETTINGS ####
#Daily rewarding for players
SETTINGS_DIAMONDS_WELCOME_REWARDING=5000
SETTINGS_DIAMONDS_DAILY_REWARDING=0
SETTINGS_COINS_WELCOME_REWARDING=2500
SETTINGS_COINS_DAILY_REWARDING=40
# Possible values for Winston: debug, info, warn, error
SETTINGS_LOG_LEVEL_CONSOLE=debug
SETTINGS_LOG_LEVEL_FILE=warn
# Maximum limit for player and projectile IDs
SETTINGS_MAX_ID=8184
# Timeout for client disconnection if no response is received on the first frame (gives time to load the map)
SETTINGS_CLIENT_TIMEOUT=60000
# Price modifier for items (e.g., 15% off for diamonds, skins)
SETTINGS_ITEMS_PRICE_MODIFIER=1
# Maximum level cap (null = infinite)
SETTINGS_LEVEL_MAX=null
# Conversion rate (18 coins for 1 diamond) (not used for now)
SETTINGS_SERVICES_COINS_TO_DIAMONDS_CONVERSION_RATE=18
# Delay before player suicide respawn (after changing stuff)
SETTINGS_DELAY_BEFORE_SUICIDE_RESPAWN=5
# Client rollback if position mismatch between player and server
SETTINGS_ROLLBACK_DISTANCE=250
# Maximum allowed rollbacks before a player is kicked
SETTINGS_MAX_ROLLBACKS_BEFORE_KICK=300
# #### Sprite Scaling ####
# EXPERIMENTAL MODIFY AT YOUR OWN RISK
# Scale factor for sprites
SPRITE_SIZE=0.2
Variable | Description |
---|---|
SERVER_PORT |
Port used by the server for connections. Important when multiple servers run on the same machine. |
SERVER_SECRET |
Encryption key for secure communication between the game client and server. |
SERVER_NAME |
Name displayed in the server list of the game. |
SERVER_MENU_TEXT |
Text shown in the server menu. |
SERVER_WELCOME_GAME_TEXT |
Message displayed to players when they join a game. |
SERVER_END_GAME_TEXT |
Message displayed when the game ends; {{secondsRemaining}} shows countdown before room closes. |
SERVER_SOCIAL_DISCORD_TEXT |
Label for your Discord server in-game. |
SERVER_SOCIAL_DISCORD_LINK |
Link to your Discord server. |
SERVER_IP |
IMPORTANT: IP address the server binds to; shown in the server list for clients to connect. If the wrong if is configured, players won't be able to connect |
SERVER_PUBLIC |
Determines if the server is visible in the game server list: 1 = visible, 0 = hidden. |
SETTINGS_DIAMONDS_WELCOME_REWARDING |
Number of diamonds awarded to players upon joining for the first time. |
SETTINGS_DIAMONDS_DAILY_REWARDING |
Number of diamonds awarded daily (currently 0). |
SETTINGS_COINS_WELCOME_REWARDING |
Number of coins awarded to players upon joining for the first time. |
SETTINGS_COINS_DAILY_REWARDING |
Number of coins awarded daily to players. |
SETTINGS_LOG_LEVEL_CONSOLE |
Logging level for console output (debug, info, warn, error). |
SETTINGS_LOG_LEVEL_FILE |
Logging level for file output (debug, info, warn, error). |
SETTINGS_MAX_ID |
Maximum allowed ID for players and projectiles. |
SETTINGS_CLIENT_TIMEOUT |
Time in milliseconds before a non-responsive client is disconnected. |
SETTINGS_ITEMS_PRICE_MODIFIER |
Multiplier for item prices (e.g., 1 = normal price, 0.85 = 15% off). |
SETTINGS_LEVEL_MAX |
Maximum level players can reach (null = no limit). |
SETTINGS_SERVICES_COINS_TO_DIAMONDS_CONVERSION_RATE |
Conversion rate of coins to diamonds (currently not used). |
SETTINGS_DELAY_BEFORE_SUICIDE_RESPAWN |
Delay in seconds before a player respawns after suicide. |
SETTINGS_ROLLBACK_DISTANCE |
Distance threshold for client-server position mismatch before rollback occurs. |
SETTINGS_MAX_ROLLBACKS_BEFORE_KICK |
Maximum allowed rollbacks before a player is kicked for desync. |
SPRITE_SIZE |
Scale factor for sprites (experimental; don't modify). |