How-To Create Your Own DayZ Mod Vanilla Server

This guide is complete except for a few items in RED that shouldn’t affect setup, but if you test them out or have any comments, let me know.

This is a step-by-step guide to get a Vanilla DayZ Mod server up and running. It assumes you have basic knowledge of Windows, batch files, MySQL and a few other applications listed below. You should also be able to edit files and keep the syntax correct whether each line has parens, braces, ends in semicolons, is enclosed in quotes or whatever.  If you’ve done any kind of scripting or coding, then this should be straightforward.

At the end of this process you will have a running Vanilla DayZ Mod Chernarus server. If you have questions, go to the #server_guide channel of the Discord

  • Go here to learn to customize your Vanilla DayZ Mod Chernarus server.
  • Go here  if you are interested in setting up a server with a different map.

Requirements

  1. Windows
    • I’ve run a DayZ Mod server on Windows Server 2012+ as well as Windows 7,8,8.1,10 (It seems like most flavors work).
      • I have not personally tried linux, but others have (see this github). The problem is that Linux does not support external calls (which is how the Hive/Db is implemented)
    • Basic configuration is a server with (relatively new) 2 CPU, 3 GB, ~25gb disk (game programs, db, logs, etc). Graphics are not important since you are not running the client. This will handle you and a few friends.
    • A true server will need some more horsepower. While arma2 is older and can’t use more than 2 cores, MySQL and the O/S itself need some computing power. Get it running and then look at the performance monitor.
    • An SSD is helpful for the database files, but could certainly be used for all files.
  2. Arma2 & Arma2 Operation Arrowhead
    • As far as I can tell, you DO NOT need to purchase another license to run the server.
  3. Microsoft Visual C++ Redistributable Packages (x86)
  4. DayZ Mod
    • The latest vanilla codebase will be posted here and downloaded from here
  5. MySQL
    • You need to store all the character data, vehicles and other objects someplace.
  6. HeidiSQL
    • Or another tool to connect to MySQL and run scripts.
  7. SteamCMD (and maybe Steam)
    • Makes downloading/installing arma2 and arma2oa very simple. You may need Steam installed as well. If you are having Steam authorization issues, then you’ll get an error and you’ll need to install Steam. Login and authenticate your server. You DO NOT need to run steam to start the server, you only need it for installation.
  8. BattlEye – The Anti-Cheat Standard
  9. BEC – BattlEye Extended Controls
    • Used for displaying scheduled messages, server restarts, and other functions related to managing the server
  10. DaRT – A Lightweight DayZ (and ArmA) RCon Tool
    • Used to send in game messages and to manage bans

Other useful tools

  1. 7zip
    • Used to compress backups
  2. Notepad++ and the SQF highlighting plug-in
    • Used to edit files
  3. Dropbox
    • Use to move files to your server as opposed to FTP
    • Good as the “Cloud” backup destination
  4. Discord – FREE!

Installation & Configuration

