-
Notifications
You must be signed in to change notification settings - Fork 183
Project Setup (Linux)
Important
Only the server programs can be built and run on Linux. The client and tools currently require Windows to build. Cross-platform support for the client is underway.
A client executable, compiled on Windows, can be run using Proton if you're solely focused on server development.
This is the guide for the Linux-based project setup. If you're looking for Windows, see Project Setup (Windows).
You'll need the following to work with the project:
- CLion
- Dependency packages listed below
You'll need the following dependencies installed on your system:
| package | description |
|---|---|
| unixodbc | ODBC tools (like odbcinst) |
| unixodbc-dev | ODBC build headers and libraries |
| msodbcsql | Microsoft MSSQL ODBC driver v18 |
| docker | Docker is an container management platform |
| git | Git is a source code management tool |
Below are the commands for a few popular package managers.
apt (Debian, Ubuntu, others)
sudo apt install unixodbc unixodbc-dev git
sudo ACCEPT_EULA=Y apt install msodbcsql18
pacman (Arch)
sudo pacman -S unixodbc msodbcsql docker git
yay (Arch AUR)
sudo yay -S unixodbc msodbcsql docker git
homebrew (Mac)
brew install unixodbc docker git
brew tap microsoft/mssql-release
brew install msodbcsql18
Fork the Knight Online repository then clone your fork to your machine. If you're unfamiliar with Git, see our Using Git page for help.
Our current IDE recommendation for Linux-based platforms is CLion. This IDE is free for non-commercial use, and this is a non-commercial project. Installation is left to the user to figure out as it varies by distribution.
Once installed, you should see the following welcome screen. Click the "Open" button and select the folder of your git repository (KnightOnline).

CLion should automatically detect the CMake build files used to build the Server projects. You should be able to just accept default configuration for the Debug profile:

It will take a moment for the project indexes and CMake caches to build. You'll know when this is complete when the progress bar in the lower-right goes away:

The CMake build configurations should now be loaded and available in the Run Configurations section (top-right corner of the IDE):

Build and run the servers in the typical order: AIServer > Ebenezer > Aujard > VersionManager
Compiled server files (and configuration) will be written to cmake-build-debug/bin/Debug. Default configuration files will be generated on first run. These do not need to be updated unless you're using an altered ODBC DSN.
If your SQL Server, ODBC, and server configuration files are setup correctly then you should see the program launch after a successful build:

It is recommended to use our docker image and scripts for development on Linux. See the Docker README.MD for guidance.
SQL Server does have support for some Linux distributions. If you want to attempt a manual setup, see SQL Server Manual Setup.
Note that this assumes you've either:
- Successfully started the Docker database container, OR
- Manually restored the database as "KN_online" (if you restored it as something else, be sure to use its new name appropriately).
To find the location of your odbc configuration files, run the following in a terminal:
odbcinst -j
We're interested in location of the driver and system data source configuration files:
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
Edit these files to configure your ODBC connection:
- Edit
odbcinst.iniand ensure that the following driver registration exists (your driver location may vary):
[ODBC Driver 18 for SQL Server]
Description=Microsoft ODBC Driver 18 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-18.5.so.1.1
UsageCount=1
- Edit
odbc.iniand add the following entry (if you do not already have it). Update the Server and Database information to match your configuration.
[KN_online]
Description = Knight Online SQL Connection
# Driver must match the driver name (in brackets) from odbcinst.ini
Driver = ODBC Driver 18 for SQL Server
Server = localhost,1433
Database = KN_online
Port = 1433
UID = knight
PWD = knight
Encrypt = no
TrustServerCertificate = yes
ConnectionPooling = yes
Using unixodbc's isql tool, we can test our odbc connection to our database. The general syntax for the command is:
isql -v (DSN Name) (User) (Password)
For an out-of-the-box solution, this will typically be:
isql -v KN_online knight knight
This should open an interactive SQL prompt if your connection is successful. You can run a test query here, if desired:
SELECT * FROM TB_USER
Enter quit to close the interactive SQL console.
To connect CLion to your development database, see CLion SQL Client Setup.
The server applications will generate their default configuration the first time they are run. If new configuration is added, the server will add the default value to the file on the next run.
If you feel compelled to change the default configuration, you can edit the .ini file for the application.
Under cmake-build-debug/bin/Debug/:
| Application | Configuration File |
|---|---|
| AIServer | server.ini |
| Ebenezer | gameserver.ini |
| Aujard | Aujard.ini |
| VersionManager | Version.ini |
| ItemManager | ItemManager.ini |