Volume 2 Server Setup: Difference between revisions

From OuroDev
Asuffield (talk | contribs)
Updated links
 
(37 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Required Software ==
__TOC__
* Ouroboros Volume 2 Binaries. For this guide, we will assume that you are installing them into C:\Ouroboros. You can either:
** Download a released version of Volume 2 (not yet available)
** Follow [[Volume 2 Build]] to compile it from source, then copy the contents of the bin directory to c:\Ouroboros
* Database schema definitions. For now, get them from https://git.ourodev.com/CoX/Source/src/tag/v2-i1.0.0/Assets/DBSchemas
* SQL Server 2012  or later (Express is good enough for development)
:* [https://www.microsoft.com/en-us/sql-server/sql-server-editions-express SQL Server 2017 Express Edition]
* [https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017 SQL Server Management(SSMS)]
* Download the [magnet:?xt=urn:btih:n642zelj2se2yn2ovmfy2z74tyyf7scs&dn=City%20of%20Heroes&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce Issue 24 client and data files] - this is ''not'' the SCORE client/data.
* Download [magnet:?xt=urn:btih:CCCE574F7F89229B0FC2EF8AD898BE451864863A&dn=CoHDev_Source_Files_Current%28Updated%29.zip&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce CoHDev_Source_Files_Current(Updated).zip].
* Download [magnet:?xt=urn:btih:8CE9DE8ECCF29B899B247512F1082F20B59DC4B2&dn=ServerData.7z&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce ServerData.7z].


== Install SQL Server 2017 Express ==
This guide will help you get started in running your own City of Heroes server on your local host (127.0.0.1). It assumes that you will run the City of Heroes client on the same machine as the server.  Once you have that working, you can move on to the following guide which explains how to modify your server to allow external access from game clients on other machines.
: You can install SQL Server pretty much on the default settings.
:: Select Basic under installation type:
::: [[File:SQL Server Install 2017 Express.png|thumb|none]]
:: Agree to the EULA if you want to use SQL Server.
::: [[File:SQL Server Install 2017 Express - 2.png|thumb|none]]
:: Tell the server where to install files. I changed this for ease on my system.
::: [[File:SQL Server Install 2017 Express - 3.png|thumb|none]]
:: It should begin installing and eventually you should see "Install has completed successfully". Click close.
::: [[File:SQL Server Install 2017 Express - 4.png|thumb|none]]


== Install SQL Server Management(SSMS) ==
==Recommended hardware and settings==
: You can install SQL Server Management on default settings.
:: Select the location you'd like to install SSMS to. The default is fine.
::: [[File:SSMS Install - 1.png|thumb|none]]
:: It will take awhile to install and you'll see a little progress bar letting you know whats going on
::: [[File:SSMS Install - 2.png|thumb|none]]
:: Eventually it will ask you to reboot the system. Might as well as do that now.
::: [[File:SSMS Install - 3.png|thumb|none]]


== Setup Server Files ==
#The main requirement for City of Heroes is having a decent amount of RAM. The minimum amount for a small personal server is about 8 GB of RAM, with 32 GB of RAM being the recommended amount.
: Create a directory in ''C:\Ouroboros'' called ''data''.
#*If you are running with less than the recommended 32 GB of RAM, it is also recommended that you increase your Windows paging file to simulate having more RAM (Control Panel->System and Security->System->Advanced System Settings->Advanced->Performance Settings->Advanced->Virtual Memory->Change). Setting your paging file to 32768 MB works well for a server with 8 GB of RAM.
:: Open ''ServerData.7z'' and extract all files into ''C:\Ouroboros\data'' (the newly created directory).
#*To support a larger number of players connecting, you will need to add more RAM to your server, though it currently isn't clear at what numbers of players these recommended values become insufficient.
:: Open ''CoHDev_Source_Files_Current(Updated).zip''.
#*For the purposes of this guide, I am using 64.0 GB (G. Skill Trident Z Royal Silver 3200Mhz PC4-25600).
::: Extract "i24 Server and Client Piggs (extracted with CoHTools)" into ''C:\Ouroboros\data''.
#The server is CPU-intensive, having a decent CPU is important.
::: Copy ''maps.db'' from "map.db (modified, working on current VS2010 build)" and place it in ''C:\Ouroboros\data\server\db'', overwriting the old maps.db
#*This setup has been tested with multiple configurations with the oldest recommended being an Intel Core i7 6th Generation Processor.
:: Copy the ''piggs'' folder from your i24 client directory and place them in ''C:\Ouroboros\''. You should end up with ''C:\Ouroboros\piggs\'' populated.
#*For the purposes of this guide, I am using the Intel Core i9-9900K Processor.
: Create a directory in your C: drive called "CoH_Data" and another directory inside that, called "attributes" (''C:\CoH_Data\attributes'').
#Running the server on a solid state drive instead of a spinning disc hard drive is recommended.
:: Run this in a command prompt:
#If you are installing the server on a computer that you own, your router will need to support NAT loopback if you want game clients to be able to connect to it from both inside and outside of your LAN.
::: {{ms|cd Source\bin}}
#*For the purposes of this guide, I am using an ASUS ROG GT-AX11000 gaming router.
::: {{ms|.\mapserver.exe -productionmode -templates}}
:: Copy all files from ''C:\CoH_Data\attributes'' and place them into ''C:\Ouroboros\data\server\db\templates''.
: Open ''C:\Ouroboros\DBSchemas'' and execute all the .sql files in the directory. You may need to change the file path -- anywhere works. Drop old database references before if there are any.


== Database setup ==
==Required software==
# You will need to choose a password for the database user. In these examples it will be "YOURL33TPASS!".
Download all of the following files:
# Launch SQL Server Management Studio from the start menu
 
# Hit "Connect" on the screen that pops up, with default settings: [[File:SQL Connect.png|thumb|none]]
#[https://www.microsoft.com/en-us/sql-server/sql-server-editions-express SQL Server 2017 Express Edition]
# We need to enable the sa login so that server can login to the database.
#SQL Server Management (SSMS) 18.3.1
## If you look to the left panel you will see the object explorer and your connection. Right click it and select properties. [[File:SQL Properties.png|thumb|none]]
#*https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017
## When this window comes up hit Security to the left and enable "sql server and windows authentication".  Then click ok. [[File:SQL Security.png|thumb|none]]
#*This is the latest release at the time of this documentation and has been tested.
## In the same panel you used before navigate to Security -> Logins then right click and enter properties the sa user. [[File:SA Properties.png|thumb|none]]
#The latest stable release of the CoX/Source files from https://git.ourodev.com/CoX/Source/-/jobs/202/artifacts/download?file_type=archive.  These are the compiled files from the OuroDev build machine.  Extract the contents of the zip file into C:\Ouroboros. (or if you want to compile the source files yourself, follow the [[Volume 2 Build]] instructions, then copy the contents of the Source\bin directory to C:\Ouroboros)
## In this window set the password to the same password you set back at step 4 [[File:Login Props.png|thumb|none]]
#Database schema definitions. Get them from https://git.ourodev.com/CoX/Source/-/tree/v2-i2.1.0/Assets/DBSchemas
## Choose Status from the left panel in this same window and set login to enabled and hit ok. [[File:Login Status.png|thumb|none]]
#Sample server config files. These come with the v2 source - https://git.ourodev.com/CoX/Source/-/tree/v2-i2.1.0/bin/data
## Right click the connection in the object explorer again and click Restart. [[File:SQL Restart.png|thumb|none]]
#the [magnet:?xt=urn:btih:n642zelj2se2yn2ovmfy2z74tyyf7scs&dn=City%20of%20Heroes&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce Issue 24 client and data files] - this is ''not'' the SCORE client/data.
# Next we need to apply the schema for the databases which require this to be done manually (account, auction, auth, and chat)
#[magnet:?xt=urn:btih:CCCE574F7F89229B0FC2EF8AD898BE451864863A&dn=CoHDev_Source_Files_Current%28Updated%29.zip&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce CoHDev_Source_Files_Current(Updated).zip].
## Click File -> Open -> File, navigate to the dbschemas that you downloaded at the start, and select cohauc.sql [[File:SSMS File Open.png|thumb|none]] [[File:SSMS Open DBSchema.png|thumb|none]]
#[magnet:?xt=urn:btih:8CE9DE8ECCF29B899B247512F1082F20B59DC4B2&dn=ServerData.7z&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce ServerData.7z].
## You will see a '''create database''' statement near the top of the file, with two lines that include a '''filename''' parameter. [[File:SSMS DBSchema SQL SRV STR.png|thumb|none]]
#Volume 2 Piggs: https://git.ourodev.com/CoX/i2401-bin-server/-/tree/master/piggs
## Set these to the directory where you want to create the database files. For this example, I have created a directory {{ms|C:\OuroborsDb}} and put the database there:
 
##: <syntaxhighlight lang="SQL">( NAME = N'cohauc', FILENAME = N'C:\OuroborosDb\cohauc.mdf' , SIZE = 157440KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )</syntaxhighlight>
==Optional but recommended tools==
##: <syntaxhighlight lang="SQL">( NAME = N'cohauc_log', FILENAME = N'C:\OuroborosDb\cohauc_log.ldf' , SIZE = 353216KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)</syntaxhighlight>
Download all of the following:
## Click the Execute button [[File:SSMS Execute.png|thumb|none]]
 
## Repeat these steps for cohacc.sql, cohauth.sql and cohchat.sql. '''Do not use cohdb.sql'''
#(Optional) Install 7zip (https://www.7-zip.org/download.html)
#*Useful if you do not already have a tool to handle zip files
#(Optional) Install Notepad++ (https://notepad-plus-plus.org/downloads/v7.7.1/)
#*Useful for editing config files.
 
==Install SQL Server 2017 Express==
 
:You can install SQL Server pretty much on the default settings.
::Select Basic under installation type:
:::[[File:SQL Server Install 2017 Express.png|thumb|none]]
::Agree to the EULA if you want to use SQL Server.
:::[[File:SQL Server Install 2017 Express - 2.png|thumb|none]]
::Tell the server where to install files. I changed this for ease on my system.
:::[[File:SQL Server Install 2017 Express - 3.png|thumb|none]]
::It should begin installing and eventually you should see "Install has completed successfully". Click close.
:::[[File:SQL Server Install 2017 Express - 4.png|thumb|none]]
 
==Install SQL Server Management(SSMS)==
 
:You can install SQL Server Management on default settings.
::Select the location you'd like to install SSMS to. The default is fine.
:::[[File:SSMS Install - 1.png|thumb|none]]
::It will take awhile to install and you'll see a little progress bar letting you know whats going on
:::[[File:SSMS Install - 2.png|thumb|none]]
::Eventually it will ask you to reboot the system. Might as well as do that now.
:::[[File:SSMS Install - 3.png|thumb|none]]
 
==Setup server files==
 
#At this point, you should have ''C:\Ouroboros'' containing exes and dlls
#Create a directory in ''C:\Ouroboros'' called ''data''.
#Open ''ServerData.7z'' and extract all files into ''C:\Ouroboros\data'' (the newly created directory).
#Open ''CoHDev_Source_Files_Current(Updated).zip''.
##Extract "i24 Server and Client Piggs (extracted with CoHTools)" into ''C:\Ouroboros\data''.
##Copy ''maps.db'' from "map.db (modified, working on current VS2010 build)" and place it in ''C:\Ouroboros\data\server\db'', overwriting the old maps.db
#Copy the ''piggs'' folder from your i24 client directory and place them in ''C:\Ouroboros\''. You should end up with ''C:\Ouroboros\piggs\'' populated.
#If installing v2i1, create a directory in your C: drive called "CoH_Data" and another directory inside that, called "attributes" (''C:\CoH_Data\attributes''). In later versions, this isn't necessary.
#Run the following in a command prompt. If it gives you an error message, check the [[#Troubleshooting|Troubleshooting]] section. '''It is essential to run this after all the above steps, because it will overwrite some of the files.'''
#:{{ms|cd c:\Ouroboros}}
#:{{ms|.\mapserver.exe -productionmode -templates}}
#If installing v2i1, copy all files from ''C:\CoH_Data\attributes'' and place them into ''C:\Ouroboros\data\server\db\templates''.  If installing a later version, the files should be placed there automatically.
#If you didn't get them from a downloaded release, copy all sample config files from Source/Assets/ConfigFiles into ''c:\Ouroboros'' (for example: Source/Assets/ConfigFiles/data/server/db will become C:/Ouroboros/data/server/db)
 
==Database setup==
  Note: If you have a problem downloading these files, copy and paste the contents into notepad++, and then save the file into the “TMP” folder you created with the same name, for example (cohdb.sql)
 
#Download the latest database schema definitions from the link below.
#*You will need to setup an account first.
#*https://git.ourodev.com/CoX/Source/-/tree/v2-i2.1.0/Assets/DBSchemas
#You will need to choose a password for the database user. In these examples it will be "YOURL33TPASS!".
#Launch SQL Server Management Studio from the start menu
#Hit "Connect" on the screen that pops up, with default settings: [[File:SQL Connect.png|thumb|none]]
#We need to enable the sa login so that server can login to the database.
##If you look to the left panel you will see the object explorer and your connection. Right click it and select properties. [[File:SQL Properties.png|thumb|none]]
##When this window comes up hit Security to the left and enable "sql server and windows authentication".  Then click ok. [[File:SQL Security.png|thumb|none]]
##In the same panel you used before navigate to Security -> Logins then right click and enter properties the sa user. [[File:SA Properties.png|thumb|none]]
##In this window set the password to the same password you set back at step 4 [[File:Login Props.png|thumb|none]]
##Choose Status from the left panel in this same window and set login to enabled and hit ok. [[File:Login Status.png|thumb|none]]
##Right click the connection in the object explorer again and click Restart. [[File:SQL Restart.png|thumb|none]]
#Next we need to apply the schema for the databases which require this to be done manually (account, auction, auth, and chat)
##Click File -> Open -> File, navigate to the dbschemas that you downloaded at the start, and select cohauc.sql [[File:SSMS File Open.png|thumb|none]] [[File:SSMS Open DBSchema.png|thumb|none]]
##You will see a '''create database''' statement near the top of the file, with two lines that include a '''filename''' parameter. [[File:SSMS DBSchema SQL SRV STR.png|thumb|none]]
##Delete these lines, so that the statement is just: <syntaxhighlight lang="SQL">CREATE DATABASE [cohauc]</syntaxhighlight>
##Click the Execute button [[File:SSMS Execute.png|thumb|none]]
##Repeat these steps for cohacc.sql, cohauth.sql and cohchat.sql. '''Do not use cohdb.sql'''
 
==Initial database entries==
 
Each dbserver instance is a "shard". This needs to be manually added to authserver. In SQL Server Management Studio, expand "Databases", then right click on cohauth and select "New Query" from the menu. Several pieces of data are needed for this.
 
*The IP address (ip) which clients will use to connect to your server. In this example, we will use 127.0.0.1
*The source IP (inner_ip) from which dbserver will connect to authserver. In this example, we will use 127.0.0.1
*The shard name (name) that you will use for dbserver. This will be Paragon by default.  You can change it later once you have it working with the default name.
*The auth shard number that you are using in turnstile_server.cfg. By default this is 1.
 
In the new query window, enter:
 
<syntaxhighlight lang="sql">
INSERT INTO cohauth.dbo.server (id, name, ip, inner_ip, ageLimit, pk_flag, server_group_id) VALUES (1, 'Paragon', '127.0.0.1', '127.0.0.1', 0, 0, 1);
INSERT INTO cohauth.dbo.worldstatus (idx, status) VALUES (1, 1);
</syntaxhighlight>
 
Then press 'Execute'.
 
You will also want to create an account so that you can test connecting to the database. For now, use the instructions in [[I25_FAQ#How_do_I_create_an_account.3F]]
 
==Server database connection configuration==
Note: In order for the correct server name to appear when connecting to the server, browse to "C:\Ouroboros\etc" and edit the "config.txt" file. Find  "ProtocolVersion" and replace that line with "ProtocolVersion = 190516"


== Server database connection configuration ==
Navigate to C:\Ouroboros\data\server\db. In each of the following files, look for an SqlLogin line, and change the Pwd= value to your password. Using our example YOURL33TPASS!:
Navigate to C:\Ouroboros\data\server\db. In each of the following files, look for an SqlLogin line, and change the Pwd= value to your password. Using our example YOURL33TPASS!:
  SqlLogin "DRIVER={SQL Server Native Client 11.0};Server=localhost\SQLEXPRESS;Uid=sa;Pwd=YOURL33TPASS!;"
  SqlLogin "DRIVER={SQL Server Native Client 11.0};Server=localhost\SQLEXPRESS;Uid=sa;Pwd=YOURL33TPASS!;"


* account_server.cfg
*account_server.cfg
* auction_server.cfg
*auction_server.cfg
* chat_server.cfg
*chat_server.cfg
* servers.cfg
*servers.cfg


In servers.cfg, also fix SqlInit to be:
In servers.cfg, also fix SqlInit to be:
Line 79: Line 136:
For authserver, we have to configure the connection via ODBC data sources.
For authserver, we have to configure the connection via ODBC data sources.


# Launch "ODBC Data Sources (32-bit)" from the start menu, or run directly from C:\Windows\SysWOW64\odbcad32.exe. (Do not use the 64-bit version)
#Launch "ODBC Data Sources (32-bit)" from the start menu, or run directly from C:\Windows\SysWOW64\odbcad32.exe. (Do not use the 64-bit version)
# Click File DSN then click add to the right. [[File:ODBC File DSN.png|thumb|none]]
#Click File DSN then click add to the right. [[File:ODBC File DSN.png|thumb|none]]
# Choose ODBC Driver 17 for SQL Server. [[File:ODBC Add Auth 1.png|thumb|none]]
#Choose ODBC Driver 17 for SQL Server. [[File:ODBC Add Auth 1.png|thumb|none]]
# Click Next.
#Click Next.
# Enter AuthDB into the box [[File:ODBC Add Auth 2.png|thumb|none]]
#Enter AuthDB into the box [[File:ODBC Add Auth 2.png|thumb|none]]
# Click Next, then Finish.
#Click Next, then Finish.
# One of the boxes on the next page will say "Which SQL Server do you want to connect to?". Type localhost\SQLEXPRESS [[File:ODBC Add Auth 3.png|thumb|none]]
#One of the boxes on the next page will say "Which SQL Server do you want to connect to?". Type localhost\SQLEXPRESS [[File:ODBC Add Auth 3.png|thumb|none]]
# Click Next
#Click Next
# Choose "With SQL Server authentication using a login ID and password entered by the user". Enter "sa" for the username, and the password that you chose: [[File:ODBC Add Auth 4.png|thumb|none]]
#Choose "With SQL Server authentication using a login ID and password entered by the user". Enter "sa" for the username, and the password that you chose: [[File:ODBC Add Auth 4.png|thumb|none]]
# Click Next
#Click Next
# Enable "Change the default database to" and select "cohauth". [[File:ODBC Add Auth 5.png|thumb|none]]
#Enable "Change the default database to" and select "cohauth". [[File:ODBC Add Auth 5.png|thumb|none]]
# Click Next
#Click Next
# Default settings are fine on the last page [[File:ODBC Add Auth 6.png|thumb|none]]
#Default settings are fine on the last page [[File:ODBC Add Auth 6.png|thumb|none]]
# Click Finish
#Click Finish
# A box will appear with the settings you have selected. Click "Test Data Source" [[File:ODBC Add Auth 7.png|thumb|none]]
#A box will appear with the settings you have selected. Click "Test Data Source" [[File:ODBC Add Auth 7.png|thumb|none]]
# You should see "TESTS COMPLETED SUCCESSFULLY!" in the output. If not, go back and check your settings. [[File:ODBC Add Auth 8.png|thumb|none]]
#You should see "TESTS COMPLETED SUCCESSFULLY!" in the output. If not, go back and check your settings. [[File:ODBC Add Auth 8.png|thumb|none]]
# Click OK, then OK again.
#Click OK, then OK again.


== Launch Server ==
Then we have to enter the username and password again into authserver itself. Start authserver.exe, and the first time that you run it, this window will appear. Enter "sa" and the password that you chose: [[File:Authserver-login.PNG|thumb|none]]


The following servers need to be manually started, in this order:
This username and password is saved in the registry key HKEY_CURRENT_USER\Software\NCSoft\GLOBALAUTH


# dbserver.exe
==Configure firewall==
# authserver.exe
If you are running Windows Firewall, you need to configure it to allow traffic through to your CoH server.
# launcher.exe
 
#Open the start menu, type firewall, and click on Windows Defender Firewall. (or get at it through Control Panel>System and Security>Windows Defender Firewall)
#Click on Advanced settings
#Click on Inbound Rules
#Click on New Rule...
#For Rule Type, select Port, and Next
#Select TCP, Specific local ports, Enter 2106, and then Next
#Allow the connection, Next
#Leave all the checkboxes selected, Next
#Name the rule CoH TCP, Finish
#Repeat the above steps to make a second new rule, but make it UDP instead of TCP, and for ports 7000-7200.  Name it CoH UDP.
 
==Launch server==
 
The following server applications need to be manually started, in this order:
 
#authserver.exe
#dbserver.exe
#launcher.exe


The rest of the servers are started by loadBalanceShardSpecific.cfg.
The rest of the servers are started by loadBalanceShardSpecific.cfg.
==Connecting a client==
Launch the client by opening a command window, and typing:
cd C:\Ouroboros
Ouroboros -auth 127.0.0.1 -console
Login with the account you created, click on the Paragon shard, make a character and enter into the game.  If all of that works correctly, then you can stop here if all you want is to play City of Heroes on your own machine by yourself.  Otherwise, move on to [[Volume_2_Modifying_Server_For_External_Access|Volume 2 Modifying Server For External Access]].
==Troubleshooting==
*ERROR: {{ms|Failed to open attribute file vars.attribute for writing.}}  You may get this error when running <code>mapserver -productionmode -templates</code>.  If you are installing v2i1, this means you didn't create the C:\CoH_Data\attributes folder before running the command.  If you are installing a later version than v2i1, it is likely trying to access C:\Ouroboros\data\server\db\templates instead.  It is supposed to create that folder automatically if it doesn't exist.  If you are getting this error message anyways, try manually creating the C:\Ouroboros\data\server\db\templates folder and then rerun <code>mapserver -productionmode -templates</code>.
*ERROR: {{ms|'gzip' is not recognized as an internal or external command, operable program or batch file.}}  If you get this message, it is usually accompanying a different error message.  This happens because the server is trying to compress the dump files that it creates when some errors are found.  You can safely ignore any messages about a missing gzip.exe, but if you would like to make these errors not happen any more you can place a gzip.exe and a zip.exe in any folder which is in your Path windows system environment variable.  Look for a standard windows gzip.exe download, and you can also download info-zip and use the zip.exe which comes with it.
*ERROR: {{ms|Loading templates...}}  If you get errors when you launch dbserver.exe when it tries to load templates, something went wrong with the steps involving running <code>mapserver.exe -productionmode -templates</code> in [[#Setup server files|Setup server files]], and it can't find the template files in C:\Ouroboros\data\server\db\templates.
*ERROR: {{ms|Version difference between client/server.}}  This is a mismatch between the client version and the Version parameter in the '''C:\Ouroboros\version.ini''' file
*ERROR: {{ms|Can't connect to DBserver.}} Double-check your firewall settings.  Try turning off Windows Firewall completely to see if that lets you connect.  If so, then turn Windows Firewall back on and investigate your Inbound firewall rules for CoH.

Latest revision as of 06:57, 16 January 2021

This guide will help you get started in running your own City of Heroes server on your local host (127.0.0.1). It assumes that you will run the City of Heroes client on the same machine as the server. Once you have that working, you can move on to the following guide which explains how to modify your server to allow external access from game clients on other machines.

Recommended hardware and settings

  1. The main requirement for City of Heroes is having a decent amount of RAM. The minimum amount for a small personal server is about 8 GB of RAM, with 32 GB of RAM being the recommended amount.
    • If you are running with less than the recommended 32 GB of RAM, it is also recommended that you increase your Windows paging file to simulate having more RAM (Control Panel->System and Security->System->Advanced System Settings->Advanced->Performance Settings->Advanced->Virtual Memory->Change). Setting your paging file to 32768 MB works well for a server with 8 GB of RAM.
    • To support a larger number of players connecting, you will need to add more RAM to your server, though it currently isn't clear at what numbers of players these recommended values become insufficient.
    • For the purposes of this guide, I am using 64.0 GB (G. Skill Trident Z Royal Silver 3200Mhz PC4-25600).
  2. The server is CPU-intensive, having a decent CPU is important.
    • This setup has been tested with multiple configurations with the oldest recommended being an Intel Core i7 6th Generation Processor.
    • For the purposes of this guide, I am using the Intel Core i9-9900K Processor.
  3. Running the server on a solid state drive instead of a spinning disc hard drive is recommended.
  4. If you are installing the server on a computer that you own, your router will need to support NAT loopback if you want game clients to be able to connect to it from both inside and outside of your LAN.
    • For the purposes of this guide, I am using an ASUS ROG GT-AX11000 gaming router.

Required software

Download all of the following files:

  1. SQL Server 2017 Express Edition
  2. SQL Server Management (SSMS) 18.3.1
  3. The latest stable release of the CoX/Source files from https://git.ourodev.com/CoX/Source/-/jobs/202/artifacts/download?file_type=archive. These are the compiled files from the OuroDev build machine. Extract the contents of the zip file into C:\Ouroboros. (or if you want to compile the source files yourself, follow the Volume 2 Build instructions, then copy the contents of the Source\bin directory to C:\Ouroboros)
  4. Database schema definitions. Get them from https://git.ourodev.com/CoX/Source/-/tree/v2-i2.1.0/Assets/DBSchemas
  5. Sample server config files. These come with the v2 source - https://git.ourodev.com/CoX/Source/-/tree/v2-i2.1.0/bin/data
  6. the Issue 24 client and data files - this is not the SCORE client/data.
  7. CoHDev_Source_Files_Current(Updated).zip.
  8. ServerData.7z.
  9. Volume 2 Piggs: https://git.ourodev.com/CoX/i2401-bin-server/-/tree/master/piggs

Optional but recommended tools

Download all of the following:

  1. (Optional) Install 7zip (https://www.7-zip.org/download.html)
    • Useful if you do not already have a tool to handle zip files
  2. (Optional) Install Notepad++ (https://notepad-plus-plus.org/downloads/v7.7.1/)
    • Useful for editing config files.

Install SQL Server 2017 Express

You can install SQL Server pretty much on the default settings.
Select Basic under installation type:
Agree to the EULA if you want to use SQL Server.
Tell the server where to install files. I changed this for ease on my system.
It should begin installing and eventually you should see "Install has completed successfully". Click close.

Install SQL Server Management(SSMS)

You can install SQL Server Management on default settings.
Select the location you'd like to install SSMS to. The default is fine.
It will take awhile to install and you'll see a little progress bar letting you know whats going on
Eventually it will ask you to reboot the system. Might as well as do that now.

Setup server files

  1. At this point, you should have C:\Ouroboros containing exes and dlls
  2. Create a directory in C:\Ouroboros called data.
  3. Open ServerData.7z and extract all files into C:\Ouroboros\data (the newly created directory).
  4. Open CoHDev_Source_Files_Current(Updated).zip.
    1. Extract "i24 Server and Client Piggs (extracted with CoHTools)" into C:\Ouroboros\data.
    2. Copy maps.db from "map.db (modified, working on current VS2010 build)" and place it in C:\Ouroboros\data\server\db, overwriting the old maps.db
  5. Copy the piggs folder from your i24 client directory and place them in C:\Ouroboros\. You should end up with C:\Ouroboros\piggs\ populated.
  6. If installing v2i1, create a directory in your C: drive called "CoH_Data" and another directory inside that, called "attributes" (C:\CoH_Data\attributes). In later versions, this isn't necessary.
  7. Run the following in a command prompt. If it gives you an error message, check the Troubleshooting section. It is essential to run this after all the above steps, because it will overwrite some of the files.
    cd c:\Ouroboros
    .\mapserver.exe -productionmode -templates
  8. If installing v2i1, copy all files from C:\CoH_Data\attributes and place them into C:\Ouroboros\data\server\db\templates. If installing a later version, the files should be placed there automatically.
  9. If you didn't get them from a downloaded release, copy all sample config files from Source/Assets/ConfigFiles into c:\Ouroboros (for example: Source/Assets/ConfigFiles/data/server/db will become C:/Ouroboros/data/server/db)

Database setup

 Note: If you have a problem downloading these files, copy and paste the contents into notepad++, and then save the file into the “TMP” folder you created with the same name, for example (cohdb.sql)
  1. Download the latest database schema definitions from the link below.
  2. You will need to choose a password for the database user. In these examples it will be "YOURL33TPASS!".
  3. Launch SQL Server Management Studio from the start menu
  4. Hit "Connect" on the screen that pops up, with default settings:
  5. We need to enable the sa login so that server can login to the database.
    1. If you look to the left panel you will see the object explorer and your connection. Right click it and select properties.
    2. When this window comes up hit Security to the left and enable "sql server and windows authentication". Then click ok.
    3. In the same panel you used before navigate to Security -> Logins then right click and enter properties the sa user.
    4. In this window set the password to the same password you set back at step 4
    5. Choose Status from the left panel in this same window and set login to enabled and hit ok.
    6. Right click the connection in the object explorer again and click Restart.
  6. Next we need to apply the schema for the databases which require this to be done manually (account, auction, auth, and chat)
    1. Click File -> Open -> File, navigate to the dbschemas that you downloaded at the start, and select cohauc.sql
    2. You will see a create database statement near the top of the file, with two lines that include a filename parameter.
    3. Delete these lines, so that the statement is just:
      CREATE DATABASE [cohauc]
      
    4. Click the Execute button
    5. Repeat these steps for cohacc.sql, cohauth.sql and cohchat.sql. Do not use cohdb.sql

Initial database entries

Each dbserver instance is a "shard". This needs to be manually added to authserver. In SQL Server Management Studio, expand "Databases", then right click on cohauth and select "New Query" from the menu. Several pieces of data are needed for this.

  • The IP address (ip) which clients will use to connect to your server. In this example, we will use 127.0.0.1
  • The source IP (inner_ip) from which dbserver will connect to authserver. In this example, we will use 127.0.0.1
  • The shard name (name) that you will use for dbserver. This will be Paragon by default. You can change it later once you have it working with the default name.
  • The auth shard number that you are using in turnstile_server.cfg. By default this is 1.

In the new query window, enter:

INSERT INTO cohauth.dbo.server (id, name, ip, inner_ip, ageLimit, pk_flag, server_group_id) VALUES (1, 'Paragon', '127.0.0.1', '127.0.0.1', 0, 0, 1);
INSERT INTO cohauth.dbo.worldstatus (idx, status) VALUES (1, 1);

Then press 'Execute'.

You will also want to create an account so that you can test connecting to the database. For now, use the instructions in I25_FAQ#How_do_I_create_an_account.3F

Server database connection configuration

Note: In order for the correct server name to appear when connecting to the server, browse to "C:\Ouroboros\etc" and edit the "config.txt" file. Find  "ProtocolVersion" and replace that line with "ProtocolVersion = 190516"

Navigate to C:\Ouroboros\data\server\db. In each of the following files, look for an SqlLogin line, and change the Pwd= value to your password. Using our example YOURL33TPASS!:

SqlLogin "DRIVER={SQL Server Native Client 11.0};Server=localhost\SQLEXPRESS;Uid=sa;Pwd=YOURL33TPASS!;"
  • account_server.cfg
  • auction_server.cfg
  • chat_server.cfg
  • servers.cfg

In servers.cfg, also fix SqlInit to be:

SqlInit "create database cohdb;"

For authserver, we have to configure the connection via ODBC data sources.

  1. Launch "ODBC Data Sources (32-bit)" from the start menu, or run directly from C:\Windows\SysWOW64\odbcad32.exe. (Do not use the 64-bit version)
  2. Click File DSN then click add to the right.
  3. Choose ODBC Driver 17 for SQL Server.
  4. Click Next.
  5. Enter AuthDB into the box
  6. Click Next, then Finish.
  7. One of the boxes on the next page will say "Which SQL Server do you want to connect to?". Type localhost\SQLEXPRESS
  8. Click Next
  9. Choose "With SQL Server authentication using a login ID and password entered by the user". Enter "sa" for the username, and the password that you chose:
  10. Click Next
  11. Enable "Change the default database to" and select "cohauth".
  12. Click Next
  13. Default settings are fine on the last page
  14. Click Finish
  15. A box will appear with the settings you have selected. Click "Test Data Source"
  16. You should see "TESTS COMPLETED SUCCESSFULLY!" in the output. If not, go back and check your settings.
  17. Click OK, then OK again.

Then we have to enter the username and password again into authserver itself. Start authserver.exe, and the first time that you run it, this window will appear. Enter "sa" and the password that you chose:

This username and password is saved in the registry key HKEY_CURRENT_USER\Software\NCSoft\GLOBALAUTH

Configure firewall

If you are running Windows Firewall, you need to configure it to allow traffic through to your CoH server.

  1. Open the start menu, type firewall, and click on Windows Defender Firewall. (or get at it through Control Panel>System and Security>Windows Defender Firewall)
  2. Click on Advanced settings
  3. Click on Inbound Rules
  4. Click on New Rule...
  5. For Rule Type, select Port, and Next
  6. Select TCP, Specific local ports, Enter 2106, and then Next
  7. Allow the connection, Next
  8. Leave all the checkboxes selected, Next
  9. Name the rule CoH TCP, Finish
  10. Repeat the above steps to make a second new rule, but make it UDP instead of TCP, and for ports 7000-7200. Name it CoH UDP.

Launch server

The following server applications need to be manually started, in this order:

  1. authserver.exe
  2. dbserver.exe
  3. launcher.exe

The rest of the servers are started by loadBalanceShardSpecific.cfg.

Connecting a client

Launch the client by opening a command window, and typing:

cd C:\Ouroboros
Ouroboros -auth 127.0.0.1 -console

Login with the account you created, click on the Paragon shard, make a character and enter into the game. If all of that works correctly, then you can stop here if all you want is to play City of Heroes on your own machine by yourself. Otherwise, move on to Volume 2 Modifying Server For External Access.

Troubleshooting

  • ERROR: Failed to open attribute file vars.attribute for writing. You may get this error when running mapserver -productionmode -templates. If you are installing v2i1, this means you didn't create the C:\CoH_Data\attributes folder before running the command. If you are installing a later version than v2i1, it is likely trying to access C:\Ouroboros\data\server\db\templates instead. It is supposed to create that folder automatically if it doesn't exist. If you are getting this error message anyways, try manually creating the C:\Ouroboros\data\server\db\templates folder and then rerun mapserver -productionmode -templates.
  • ERROR: 'gzip' is not recognized as an internal or external command, operable program or batch file. If you get this message, it is usually accompanying a different error message. This happens because the server is trying to compress the dump files that it creates when some errors are found. You can safely ignore any messages about a missing gzip.exe, but if you would like to make these errors not happen any more you can place a gzip.exe and a zip.exe in any folder which is in your Path windows system environment variable. Look for a standard windows gzip.exe download, and you can also download info-zip and use the zip.exe which comes with it.
  • ERROR: Loading templates... If you get errors when you launch dbserver.exe when it tries to load templates, something went wrong with the steps involving running mapserver.exe -productionmode -templates in Setup server files, and it can't find the template files in C:\Ouroboros\data\server\db\templates.
  • ERROR: Version difference between client/server. This is a mismatch between the client version and the Version parameter in the C:\Ouroboros\version.ini file
  • ERROR: Can't connect to DBserver. Double-check your firewall settings. Try turning off Windows Firewall completely to see if that lets you connect. If so, then turn Windows Firewall back on and investigate your Inbound firewall rules for CoH.