Ultima Online game server developed in C++
Join SphereServer Discord channel!
SphereServer:
ScriptPack: The official script pack is fully compatible with X new syntax, has all the new X features and preserves legacy/classic systems, which can be activated back in place of the new ones. It is currently being revamped to add original OSI features. Beware, it's still not 100% complete!
This branch started in 2016 from a slow and radical rework of SphereServer 0.56d, while trying to preserve script compatibility with the starting branch. Though, something has changed script-wise, so we suggest to take a look here. Most notable changes (right now) are:
libmariadb.dll
(MariaDB Client v10.package), found in lib/bin/cpu_architecture*/mariadb/libmariadb.dllSee https://mariadb.com/docs/skysql/connect/clients/mariadb-client/
Ubuntu: Enable "universe" repository: sudo add-apt-repository universe
Install MariaDB client: sudo apt-get install mariadb-client
or sudo apt-get install libmariadb3
(depends on the OS version)
Then install MariaDB client via yum (CentOS or RH) or dnf (Fedora): mariadb-connector-c
brew install mariadb-connector-c
The compilation of the code is possible only using recent compilers, since C++20 features are used: newer is better. Oldest compiler versions supporting C++20: Visual Studio 2019 version 16.11, GCC 8, MinGW distributions using GCC 8, Clang version 10.
You need to build Makefiles or Ninja files (and project files if you wish) with CMake for both Linux (GCC) and Windows (MSVC and MinGW).
Both 32 and 64 bits compilation are supported.
No pre-built project files included.
Does CMake give you an error? Ensure that you have Git installed, and if you are on Windows ensure also that the Git executable was added to the PATH environmental variable
(you'll need to add it manually if you are using Git Desktop,
here's a quick guide).
When generating project files, if you don't specify a toolchain, the CMake script will pick the 32 bits one as default.
How to set a toolchain:
-DCMAKE_TOOLCHAIN_FILE="..."
When using Unix Makefiles, you can specify a build type by setting (also this via GUI or CLI) CMAKE_BUILD_TYPE="build"
, where build is Nightly, Debug or Release. If the build type
was not set, by default the makefiles for all of the three build types are generated.You can also add other compiler flags, like optimization flags, with the custom variables C_FLAGS_EXTRA and CXX_FLAGS_EXTRA.
Example of CMake CLI additional parameters:
-DC_FLAGS_EXTRA="-mtune=native" -DCXX_FLAGS_EXTRA="-mtune=native"
(Use the -mtune=native flag only if you are compiling on the same machine on which you will execute Sphere!)
Example to build makefiles on Linux for a 64 bits Nightly version, inside the "build" directory (run it inside the project's root folder):
mkdir build
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/Linux-GNU-x86_64.cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Nightly" -B ./build -S ./
Building will require more packages than the ones needed to run Sphere.
Install these additional packages:
++ sudo apt-get install git cmake
++ MariaDB client: sudo apt-get install libmariadb-dev
and libmariadb3
or mariadb-client
(depends on the OS version)
If you are on a 64 bits architecture but you want to compile (or execute) a 32 bits binary, you will need to
install MariaDB packages adding the postfix :i386
to each package name.
Then install these additional packages via yum (CentOS or RH) or dnf (Fedora): git gcc-c++ glibc-devel mariadb-connector-c mariadb-connector-c-devel
If you are on a 64 bits architecture but you want to compile (or execute) a 32 bits binary, you will need to install the appropriate gcc package
and to install the MySQL packages adding the postfix .i686
to each package name.
Just run the make
command inside the build
folder. You can pass the -jX argument (make -jX
, where X is a number) to speed up the compilation and split the work between X threads.
You can enable Address Sanitizer (ASan) and Undefined Behaviour Sanitizer (UBSan) with the ENABLE_SANITIZERS checkbox via the GUI, or via the CLI flag -DENABLE_SANITIZERS=true
.
This is easier with GCC and Clang on Linux.
Since ASan redirects the error output to stderr, you can retrieve its output by launching sphere from cmd (Command Prompt) or shell with the following command:
SphereSvrX64_nightly > Sphere_ASan_log.txt 2>&1
These are meant to be applied to new code and, if there's some old code not following them, it would be nice to update it.
Variables meant to hold numerical values:
Variables meant to hold characters (also strings):
Indent with spaces of size 4.
Use the Allman indentation style:
while (x == y)
{
something();
somethingelse();
}
Even if a single statement follows the if/else/while... clauses, use the brackets:
if (fTrue)
{
g_Log.EventWarn("True!\n");
}
Copyright 2023 SphereServer development team.
Licensed under the Apache License, Version 2.0 (the "License").
You may not use any file of this project except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0