Post by Senketsu on Feb 25, 2016 0:19:35 GMT -5
First off, credits to twostars on this guide.
Forewarning: the guide attempts to achieve some semblance of ambiguity to allow you to reasonably fill in the blanks for slightly different setups (e.g. a newer version of SQL server, or Windows). If at any point it's too vague, let me know... but please try to use your head first. (EDIT: I failed, it's got too much information.
)
What you'll need:
Microsoft SQL Server (this guide uses SQL Server 2008 R2 Express, I recommend using at least this - you should be able to restore any database backup [unless backed up in something newer])
P.S., I've had issues with SQL Server 2012 Express, I highly recommend 2008 R2.
You can find it on Microsoft's site (the Express edition is free). Once you've found it, the download you want will most likely be named "SQLEXPRWT_[arch]" -- that is, SQL Express With Tools, tools being the management studio we'll be using to connect to the server, restore our database and generally do anything database-related in, and 'arch' being your operating system's architecture - you should see x86 (32-bit), x64 (64-bit).
You should know which architecture your PC is using (x86/32-bit or x64/64-bit [express doesn't support anything else]). If you don't know which it's using, the quickest/easiest way to find out is to check your system drive (C:\ by default) for a folder named "Program Files (x86)"; if it exists, you're on a 64-bit operating system... so you need to download & install the x64 version. If it doesn't, you're using 32-bit so you need the x86 version of the setup.
Remember this for later.
The KO server files (preferably the original, untouched 1.298 server files -- what this guide's using.)
NOTE: 1.310/1.351/1.397's buggy. Anything newer than that's custom updated extremely poorly and most likely extremely incomplete/insecure, so you really are best off with 1.298).
The files we're using can be found here
NOTE: the only two things I've done to them [just now, for this guide] is forced it to use the one datasource & username, and removed the GM command +down -- you can still turn the server off from the server with "/down" or "/serverdown n", however this GM exposed command's always abused. You can patch it back in with the Ebenezer/Client Editor if need be (I also prepatched them, but you should patch them anyway to ensure they're up to date).
A (1.298) database (this guide's using a slightly fixed up copy of the "original MYKO database" [FYI: it's not the original MYKO database. e-Games did not use this]).
Forewarning: If you use another database, you may have issues loading the server due to missing map files. For the most part, similarly versioned/named SMD files can be copied and/or rename to fill in for them (we don't have a great deal of actual map files, 99% of them are like this), however there may or may not be other issues (such as broken / wrong warp gates)... in which case, searching for a more suitable map pack with the SMDs you're missing is preferable (the thread you got the database from should help).
You can find it here
(backed up in SQL Server 2008 R2, so you WILL NOT be able to use it in anything older).
Edit: Okay, this is nothing like the aforementioned database but I've stripped most if not all of the added junk out regardless.
A (1.29[8/9]) client
- Original USKO 1.299 client (Link currently broken, will re-upload when I can)
- If using the above client, you'll ALSO need a patched KnightOnline.exe (with HackShield removed, so that we can use it for PSKO): Mediafire (P.S., You might need to either edit the names of some .tbl files/edit it with Ebenezer/Client Editor, as the file names have been tampered with a bit)
What now:
Install SQL server
A lot of people seem to have trouble installing this. It's really fairly easy, though their wizard changes depending on the version you're installing.
So, I'll try to be as generic as possible here to try to avoid any confusion.
Run your setup file (e.g. SQLEXPRWT_x86_ENU.exe).
Once it's loaded, it may throw you a launcher-type setup (as in the case of 2008/R2), so find the option for a New installation and load that.
Setup defaults should be fine for you to use UNTIL (and keep an eye out) you get to the "Instance configuration" stage. Here you'll want to watch out for.
There's no default value for the instance name here. For simplicity's sake (to ensure less people have problems), make sure we're using a Named instance, and give it the name "KO".
(Without the quotation marks)
Now continue to proceed through the setup UNTIL (and again, KEEP AN EYE OUT. THIS IS ESPECIALLY IMPORTANT.) you see an "Authentication Mode" setting.
This you should set to "Mixed Mode (SQL Server authentication and Windows Authentication)" (or similarly, whatever it's named on that particular setup).
When you're prompted to enter in "service accounts", if you find it's erroring (e.g. on Windows XP or Server 2003), be sure to set the service account for any applicable services (e.g. "Database engine") to "NT AUTHORITY\SYSTEM". It should let you proceed after doing so.
Unless I'm forgetting any common issues (I'll amend my post if you've had any), you should have had no hiccups thus far, and it should (at least, if it's 2008 R2) be currently installing. Yay!
When it's installed, it'll undoubtedly ask you to reboot. Just suck it up and do it.
Restore the database
First, extract the database backup you downloaded to "C:\" (if prompted by UAC, say yes - you do want to allow admin approval to do so).
Run the newly installed "SQL Server Management Studio". NOTE: If you don't have this, it means you either chose not to install it or you downloaded the wrong setup file. You want the setup "With Tools" (SQLEXPRWT). So, download and/or re-install it.
Once it's up, it should already be filled out with the info you need to connect. SQL server should already be running, so hit "Connect".
You'll first want to create a database that you can overwrite with our backup, so right-click on "Databases" and just go "New database".
NOTE: KO was actually designed for multiple databases, but for simplicity's sake (and because everyone does it), you'll be using a hybridised single database which I've tweaked to behave properly (otherwise, it shares functionality that's supposed to behave differently and as a result, doesn't behave properly at all).
Set the database name to "KN_online" and hit "OK". It'll create your database.
Now we need to restore the backup we're using, so that we can use it with KO.
- Expand "Databases",
- right-click on "KN_online",
- go "Tasks" -> "Restore" -> "Database".
Set the restore source to "From device", and hit the "..." button to browse for your backup.
Backup media should remain set to "File", so go "Add".
Browse to the database backup you downloaded (which should be in "C:\"), select it, and hit "OK".
Hit "OK" again.
Tick the "Restore" option (next to the newest set if there's more than 1 listed. If you're using my backup, there should only be 1).
Now switch to the "Options" page and tick "Overwrite the existing database (WITH REPLACE)".
You can finally hit "OK" to start restoring. Depending on the database, this MAY take a while. So be patient.
Once it's done, you can rejoice - because that's all we need to do with our database (within the scope of this guide, anyway! The rest is up to you.).
Add our SQL user
Now we'll need to create a user under SQL server which the servers will be able to use to connect with (note: it's actually recommended to create a different account per server and lock down their individual permissions to their key roles, but again -- that's outside the scope of this guide. Your own personal research here is ESSENTIAL.).
For the purposes of this guide, we'll be creating a stock reasonably insecure account (should anyone gain access to your server or to any services that use the database). Securing it is your responsibility (but there's little point on a development box -- if you're releasing a server though, seriously. DO NOT NEGLECT SECURING IT. Do your research and be the better for it.).
So, in typical PSKO fashion, we'll create a "knight" user with the password "knight".
First, make sure any references to this username is removed from your database, so in the management studio:
- Expand "Databases"
- Expand "KN_online"
- Expand "Security"
- Expand "Users"
- If "knight" exists in the list, right-click it and hit "Delete". Hit "OK" on the dialog that appears.
Now, let's create our "knight" user.
Go back up the list & close each entry: Users > Security > KN_online > Databases
Now, underneath "Databases" you should see "Security" (not what we were in before, this applies to the entire server NOT JUST our "KN_online" database).
Expand "Security" and right-click on "Logins" (if you don't see "Logins", you're not in the right section; close it all off so you see just "Databases", "Security", "Server Objects", etc and then go into "Security").
Click "New Login".
This is where it gets a little tricky because it's touchy, so follow these particular steps TO THE LETTER.
Set the "Login name" to "knight".
Tick "SQL Server authentication".
Set the "Password" to "knight", and confirm it.
Pay attention here.
I'm going to deliberately be unsetting these policy settings backwards because of an annoying bug where a setting gets left set despite being disabled.
So, untick (IN THIS ORDER):
1. "User must change password at login"
2. "Enforce password expiration"
3. "Enforce password policy"
Now, set the "Default database" to "KN_online".
Switch to the "User Mapping" page.
Tick "KN_online", and hit "OK".
Because of another bug, we'll want to double-click our newly created "knight" user to load up the properties again (or right-click > "Properties"), and go to the "User Mapping" page again (if it isn't already).
Select the "KN_online" database in the map list and at the bottom, tick "db_owner" (it doesn't like being set until the user's created).
Hit "OK" and you're finally done with SQL server (for now!).
Extract your server files
Like it says, extract your server files into a folder somewhere. I typically create the folder C:\Server and stick them there.
Simple.
Ensure Aujard's happy
Oh Aujard, we seem to have quite the love/hate relationship. If we want to run our server, we need to keep Aujard happy.
And to do that, we need to ensure we set its compatibility mode to Windows XP SP2. If you do not do this, you will forever be stuck at the nation selection screen. Under no circumstances should you run it as Administrator.
This only applies to operating systems newer than Windows XP obviously. So Vista/Windows 7/Windows 8, and all the fun server operating system equivalents.
So, for those new operating systems:
- go into Aujard's folder,
- right-click Aujard[.exe],
- go "Properties",
- change to the "Compatibility" tab,
- tick "Run this program in compatibility mode for:"
- change it to "Windows XP (Service Pack 2)"
- hit "Apply" & "OK".
Setting up ODBC
Finally, it's time to setup ODBC. If you haven't read the previous section, do so now.
What you need to do now depends on what architecture your operating system is running as (32-bit or 64-bit). We should have already figured this out earlier -- if you don't know which your PC is using, go back up and read it again.
Now, press WinKey+R (for the "Run" dialog) and type in:
If 32-bit: %windir%\system32\odbcad32.exe
If 64-bit: %windir%\syswow64\odbcad32.exe (note: if you have anything running in 64-bit mode like an editor, you'll want to create a datasource in system32's "ODBC configuration manager" (odbcad32.exe) AS WELL. KO's server files strictly use the 32-bit ODBC, however -- which is found in syswow64 on 64-bit systems).
Once that's loaded, go to "System DSN" (if you DO NOT have an administrative account though, you'll need to use "User DSN").
Hit "Add" & scroll down to the bottom of the list, where you should find a bunch of "SQL *" entries. Select the MOST RECENT "SQL Server Native Client" driver (e.g. "SQL Server Native Client 10.0") and hit "Finish".
Name: "KN_online" (this is different to your database name, this is your datasource - which is basically a bunch of settings so that Windows can find your server, use SQL server drivers to connect to it, and point it to the correct database).
Server: ".\KO" (that is, "." for your local server, and "\KO" to point to our KO instance)
Hit "Next >"
Leave the "With Integrated Windows authentication" option ticked (contrary to popular belief, ODBC does not store user details in its profile. This is merely a "recon mission" of sorts, so that we can connect (now) and it can help us to grab the details we'll need for our profile (e.g. the database name) and hit "Next >".
Hit "Next >" again, and tick "Change the default database to:" - set it to "KN_online".
On this screen it's important that you UNTICK "Perform transation for character data" (lest you end up with some nasty item corruption issues).
Once done, finally, hit "Finish" & "Test Data Source...". You should see "TESTS COMPLETED SUCCESSFULLY!" -- if not, you probably did something wrong along the way (otherwise, give us a shout and we'll figure it out). "OK" your way out of there.
This is the only datasource we'll need (with these files. With others you may need to create KN_data -- and sometimes Knight_account), so we can now move onto configuring the server files.
Configuring the server files
For most setups, the default server config is fine (KN_online / knight / knight, internal IP addresses set to 127.0.0.1). Be glad. I saved you the work!
NOTE: If you go poking around the config files, be sure to take heed of what's been written. If it says "DO NOT TOUCH" or "LEAVE IT", really... listen.
Setting up the server list
This part's also extremely easy. Just load up the login server (Login server\login-server.exe).
It should connect, and then ask you to "please insert your server name". So, type it into the console (e.g. "TestKO").
Once you've entered it (remember to actually press "enter" to submit it), it'll then ask you for your server's IP/hostname: use "127.0.0.1".
Following that, it'll ask you if you want to ad another server. Since we're just a local test server for only us to connect to, we'll just say "no".
Example output:
Quote
06:44 D AccountManager: Created the SERVERS table!
06:44 E AccountManager: There were no servers found in the SERVERS table. You need at least one, otherwise players cannot access your game server and get in-game!
06:44 D Prompt: Please insert your server name:
knight@KO$> TestKO
(1.310 server or above would be something like TestKO|TestKO 1)
06:44 D Prompt: Please insert your server's IP or hostname:
knight@KO$> 127.0.0.1
06:44 D Debug: Inserted `TestKO` (127.0.0.1)
06:44 D Prompt: Do you wish to add another server to the server list while you are here? (Yes/No)
knight@KO$> no
And we're done.
Running the server
With everything setup, we just need to start the files.
They need to be started in THIS order:
- AIServer\AI Server.exe
- Ebenezer\Ebenezer.exe (Ebenezer depends on the AI server being started, so wait until it's started first)
- Billing server\billing-server.exe
- Aujard\Aujard.exe (Aujard depends on Ebenezer and the billing server)
(for a live server, you'd also run the dupe scanner / KO scheduler & any other such realtime tools now)
- Login server\login-server.exe (login server depends on nothing, but I prefer them not being able to try to connect to the game server until everything's started, otherwise it can get pretty spammy -- they can't get to the server list if the login server isn't started.)
Setting up your client
Download the client linked at the top of this post.
Download the client EXE (KnightOnline.exe) linked with it.
Install the client.
Replace KnightOnline.exe in its install folder.
Open up "server.ini" (it's in your client's folder).
Change the "IP0" setting to point to "127.0.0.1" (so that it points to the login server).
So:
IP0=127.0.0.1
And you're done (easy, huh?).
Creating an account to login with
- Open up the SQL Server Management Studio (told you were weren't quite finished with it!).
- Expand "Databases".
- Right-click on "KN_online".
- Press "New query"
- In the window that appears, enter in:
INSERT INTO TB_USER (strAccountID, strPasswd) VALUES('account name', 'password')
Be sure to replace "account name" and "password" with the desired account name & password.
- Press F5 to execute (or right-click -> "Execute", or simply press "Execute" at the top of the screen).
Now either wait for the login server to reload the accounts (reload time's set in the config file, it's in minutes and must be at least 1 minute), or just restart the login server (doesn't really matter which).
You can now log into your server and hack away at it to your heart's desire (no guarantee on any of the in-game content with that database though).
Opening your server up to the public (note: I'll update/finish this later)
First, you'll need to forward the following ports (if unsure, consult www.portforward.com for info on forwarding ports) so that others may connect externally:
15001 - TCP - Game server
15100 - TCP - Login server
80 -TCP - Web server [panel], if applicable
Additionally, make sure they're allowed in any of your software firewalls (including Windows Firewall).
Now that it's allowed (or should be!), you need to tell clients where to connect.
There's two things we need to change to ensure the client can connect.
- The IP address/hostname that tells it where the login server is (server.ini)
- The IP address/hostname that tells it where the game server is (server list, SERVERS table in the database).
Basically we just need to ensure that everyone who needs to connect, can connect; there's a few different typical setups, so I'll try to describe them separately.
Dedicated server
- everyone connects externally
- nobody connects locally
This is super easy -- we just use the dedicated server's IP address in our server.ini file (or if we've got a hostname/domain for it, that).
Additionally, we set the one same entry in our SERVERS table (SQL Management Studio -> Databases -> KN_online -> dbo.SERVERS, right-click -> "Edit top 200 rows").
Home dev server
- everybody (typically the one person
) connects locally
- nobody connects externally
This is ALSO super easy -- we just use either our LAN IP address, or 127.0.0.1 in our server.ini file.
Additionally, we set the one same entry in our SERVERS table (SQL Management Studio -> Databases -> KN_online -> dbo.SERVERS, right-click -> "Edit top 200 rows").
Home live server
- owner connects locally (e.g. 127.0.0.1)
- everybody else connects externally (e.g. 11.22.33.44)
This is where it may be a little confusing, which is why I believe the most seamless option is to do this.
Go on freedns.afraid.org/ and register for a free hostname.
Set this in your client's server.ini file for everyone to use, and your SERVERS table (SQL Management Studio -> Databases -> KN_online -> dbo.SERVERS, right-click -> "Edit top 200 rows").
This may work on its own (however it typically shouldn't/won't).
Doing it this way instead of the alternative - that is, using a different server.ini for owner and players [which can be confusing when you release new patches to your users] and adding another server list entry - means that it's all seamless. When you release patches you don't have to go changing things. When you connect, you don't have to connect to a different server -- players can't accidentally connect to the wrong server, etc.
Having trouble connecting to your server?
Post in the help section, and we will see what we can do to help.
Forewarning: the guide attempts to achieve some semblance of ambiguity to allow you to reasonably fill in the blanks for slightly different setups (e.g. a newer version of SQL server, or Windows). If at any point it's too vague, let me know... but please try to use your head first. (EDIT: I failed, it's got too much information.
![:(](http://storage.proboards.com/forum/images/smiley/sad.png)
What you'll need:
Microsoft SQL Server (this guide uses SQL Server 2008 R2 Express, I recommend using at least this - you should be able to restore any database backup [unless backed up in something newer])
P.S., I've had issues with SQL Server 2012 Express, I highly recommend 2008 R2.
You can find it on Microsoft's site (the Express edition is free). Once you've found it, the download you want will most likely be named "SQLEXPRWT_[arch]" -- that is, SQL Express With Tools, tools being the management studio we'll be using to connect to the server, restore our database and generally do anything database-related in, and 'arch' being your operating system's architecture - you should see x86 (32-bit), x64 (64-bit).
You should know which architecture your PC is using (x86/32-bit or x64/64-bit [express doesn't support anything else]). If you don't know which it's using, the quickest/easiest way to find out is to check your system drive (C:\ by default) for a folder named "Program Files (x86)"; if it exists, you're on a 64-bit operating system... so you need to download & install the x64 version. If it doesn't, you're using 32-bit so you need the x86 version of the setup.
Remember this for later.
The KO server files (preferably the original, untouched 1.298 server files -- what this guide's using.)
NOTE: 1.310/1.351/1.397's buggy. Anything newer than that's custom updated extremely poorly and most likely extremely incomplete/insecure, so you really are best off with 1.298).
The files we're using can be found here
NOTE: the only two things I've done to them [just now, for this guide] is forced it to use the one datasource & username, and removed the GM command +down -- you can still turn the server off from the server with "/down" or "/serverdown n", however this GM exposed command's always abused. You can patch it back in with the Ebenezer/Client Editor if need be (I also prepatched them, but you should patch them anyway to ensure they're up to date).
A (1.298) database (this guide's using a slightly fixed up copy of the "original MYKO database" [FYI: it's not the original MYKO database. e-Games did not use this]).
Forewarning: If you use another database, you may have issues loading the server due to missing map files. For the most part, similarly versioned/named SMD files can be copied and/or rename to fill in for them (we don't have a great deal of actual map files, 99% of them are like this), however there may or may not be other issues (such as broken / wrong warp gates)... in which case, searching for a more suitable map pack with the SMDs you're missing is preferable (the thread you got the database from should help).
You can find it here
(backed up in SQL Server 2008 R2, so you WILL NOT be able to use it in anything older).
Edit: Okay, this is nothing like the aforementioned database but I've stripped most if not all of the added junk out regardless.
A (1.29[8/9]) client
- Original USKO 1.299 client (Link currently broken, will re-upload when I can)
- If using the above client, you'll ALSO need a patched KnightOnline.exe (with HackShield removed, so that we can use it for PSKO): Mediafire (P.S., You might need to either edit the names of some .tbl files/edit it with Ebenezer/Client Editor, as the file names have been tampered with a bit)
What now:
Install SQL server
A lot of people seem to have trouble installing this. It's really fairly easy, though their wizard changes depending on the version you're installing.
So, I'll try to be as generic as possible here to try to avoid any confusion.
Run your setup file (e.g. SQLEXPRWT_x86_ENU.exe).
Once it's loaded, it may throw you a launcher-type setup (as in the case of 2008/R2), so find the option for a New installation and load that.
Setup defaults should be fine for you to use UNTIL (and keep an eye out) you get to the "Instance configuration" stage. Here you'll want to watch out for.
There's no default value for the instance name here. For simplicity's sake (to ensure less people have problems), make sure we're using a Named instance, and give it the name "KO".
(Without the quotation marks)
Now continue to proceed through the setup UNTIL (and again, KEEP AN EYE OUT. THIS IS ESPECIALLY IMPORTANT.) you see an "Authentication Mode" setting.
This you should set to "Mixed Mode (SQL Server authentication and Windows Authentication)" (or similarly, whatever it's named on that particular setup).
When you're prompted to enter in "service accounts", if you find it's erroring (e.g. on Windows XP or Server 2003), be sure to set the service account for any applicable services (e.g. "Database engine") to "NT AUTHORITY\SYSTEM". It should let you proceed after doing so.
Unless I'm forgetting any common issues (I'll amend my post if you've had any), you should have had no hiccups thus far, and it should (at least, if it's 2008 R2) be currently installing. Yay!
When it's installed, it'll undoubtedly ask you to reboot. Just suck it up and do it.
Restore the database
First, extract the database backup you downloaded to "C:\" (if prompted by UAC, say yes - you do want to allow admin approval to do so).
Run the newly installed "SQL Server Management Studio". NOTE: If you don't have this, it means you either chose not to install it or you downloaded the wrong setup file. You want the setup "With Tools" (SQLEXPRWT). So, download and/or re-install it.
Once it's up, it should already be filled out with the info you need to connect. SQL server should already be running, so hit "Connect".
You'll first want to create a database that you can overwrite with our backup, so right-click on "Databases" and just go "New database".
NOTE: KO was actually designed for multiple databases, but for simplicity's sake (and because everyone does it), you'll be using a hybridised single database which I've tweaked to behave properly (otherwise, it shares functionality that's supposed to behave differently and as a result, doesn't behave properly at all).
Set the database name to "KN_online" and hit "OK". It'll create your database.
Now we need to restore the backup we're using, so that we can use it with KO.
- Expand "Databases",
- right-click on "KN_online",
- go "Tasks" -> "Restore" -> "Database".
Set the restore source to "From device", and hit the "..." button to browse for your backup.
Backup media should remain set to "File", so go "Add".
Browse to the database backup you downloaded (which should be in "C:\"), select it, and hit "OK".
Hit "OK" again.
Tick the "Restore" option (next to the newest set if there's more than 1 listed. If you're using my backup, there should only be 1).
Now switch to the "Options" page and tick "Overwrite the existing database (WITH REPLACE)".
You can finally hit "OK" to start restoring. Depending on the database, this MAY take a while. So be patient.
Once it's done, you can rejoice - because that's all we need to do with our database (within the scope of this guide, anyway! The rest is up to you.).
Add our SQL user
Now we'll need to create a user under SQL server which the servers will be able to use to connect with (note: it's actually recommended to create a different account per server and lock down their individual permissions to their key roles, but again -- that's outside the scope of this guide. Your own personal research here is ESSENTIAL.).
For the purposes of this guide, we'll be creating a stock reasonably insecure account (should anyone gain access to your server or to any services that use the database). Securing it is your responsibility (but there's little point on a development box -- if you're releasing a server though, seriously. DO NOT NEGLECT SECURING IT. Do your research and be the better for it.).
So, in typical PSKO fashion, we'll create a "knight" user with the password "knight".
First, make sure any references to this username is removed from your database, so in the management studio:
- Expand "Databases"
- Expand "KN_online"
- Expand "Security"
- Expand "Users"
- If "knight" exists in the list, right-click it and hit "Delete". Hit "OK" on the dialog that appears.
Now, let's create our "knight" user.
Go back up the list & close each entry: Users > Security > KN_online > Databases
Now, underneath "Databases" you should see "Security" (not what we were in before, this applies to the entire server NOT JUST our "KN_online" database).
Expand "Security" and right-click on "Logins" (if you don't see "Logins", you're not in the right section; close it all off so you see just "Databases", "Security", "Server Objects", etc and then go into "Security").
Click "New Login".
This is where it gets a little tricky because it's touchy, so follow these particular steps TO THE LETTER.
Set the "Login name" to "knight".
Tick "SQL Server authentication".
Set the "Password" to "knight", and confirm it.
Pay attention here.
I'm going to deliberately be unsetting these policy settings backwards because of an annoying bug where a setting gets left set despite being disabled.
So, untick (IN THIS ORDER):
1. "User must change password at login"
2. "Enforce password expiration"
3. "Enforce password policy"
Now, set the "Default database" to "KN_online".
Switch to the "User Mapping" page.
Tick "KN_online", and hit "OK".
Because of another bug, we'll want to double-click our newly created "knight" user to load up the properties again (or right-click > "Properties"), and go to the "User Mapping" page again (if it isn't already).
Select the "KN_online" database in the map list and at the bottom, tick "db_owner" (it doesn't like being set until the user's created).
Hit "OK" and you're finally done with SQL server (for now!).
Extract your server files
Like it says, extract your server files into a folder somewhere. I typically create the folder C:\Server and stick them there.
Simple.
Ensure Aujard's happy
Oh Aujard, we seem to have quite the love/hate relationship. If we want to run our server, we need to keep Aujard happy.
And to do that, we need to ensure we set its compatibility mode to Windows XP SP2. If you do not do this, you will forever be stuck at the nation selection screen. Under no circumstances should you run it as Administrator.
This only applies to operating systems newer than Windows XP obviously. So Vista/Windows 7/Windows 8, and all the fun server operating system equivalents.
So, for those new operating systems:
- go into Aujard's folder,
- right-click Aujard[.exe],
- go "Properties",
- change to the "Compatibility" tab,
- tick "Run this program in compatibility mode for:"
- change it to "Windows XP (Service Pack 2)"
- hit "Apply" & "OK".
Setting up ODBC
Finally, it's time to setup ODBC. If you haven't read the previous section, do so now.
What you need to do now depends on what architecture your operating system is running as (32-bit or 64-bit). We should have already figured this out earlier -- if you don't know which your PC is using, go back up and read it again.
Now, press WinKey+R (for the "Run" dialog) and type in:
If 32-bit: %windir%\system32\odbcad32.exe
If 64-bit: %windir%\syswow64\odbcad32.exe (note: if you have anything running in 64-bit mode like an editor, you'll want to create a datasource in system32's "ODBC configuration manager" (odbcad32.exe) AS WELL. KO's server files strictly use the 32-bit ODBC, however -- which is found in syswow64 on 64-bit systems).
Once that's loaded, go to "System DSN" (if you DO NOT have an administrative account though, you'll need to use "User DSN").
Hit "Add" & scroll down to the bottom of the list, where you should find a bunch of "SQL *" entries. Select the MOST RECENT "SQL Server Native Client" driver (e.g. "SQL Server Native Client 10.0") and hit "Finish".
Name: "KN_online" (this is different to your database name, this is your datasource - which is basically a bunch of settings so that Windows can find your server, use SQL server drivers to connect to it, and point it to the correct database).
Server: ".\KO" (that is, "." for your local server, and "\KO" to point to our KO instance)
Hit "Next >"
Leave the "With Integrated Windows authentication" option ticked (contrary to popular belief, ODBC does not store user details in its profile. This is merely a "recon mission" of sorts, so that we can connect (now) and it can help us to grab the details we'll need for our profile (e.g. the database name) and hit "Next >".
Hit "Next >" again, and tick "Change the default database to:" - set it to "KN_online".
On this screen it's important that you UNTICK "Perform transation for character data" (lest you end up with some nasty item corruption issues).
Once done, finally, hit "Finish" & "Test Data Source...". You should see "TESTS COMPLETED SUCCESSFULLY!" -- if not, you probably did something wrong along the way (otherwise, give us a shout and we'll figure it out). "OK" your way out of there.
This is the only datasource we'll need (with these files. With others you may need to create KN_data -- and sometimes Knight_account), so we can now move onto configuring the server files.
Configuring the server files
For most setups, the default server config is fine (KN_online / knight / knight, internal IP addresses set to 127.0.0.1). Be glad. I saved you the work!
NOTE: If you go poking around the config files, be sure to take heed of what's been written. If it says "DO NOT TOUCH" or "LEAVE IT", really... listen.
Setting up the server list
This part's also extremely easy. Just load up the login server (Login server\login-server.exe).
It should connect, and then ask you to "please insert your server name". So, type it into the console (e.g. "TestKO").
Once you've entered it (remember to actually press "enter" to submit it), it'll then ask you for your server's IP/hostname: use "127.0.0.1".
Following that, it'll ask you if you want to ad another server. Since we're just a local test server for only us to connect to, we'll just say "no".
Example output:
Quote
06:44 D AccountManager: Created the SERVERS table!
06:44 E AccountManager: There were no servers found in the SERVERS table. You need at least one, otherwise players cannot access your game server and get in-game!
06:44 D Prompt: Please insert your server name:
knight@KO$> TestKO
(1.310 server or above would be something like TestKO|TestKO 1)
06:44 D Prompt: Please insert your server's IP or hostname:
knight@KO$> 127.0.0.1
06:44 D Debug: Inserted `TestKO` (127.0.0.1)
06:44 D Prompt: Do you wish to add another server to the server list while you are here? (Yes/No)
knight@KO$> no
And we're done.
Running the server
With everything setup, we just need to start the files.
They need to be started in THIS order:
- AIServer\AI Server.exe
- Ebenezer\Ebenezer.exe (Ebenezer depends on the AI server being started, so wait until it's started first)
- Billing server\billing-server.exe
- Aujard\Aujard.exe (Aujard depends on Ebenezer and the billing server)
(for a live server, you'd also run the dupe scanner / KO scheduler & any other such realtime tools now)
- Login server\login-server.exe (login server depends on nothing, but I prefer them not being able to try to connect to the game server until everything's started, otherwise it can get pretty spammy -- they can't get to the server list if the login server isn't started.)
Setting up your client
Download the client linked at the top of this post.
Download the client EXE (KnightOnline.exe) linked with it.
Install the client.
Replace KnightOnline.exe in its install folder.
Open up "server.ini" (it's in your client's folder).
Change the "IP0" setting to point to "127.0.0.1" (so that it points to the login server).
So:
IP0=127.0.0.1
And you're done (easy, huh?).
Creating an account to login with
- Open up the SQL Server Management Studio (told you were weren't quite finished with it!).
- Expand "Databases".
- Right-click on "KN_online".
- Press "New query"
- In the window that appears, enter in:
INSERT INTO TB_USER (strAccountID, strPasswd) VALUES('account name', 'password')
Be sure to replace "account name" and "password" with the desired account name & password.
- Press F5 to execute (or right-click -> "Execute", or simply press "Execute" at the top of the screen).
Now either wait for the login server to reload the accounts (reload time's set in the config file, it's in minutes and must be at least 1 minute), or just restart the login server (doesn't really matter which).
You can now log into your server and hack away at it to your heart's desire (no guarantee on any of the in-game content with that database though).
Opening your server up to the public (note: I'll update/finish this later)
First, you'll need to forward the following ports (if unsure, consult www.portforward.com for info on forwarding ports) so that others may connect externally:
15001 - TCP - Game server
15100 - TCP - Login server
80 -TCP - Web server [panel], if applicable
Additionally, make sure they're allowed in any of your software firewalls (including Windows Firewall).
Now that it's allowed (or should be!), you need to tell clients where to connect.
There's two things we need to change to ensure the client can connect.
- The IP address/hostname that tells it where the login server is (server.ini)
- The IP address/hostname that tells it where the game server is (server list, SERVERS table in the database).
Basically we just need to ensure that everyone who needs to connect, can connect; there's a few different typical setups, so I'll try to describe them separately.
Dedicated server
- everyone connects externally
- nobody connects locally
This is super easy -- we just use the dedicated server's IP address in our server.ini file (or if we've got a hostname/domain for it, that).
Additionally, we set the one same entry in our SERVERS table (SQL Management Studio -> Databases -> KN_online -> dbo.SERVERS, right-click -> "Edit top 200 rows").
Home dev server
- everybody (typically the one person
![:P](http://storage.proboards.com/forum/images/smiley/tongue.png)
- nobody connects externally
This is ALSO super easy -- we just use either our LAN IP address, or 127.0.0.1 in our server.ini file.
Additionally, we set the one same entry in our SERVERS table (SQL Management Studio -> Databases -> KN_online -> dbo.SERVERS, right-click -> "Edit top 200 rows").
Home live server
- owner connects locally (e.g. 127.0.0.1)
- everybody else connects externally (e.g. 11.22.33.44)
This is where it may be a little confusing, which is why I believe the most seamless option is to do this.
Go on freedns.afraid.org/ and register for a free hostname.
Set this in your client's server.ini file for everyone to use, and your SERVERS table (SQL Management Studio -> Databases -> KN_online -> dbo.SERVERS, right-click -> "Edit top 200 rows").
This may work on its own (however it typically shouldn't/won't).
Doing it this way instead of the alternative - that is, using a different server.ini for owner and players [which can be confusing when you release new patches to your users] and adding another server list entry - means that it's all seamless. When you release patches you don't have to go changing things. When you connect, you don't have to connect to a different server -- players can't accidentally connect to the wrong server, etc.
Having trouble connecting to your server?
Post in the help section, and we will see what we can do to help.