I’ll go step by step and I’m going to make some assumptions that everything is going into some standard directories on your C:\ drive. It makes it much simpler to have a standard point of reference. The scripts I provide will assume all of the directories mentioned.

  1. Download the sample configuration and batch files  from the #files channel on Discord. Don’t forget to edit any usernames and passwords.
    1. steamcmd.zip
    2. cfgday.zip
    3. servertools.zip
  2. Install SteamCMD into c:\steamcmd
    • You may need to install and login to STEAM to authorize this computer depending on the account you use (primary or shared) and whether you have 2-factor authentication setup.
  3. Install Arma2 into c:\arma2
  4. Install Arma2 Operation Arrowhead into c:\arma2oa
  5. Create a SYMLINK from c:\arma2oa\Addons to c:\arma2\Addons
  6. Use create_addons_link.bat to create a SYMLINK from c:\arma2oa\Addons to c:\arma2\Addons
    • This is cleaner than copying the directory over (?? IS THIS NEEDED??)
  7. Edit c:\arma2oa\steam_appid.txt and change the number to “224580” (without quotes).
    • This change will allow your server to show up in the Steam->DayZMod server browser.
  8. Install MSVC 2008,2010,2013,2015 Redistributable Packages (x86)
  9. Install MySQL (5.7 is current as of April, 2016)
    1. By default the install directory is c:\program files\mysql\MySQL Server 5.7
    2. Select the setup type as “Server Only”
    3. Set the config type as “Server Machine”
    4. Set and remember the root password!
    5. Create a user for dayz – the default is “dayzhivemind”
      1. Give the dayz user the “Db Admin” role.
      2. Give this user access to all hosts (%). Might need to do this later in User Manager before running all the SQL scripts.
      3. Remember the password!
    6. Do not install MySQL as a service since it makes a few things more difficult
      1. Identifying startup + shutdown errors
      2. Changing startup parameters
      3. Moving the Db files
    7. By default, the data directory is c:\ProgramData\MySQL\MySQL Server 5.7 – This is a hidden directory and important to know if you want to move the Db (to an SSD, for example).
  10. Install HeidiSQL
    • You’ll need something to run the SQL scripts.
  11. Setup the dayzmod database
    • Connect to your mysql database using HeidiSQL.
    • Make sure your dayz user (default dayzhivemind) has access to all hosts (%). You can change this in Tools->User Manager.
    • Create a new database named hivemind (this is the default in HiveExt.ini)
    • Look for an archive like @SQL-1.8.8.rar and extract the files into any directory.
    • Load and execute each and every SQL file. For 1.8.8, there are 28 SQL files
      1. 3h updates.sql
        • Scheduled events that will run pMain() every 3 hours. You can edit this event to set the instanceid and times to match your restarts OR make sure that your startup process includes a call to pMain(instanceid) (the included script does that). [I’ve always used this method]
      2. character_data.sql
        • All character information (lastlogin, backpack, inventory, worldspace, medical status, kills, etc). Includes dead and alive characters.
      3. character_dead.sql
        • Unused
      4. countVehicles.sql
        • Procedure to count the total number of vehicles
      5. countVehiclesClass.sql
        • Procedure to count the total number of vehicles, by classname
      6. countVehiclesGroup.sql
        • Procedure to count the total number of vehicles by group
      7. event_scheduler.sql
        • Log of the time the scheduled events have run
      8. generateUID.sql
        • Function to generate a unique identifier used by new objects in object_data
      9. getNumSpawnable.sql
        • Function to calculate the number vehicles available to spawn based on individual class max and group max.
      10. object_classes.sql
        • Unused (old spawn table pre-1.8.6.1)
      11. object_data.sql
        • Contains information about all vehicles and player created objects (tents, stashes, sandbag walls, tank traps, walls, gates, tripwires, etc)
      12. object_spawns.sql
        • Unused (old spawn locations pre 1.8.6.1)
      13. pCleanup.sql
        • General db cleanup script. After a certain period of time, deletes 100% damaged vehicles, empty tents, sandbags, tank trap, tripwires, incomplete fences + gates, dead players and base fires.
      14. pCleanupBase.sql
        • After a period of time, sets maintenance status on base walls and gates and degrades them.
      15. pCleanupOOB.sql
        • Removes player created objects AND vehicles placed out of bounds (sometimes called the ‘debug area’)
      16. player_data.sql
        • Mapping of GUID to player name
      17. player_login.sql
        • Log of player login/logout by GUID
      18. pMain.sql
        • Procedure that updates the event scheduler, cleans up random objects, bases and respawns vehicles.
      19. pSpawnVehicles.sql
        • Procedure to respawn vehicles (by instance) based on vehicle max, group max and available locations
      20. randomizeVehicleHitpoints.sql
        • Procedure to randomly set vehicle hitpoints via sets of parts in vehicle_hitpoints
      21. randomizeVehicleInventory.sql
        • Procedure to randomly add vehicle inventory via sets of items in vehicle_inventory
      22. rndspawn.sql
        • Function to return a random number
      23. vehicle_groups.sql
      24. vehicle_hitpoints.sql
        • Sets of partnames as well as minimum and maximum damage
      25. vehicle_inventory.sql
        • Sets of vehicle inventory items and as well as minimum and maximum quantities and spawn chance.
      26. vehicle_locations.sql
        • Sets of vehicles locations
      27. vehicle_spawns.sql
        • List of all vehicles as well as chance to spawn and various other attributes.
      28. vehicle_spawns_groups.sql
    • You will get warnings when runing most scripts. If there is no specific message, just ignore it.
  12. Install the DayZMod Server files into c:\arma2oa
    • Look for an archive like @Server-1.8.7.rar and extract it into c:\arma2oa
    • You should end up with a c:\arma2oa directory structure that will have these entries plus anything else already there from the arma2oa install. (this is a typical list from 1.8.7)
      • c:\arma2oa\@Dayz\
      • c:\arma2oa\@Hive\
      • c:\arma2oa\cfgdayz (you only need to grab the HiveExt.ini from here)
      • c:\arma2oa\Keys\
      • c:\arma2oa\DatabaseMySql.dll
      • c:\arma2oa\DatabasePostgre.dll (not really needed – historic)
      • c:\arma2oa\tbb.dll
      • c:\arma2oa\tbbmalloc.dll
  13. Install the DayZMod Mission files into c:\arma2oa\MPMissions
    • Look for an archive like dayz_1337.rar. 1337 is the server instanceid and is numeric. You can use this number in the directory name OR change it, but  save this number – you’ll need it later.
    • You should end up with a c:\arma2oa\MPMissions directory structure that will have these files and directories. (this is a typical list from 1.8.8). In this example “dayz_1337” can be named anything, but the 1337 is typically the intanceid. the “.Chernarus” refers to the MAP, is required and is important to know if you’d like to run another map.
      • c:\arma2oa\MPMissions\dayz_1337.chernarus\description.ext
      • c:\arma2oa\MPMissions\dayz_1337.chernarus\fixes\ (optional)
      • c:\arma2oa\MPMissions\dayz_1337.chernarus\init.sqf
      • c:\arma2oa\MPMissions\dayz_1337.chernarus\mission.sqm
      • c:\arma2oa\MPMissions\dayz_1337.chernarus\rules.sqf
    • Edit init.sqf
      • dayZ_instance = 1337; // Instance ID of this server
        • Or whatever number you decided to use. Doesn’t matter, just need to be consistent. Should match what you used to call pMain() on startup
      • set dayZ_serverName = “”;  Optional. This will show up as a watermark in the lower left corner (can only be 6 characters long).
      • set dayz_presets to one of “Custom”,”Classic”,”Vanilla”,”Elite” and follow the comments below to adjust other settings if you pick “Custom”
    • Edit rules.sqf
      • Change _messages to reflect whatever you want the players to see on login.
  14. Create a configuration directory named c:\cfgdayz
    • Place HiveExt.ini in c:\cfgdayz
      • Edit HiveExt.ini per the comments inside. Typically, you might edit the [Time] section,  but at a minimum you should edit the [Database] section and update Host, Port, Database, Username, Password. Defaults might be something like:
        • Host = 127.0.0.1
        • Type = MySql
        • Port = 3306
        • Database = hivemind
        • Username = dayz
        • password = dayz
    • Place server.cfg in c:\cfgdayz
      • Edit the hostname to be your server name. This will show up in the Steam browser and other launchers like DayZ Launcher. If you don’t want you server to show up, make it an empty string (hostname=””;)
      • Edit the password if needed
      • Edit and/or add to the motd[] (Message of the Day) to add server name, contact info, whtaver. This shows up during login i nthe lower left corner of the screen (and nobody reads it).
      • Edit maxPlayers
      • Make sure verifySignatures=1;
      • Make sure requiredBuild = 131129; (or higher if a new build of arma2oa is released)
      • Edit the template to match the name of your mission directory in the c:\arma2oa\mpmissions directory (for example)
      • template = dayz_1337.Chernarus;
    • Place basic.cfg in c:\cfgdayz
    • Create a BattlEye directory named c:\cfgdayz\BattlEye
      • put your bans.txt in this directory OR just an empty text file.
      • Place latest BE Filters in c:\cfgdayz\BattlEye
      • Place BEServer.cfg in c:\cfgdayz\BattlEye and CHANGE RconPassword
      • You’ll need this password for DaRT and other admin tools. Do not leave the default and remember the new password. Note – while the server is running the file will be renamed slightly “BEServer_NNNN.cfg” and it will be locked. Once the server it stopped, it will be renamed back and can be edited.
  15. Create a tools directory named c:\ServerTools – each of the batch files listed below need to be edited if you have changed any of the default directories. Also, review each one for any specific directories or login info. For example, the scripts refer to some cloud directories which are dropbox directories for cloud backups.
    1. Put mysqlstartup.bat in c:\ServerTools
      • ALWAYS run this script as ADMINISTRATOR
    2. Put mysqlshutdown.bat in c:\ServerTools
      • You can run this or just ctrl-c in the mysql window. MySQL is needed for the server to work, so it will always be running.
    3. Put mysqlbackup.bat in c:\ServerTools
      • Based on standard MySQL backup scripts
      • Review the file and edit all appropriate variables for your environment.
      • Create one or more Windows scheduled tasks to backup the database
    4. Put WatchDog.bat in c:\ServerTools
      • This is the KEY batch file that run MySQL->pMain(), starts arma2oaserver, starts BEC and zips and rotates the log files. This batch file also watches to make sure the arma2oaserve.exe process is running and if not, restarts it.  Review this file and make sure to edit all appropriate variables for your environment.
        • Directories for arma2, arma2oa, mysql, BEC, config files, BE
        • server name, IP, port, instanceid (VERY IMPORTANT)
        • mysql username, password db, port
        • Review every single line that starts with “set”
      • There is an aram2oaserver glitch (discussed in troubleshooting below) which a possible workaround is to “lock” the server during startup. This is done by closing/opening the firewall port. Looking for the following and make sure name= maches the name of your firewall rules that you will setup below.
        • netsh advfirewall firewall set rule name=”ArmA 2 OA UDP 2302″ new enable=no
        • netsh advfirewall firewall set rule name=”ArmA 2 OA UDP 2302″ new enable=yes
      • Note that restarting the server(arma2oaserver.exe) is technically incorrect terminology. This script will start the server executable, then look every 30 seconds to make sure the  process is still running. If it’s not running, the scripts will start it again. BEC is used to shutdown the server and then the script notices its not running and starts it again.
    5. Put BEC into c:\servertools\BEC
      • Extract the BEC.zip into here.
      • Edit c:\servertools\BEC\config\config.cfg and
        • make sure IP, Port and BePath are set correctly
        • Unless you have a custom bans file, then comment out that config like this
        • # BeCustomBanFiles = Bans1.txt, file2.txt, file3.txt
        • unless you are whitelisting players, then comment out that config like this:
        • # Set the path to the file containing whitelisted guids.
          #WhiteListFile = WhiteList.txt
        • # Set custom whitelist kick message. Text must be in ascii letters. MAX 58 CHARS. BE only does ascii on messages
          #WhiteListKickMsg = You are not whitelisted on this server.
      • Edit c:\servertools\BEC\config\scheduler.xml to setup scheduled messages and shutdowns, etc.
      • BEC is no longer being maintained. On startup BEC will try and update and will timeout with an error. You can ignore it. To make the timeout quicker, add the following 2 lines to your Windows HOSTS file (by default it is c:\windows\system32\drivers\etc\hosts):
        • 127.0.0.1 ibattle.org
        • 127.0.0.1 www.ibattle.org
  16. Put Dart into c:\ServerTools\dart
    • If you haven’t already done so, edit c:\cfgdayz\BE\BEServer.cfg and CHANGE RConPassword.
  17. Run the file DXSETUP.EXE, found in the DIRECTX directory of Arma 2 Operation Arrowhead – usually C:\Program Files (x86)\Steam\steamapps\common\Arma 2 Operation Arrowhead\DIRECTX

