Stardew Valley
0 of 0

File information

Last updated

Original upload

Created by

funny-snek and Zuberii

Uploaded by


Virus scan

Safe to use

About this mod

Allows the multiplayer host to stay online even when they are not physically present.

Permissions and credits
Always On Server

This is a "Headless Server" mod allowing the host and thus the game world to remain online always, much the way Minecraft and other online games function. It accomplishes this by automating the Host's day-to-day activities. AKA a "Bot" that plays the game for you when you are away.

Only the player hosting needs the mod!

  1. Created a 24/7 server using this mod. Join us:
  2.  I've provided links and guides to everything you should need on this page to create your own 24/7 multiplayer server managed through Discord.

How to Install:

  1. Install SMAPI:
  2. Place the "Always On Server" folder inside the "Mods" folder in your StardewValley game directory.
  3. Launch the game via "StardewModdingAPI.exe".

How to Use:

  1. Change your settings to what you prefer in the config.json file in the "Always On Server" folder before you start the game.
  2. Host a multiplayer game like you normally would. The server mod will start automatically when the game starts.
  3. Pres the "F9" button on your keyboard to turn server mode on/off. (For when you want to play the host yourself)
  4. Warning! - The server will hang on the save screen if the game is minimized in windows. It doesn't have to have focus, you can go do other things, but IT CAN NOT BE MINIMIZED! (Not sure about Mac/Linux)


  • Edit the "config.json" file in the "Always On Server" folder to set your options.

"serverHotKey": "F9",    (which button to start/stop server)
"profitmargin" : 100,            (Profit Margin in percent)
"upgradeHouse": 3,      (Upgrades the main house. 3 is max level, 0 will do nothing)
"petname": "Funnysnek",    (what is petname? must be 10 characters or less, can change at any time)
"farmcavechoicemushrooms": true,(make farm cave mushroom, false will be bats, choose before run)
"communitycenterrun": true,      (host will attempt CC run,  false will do Joja run)

