Sphereserver / Source-X

Ultima Online server emulator
Apache License 2.0
53 stars 40 forks source link
c-plus-plus emulator mmo mmorpg mmorpg-server multiplatform rpg sphereserver spheresvr ultima ultima-online

SphereServer X

Ultima Online game server developed in C++
GitHub license GitHub repo size GitHub stars
GitHub issues GitHub last commit
Build Build status Coverity Scan Build Status

Join SphereServer Discord channel! Discord Shield

Download automated SphereServer builds and ScriptPack releases

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!

Resources

Coming from a different SphereServer version?

Why a fork?

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:

Running

Required libraries (Windows)

Required libraries (Linux)

From MariaDB website

See https://mariadb.com/docs/skysql/connect/clients/mariadb-client/

Ubuntu and Debian repositories

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)

CentOS - Red Hat Enterprise Linux - Fedora repositories

Then install MariaDB client via yum (CentOS or RH) or dnf (Fedora): mariadb-connector-c

Required libraries (MacOS)

Building

Generating the project files

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).

Toolchains and custom CMake variables

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:

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 ./

Compiling

Installing the required packages on Linux

Building will require more packages than the ones needed to run Sphere.

Ubuntu and Debian

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.

CentOS - Red Hat Enterprise Linux - Fedora

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.

Compiling on Linux

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.

Address Sanitizer and Undefined Behaviour Sanitizer

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

Coding Notes (add as you wish to standardize the coding for new contributors)

Naming Conventions

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):

Coding Style Conventions

Licensing

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