Firewall Settings

  1. Arma2OAServer.exe (default ports)
    • 2 INBOUND rules – port 2302, 2303, UDP (make note of the name)
    • 1 OUTBOUND rule Arma2OAServer.exe, UDP (make note of the name)
  2. MySQL.exe (default port)
    • mysql uses port 3306. If you are running a publicly hosted server, the best security policy is to close this port and only access it locally.
    • If you leave this port open, you should restrict inbound access to your personal IP address. If you do not,  you will most likely see bad logins in the MySQL Console – this is hackers doing port scans and trying to get in.

Router Settings

If you are creating a server on a PC in your home, don’t forget to create the port forwarding for 2302 (required), 2303 (required) and 3306 (only if needed).

Startup

  1. Start MySQL
    • Run c:\servertools\startmysql.bat as ADMINISTRATOR
  2. Start arma2oaserver and BEC
    • Run c:\servertools\watchdog.bat
  3. Start DaRT
    • Run c:\servertools\dart\dart.exe
    • Set the IP address of your server (127.0.0.1 if its local)
    • Set the password to whatever you put in BeServer.cfg
  4. Connect to the server via the DayZ Mod Steam link!
    • The arma2oa link will not work

Discord

DayZ Launcher

  1. Your server will not show up automatically. Go to http://dz.launcher.eu/check and enter your IP and port and press “Check”. Now it will show up on the list.
  2. Players will need to check the “Launch DayZ Mod as Steam App” in the Settings to connect to your server.