"timeOfDayToSleep": 2200,       (when does the host sleep in military time, up to 2600 for 2 A.M.)
"lockPlayerChests": true,           (while servermode is on, players can not access the chests or inventory in other
    player's cabins.)
"clientsCanPause": false,   (type !pause/!unpause into chat)
"copyInviteCodeToClipboard": true,(copies current invite code to your computer's clipboard once a minute)
"festivalsOn": true,(host will go to festivals)
"<eventname>CountDownConfig": 60,   (how long in seconds from the start of the festival until it's main event)
"<eventname>TimeOut": 120,   (how long in seconds until the connection resets to prevent lockup from an AFK player.
    Most festivals start this timer after their final cutscene ends. Fair, Spiritseve, and
    Winterstar start this timer as soon as the festival starts)
 Chat Commands
  Clients can type these into chat if the game gets stuck.

  • !sleep - tries to trigger the sleep command if it's past the config sleep time (default 10PM)
  • !festival - tries to trigger the go-to-festival command if it is a festival day
  • !event - tries to trigger the command to start the main event of a festival
  • !leave - will attempt to leave a festival 
  • !unstick - will warp the host inside/outside the farmhouse (which generally seems to get through any bugs. Sometimes it takes a few warps, especially for festivals.)

Accessing the Server

  • Friends List: Your Steam or GoG friends should be able to see your game and join at will the same way they would normally.
  • Direct IP: If you want to set a up direct IP access over the internet "Join LAN Game" you need to open (or forward) port 24642. Or use Server Port Changer to choose a different port.Then give people your external IP.
  • Invite Code: Invite Code connections are routed through Steam/GoG . I've provided two methods for delivering your game's current invite code to players:
    • Invite Code Auto Copy/Paste: The server will copy the most up-to-date invite code to the clipboard (on by default in the config.json file) whenever it changes. You can then use a macro program of your choice to paste that code into the chat service of your choice so that your non-steam friends can always have access to the most up-to-date invite code even when you are not there. For your convenience I've included an AutoHotkey script under the Files Tab> Optional Files here on Nexus that you can use. Run the Game Server>Run the AutoHotKey Script>Open Discord or other chat service and click into the chatbox of that service. The current invite code for your game will be pasted and sent every two minutes. Do not close the chat window of your chat service or click out of the chat box or it will not work. When the game server is turned off it will no longer copy the key so be sure to turn off AutoHotKey as well.
    • Invite Code Bot: The server will copy the invite code to an "InviteCode.txt" file in the same folder as the mod. You can use this to make a bot for a chat service/website/etc. I've provided the code for a node.js Discord bot in the "Discord Bots" section at the bottom of this page.


  • Only the host needs to install the mod
  • Host Teleports to bed and Auto-Sleeps every day (default 10P.M., can change in config.json) so that other players can keep playing without the host having to be at their computer. Other players can go to bed when they're ready and won't be stuck waiting on the host.
  • Checks Mail every day
  • Does host set up (cave/pet/house/etc)
  • Locks client chests to everyone but cabin owner (optional)
  • Clicks "OK" on the end of day Shipping Menu allowing the game to save and sync with the clients.
  • Pauses the game when all clients disconnect (except on Holidays to prevent lock-up). Resumes when at least 1 client rejoins. This prevents the farm from falling into disrepair and years of game time passing with no one around.
  • Freezes Relationship Heart Loss for Host while "server" is running
  • Full Festival Support! - Events like Egg Hunt, Ice Fishing, etc begin 1 minute after festival starts so players have some time to look around. Host will not go to sleep until after Festival time window is over. Clients can choose to go to festival or not, server will still work. All clients must go to festival to trigger it to start just like normal game-play.
  • Full Event Support! - Grampa Evaluation, Kent arrival, all cutscenes, etc etc will all click through if they pop-up allowing the server to stay online and not get locked up.
  • Festival and Event Warnings sent to clients via chat.
  • Times Out and resets the server connection to prevent an AFK'er or the game's own connection bugs from locking up the game indefinitely(A 2 minute warning is sent out in chat before the end of the appropriate festivals to let everyone know to exit or they will be kicked).
  • Turns off "Pause When Game Window Is Inactive" so you no longer have to.
  • Config file for various settings
  • Copies most up-to-date Invite Code to clipboard
  • Copies most up-to-date Invite Code to "InviteCode.txt" file inside the "Always On Server" mod folder
  • Joja run will buy upgrades going from lowest cost to highest every time you have double the cost saved up. E.G. Joja Minecarts cost 15,000g so it will buy them when you have 30,000g

Complimentary Mods


  • Anything that messes with the game time/date is likely to cause issues since everything the bot does is triggered off timing.
  • There's lots of other mods that don't necessarily conflict with this mod specifically but do conflict with multiplayer in general.

How to keep server going even when Stardew Valley crashes

  • This is the method I use. I'm sure there are others. (For Windows, sorry Mac/Linux some of this might be helpful but mostly not)
  • Install the "Autoload" mod from the "Complimentary Mods" section above. This is so the game will load right back into the save you want and not get stuck on the title screen. Be sure to adjust its config.json file to load into multiplayer.
  • Download RestartOnCrash:
  • In it's options choose: "StardewModdingAPI.exe" for the application, Check "It's not responding to Windows Messages", Check "Wait 310 seconds and double-check (I would set this to slightly longer than your endofdayTimeOut setting for the mod)" and Check "Kill the process" DO NOT CHECK "Execute a Command". We are taking care of that with another method.
  • Download the Auto-Restart-SDV file I have included in Optional Files 
  • Place the "StardewValleyModdingAPIautorestart.bat" where ever you like. Right click on it and edit it. Change the 3 directories to your own file locations, save and close. (the two .marker files don't actually exist unless your game crashes, the bat will then delete them so that SMAPI doesn't ask you to press a key on restart)
  • Run the game by double clicking on the "StardewValleyModdingAPIautorestart.bat"
  • This will auto-restart the game if it ever crashes, and the "RestartOnCrash" program will kick off that restart if the game ever locks up and just stops responding.
  • See "Discord Bots" section below for useful bots related to this.

Discord Bots

  • How to set up a node.js discord bot: video tutorial  (Something the tutorial doesn't mention, in Visual Studio Code make sure file>autosave is checked then it will work just like the tutorial)
  • Invite Code Bot: The server will copy the invite code to an "InviteCode.txt" file in the same
  • folder as the mod. Here is the bot source code for a discord bot.
  • Server Connection Reset Bot: Also in the Optional Files I have added a "Server Reset Mod". I use this to allow my Discord
  • admins (on a private channel) to remotely reset the server connection through a Discord Bot. Here is the source code for that Discord Bot. This can be useful if a player AFKs or the save window otherwise gets hung up and you don't want to wait for the server mod to automatically time out.
  • Reset Game Bot: I set up a Discord Bot (source code) to run a .bat file with this line no quotes 'taskkill /F /IM StardewModdingAPI.exe' to kill the game. Then the settings from the "How to keep the server going even when Stardew Vallye crashes" section above will reboot the game.
  • Server Status Bot: You can use this bot (source code) to display if the server is on and how many players are online.
  • Bots never turn off: I use this to make sure my discord bots never turn off. Install this and
  • when you go to start your bot how you normally would, instead type "pm2 start" in front of it. As long as your computer is running this will always restart your bots if they crash.

This is my first mod! WooHoo!
Huge thanks to Zuberii who co-authored much of the Festival code.
Source for anyone who wants to dig through my spaghetti. It's pretty ugly. This is one of the first things I've ever coded.
Requires SMAPI by Pathoschild+ and SDV 1.3+.