Troubleshooting (while getting the server to run)

  1. If you get an error about “x3daudio1_6.dll”
    • You need DirectX9.0c.
    • Run the file DXSETUP.EXE, found in the DIRECTX directory of Arma 2 Operation Arrowhead – usually C:\Program Files (x86)\Steam\steamapps\common\Arma 2 Operation Arrowhead\DIRECTX
    • If you download DirectX from Microsoft you may get a newer version that will not fix this issue. You need the particular version shipped with arma2oa.
  2. If you get and error that MSVCP1000.dll is missing
    • You need the Microsoft Visual C++ 2010 Redistributable Package.
    • Download it here or google it, if it’s moved.
  3. If clients hang on “waiting for host” but the logs look ok.
    • Find each and every .DLL file in the c:\arma2oa directory, right-click on properties. In the main screen or maybe in the security tab look for a button labeled “unblock” and click it. Sometimes .DLL files moved from other windows servers are blocked by windows security features….sometimes.
  4. If BEC starts up, tries to update and immediately exits
    1. Check to make sure you updated your HOSTS file as noted above.

Troubleshooting (while administering the server)

  1. Vehicles aren’t spawning!
    • Before arma2oaserver starts, a call is made to MySQL->pMain() (via the watchdog.bat script). This is what causes all of the built-in SQL scripts to cleanup objects and spawn vehicles.
    • If you can’t find any vehicles in the game, make sure every place instanceid was set is the same. A very common mistake is to set it to one thing in init.sqf and another in the startup. Take a look in object_data at the instanceid column. That is what the game reads from – does it match init.sqf?
    • If you still can’t figure it out, make sure that all of the SQL files have been run successfully. The game will still work without a number of the tables and procedures.
  2. Players are complaining that all the tents, stashes, bases and vehicles are GONE but the database looks fine.
    • Its an arma2oa glitch. You’ll have to restart the server to fix this. All of those objects are read into the server from the database on the first player connection. If that player has a bad connection or gets disconnected, the game will start but the objects may not load.
  3. If the arma2oaserver.exe process crashes, you will most likely see the dialog “arma2oaserver.exe has stopped working” and you have to click on “Close the program” to get it to go away. The problem with this is that the watchdog.bat script is looking for the process, which is still running until you close that dialog.
    • To change this, and have the process just die and go away, you need to turn off the error dialog in the windows group policy editor.
    • This blog has a thorough description of how to do it, but here are the steps.
      • Open the Group Policy Editor by typing gpedit.msc into the Start search box or the Run dialog.
      • Navigate to Computer Configuration > Administrative Templates > Windows Components > Windows Error Reporting. Double click on “Prevent display of the user interface for critical errors” in the pane on the right.
      • Click on the radio button Enabled and then press OK.

Troubleshooting (from the client side)

  1. If you get the error “This server is running an incorrect version of the server side application. You cannot play on this server”
    • You forgot to install the Microsoft Visual C++ 2010 SP1 Redistributable Package (x86)
  2. If you get “Session Lost”
    • The server appid is set 224580, which means the players need to use STEAM->dayzmod to launch the game OR dayzlauncher with “launch dayzmod as steam app” checked in the settings.
    • Steam should be run as ADMINISTRATOR

Open Items

  1. User profiles and Settings (Waypoints, Map centering , Crosshairs etc.)

Finally, remember that DayZ Mod (Released 2012) is based on Arma II Operation Arrowhead (released in 2010) which is based on Arma II (Released 2009). A lot of the community has moved on to Arma III or DayZ Standalone or other games entirely. Plenty of the information out there is old, incomplete or not applicable to the codebase you are working on.  Dont be discouraged – If you dig in, ask some questions online (there are still a few people helping), then you’ll figure it out.

Advertisements

4 thoughts on “How-To Create Your Own DayZ Mod Vanilla Server

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s