Guides › Contributing

Building the core

What you build

The LonelyIce server is a fork of AzerothCore, LonelyIceProject/azerothcore-wotlk (branch main). It builds on its own into the usual worldserver, authserver and tools, with SQLite databases and a plugin loader. You need this when you change the core, when you want a dedicated server without the launcher, or to build plugins against the fork outside a LonelyIce build tree. What the fork changes is described in The core fork.

Before you start

  • The prerequisites of AzerothCore itself: a C++20 compiler, CMake, Git, Boost and OpenSSL. On Windows, Visual Studio 2022 and the versions listed in Building LonelyIce work.
  • No MySQL: the fork has no MySQL build dependency. MySQL comes from a plugin (see MySQL instead of SQLite).
  • The fork's changes have been built and run on Windows. As for LonelyIce, Linux and macOS builds are written but not tested yet.
git clone -b main https://github.com/LonelyIceProject/azerothcore-wotlk

Configure and build

A plugin-capable core (shared libraries):

cmake -S azerothcore-wotlk -B build -DWITH_DYNAMIC_LINKING=ON -DAC_PLUGIN_ABI=my-core-1 \
      -DBOOST_ROOT=<boost> -DOPENSSL_ROOT_DIR=<openssl>
cmake --build build --config RelWithDebInfo

On Linux and macOS add -DCMAKE_BUILD_TYPE=RelWithDebInfo to the first line and --parallel to the second.

The options the fork adds or relies on:

Option Default Meaning
WITH_DYNAMIC_LINKING OFF Build common, shared, database and game as shared libraries. Needed for plugin libraries.
AC_PLUGIN_ABI azerothcore-dev Name of the binary interface. Plugins must be built with the same value; the loader refuses others.
AC_PLUGIN_SOURCE_DIRS empty Plugin source folders built with the core, ;-separated.
AC_PLUGINS_OUTPUT_DIR plugins next to the programs Where built plugins are laid out.
WITH_PLAYERBOTS_HOOKS OFF Compile the core hooks mod-playerbots needs when it is loaded as a plugin rather than built from modules/.
WITH_SQLITE ON Build the SQLite backend into the core.
APPS_BUILD, TOOLS_BUILD all, none AzerothCore's own: TOOLS_BUILD=maps-only builds the extractors, db-only builds dbimport and sqlconv, all everything.

Pick your own AC_PLUGIN_ABI name for your builds. Packages from the LonelyIce catalog are built with lonelyice-ac-2 by the LonelyIce build, with the core options its CMakeLists.txt sets, and only fit a core built the same way from the same commit; a matching string alone does not make binaries compatible (ABI).

Static core. Leave WITH_DYNAMIC_LINKING off and you get AzerothCore's usual static programs. Plugin folders in AC_PLUGIN_SOURCE_DIRS are then compiled into the programs their manifest names in server.apps, and their folders are still laid out, without a library (Built into the programs). A static core refuses plugin libraries at run time.

Classic modules still work: a module in modules/ is built into the core as in AzerothCore (MODULES=static).

Building plugins against it

A plugin is a folder with plugin.json and a CMakeLists.txt that calls AddPlugin(); the walk-through is Your first plugin, the reference Plugin API. Pass the folders when you configure the core, together with every plugin they depend on:

cmake -S azerothcore-wotlk -B build -DWITH_DYNAMIC_LINKING=ON -DAC_PLUGIN_ABI=my-core-1 \
      "-DAC_PLUGIN_SOURCE_DIRS=C:/dev/mod-playerbots;C:/dev/example.greeter"
cmake --build build --config RelWithDebInfo --target example-greeter

--target takes the target name given to AddPlugin. Each plugin is laid out under build/bin/RelWithDebInfo/plugins/<id>/ (Visual Studio; single-configuration generators use build/bin/plugins/), with its library in server/<platform>/.

Playerbots as a plugin. Configure with -DWITH_PLAYERBOTS_HOOKS=ON and add a checkout of LonelyIceProject/mod-playerbots to AC_PLUGIN_SOURCE_DIRS; the plugin id is playerbots. Without the option the core lacks the hooks the plugin calls. Alternatively clone the module into modules/mod-playerbots and build it the classic way; then it is not a plugin and the option is not needed.

Running a plain worldserver with plugins

On Windows the build leaves everything in build/bin/RelWithDebInfo/: the programs, the core DLLs, configs/ with the .conf.dist files, and plugins/.

  1. Configs. Copy configs/worldserver.conf.dist to worldserver.conf and authserver.conf.dist to authserver.conf. The databases need no change: the shipped defaults are SQLite files, and authserver and worldserver use the same auth file:

    LoginDatabaseInfo     = "sqlite:db/auth.sqlite"
    WorldDatabaseInfo     = "sqlite:db/world.sqlite"
    CharacterDatabaseInfo = "sqlite:db/characters.sqlite"
    

    Relative paths start at the working directory; the files and the db folder are created on the first start (Updates.AutoSetup = 1, also the default). The comments show the MySQL form, which needs the MySQL plugin (below). dbimport's .conf.dist has the same defaults.

  2. Game data. Set DataDir to the data extracted from the client with AzerothCore's tools (dbc, maps, and optionally vmaps, mmaps), as for any AzerothCore server. With DBC.FromDatabase = 1 the DBC data comes from dbc_* tables of the world database instead (Server game data).

  3. Plugins. Put each plugin folder (the whole <id>/ folder with plugin.json) into plugins/, or point PluginsDir elsewhere. It is read relative to the working directory, so start the programs from their folder. worldserver loads plugins made for worldserver; authserver and dbimport load only those that list them in server.apps (a database backend does).

  4. Plugin configs. A plugin's settings come from the .conf.dist inside its folder. To change them, copy it to modules/<name>.conf (without .dist) beside the program's config and edit that; its values win key by key, and keys you delete from it keep the .dist value. The modules folder is the one beside the config the program loaded: configs/modules for the default config on Windows, <dir>/modules when you start with -c <dir>/worldserver.conf. Only when that folder does not exist does the core look in its default config directory (configs/ of the working directory on Windows, the build's CONF_DIR on Linux and macOS).

  5. Start. Run authserver and worldserver. On the first start the updater creates the databases (Updates.AutoSetup = 1) and asks on the console before creating each one; answer, or set AC_DISABLE_INTERACTIVE=1. The SQL comes from the source tree (SourceDirectory, by default the checkout the programs were built from) and from the plugins' folders.

The log shows each plugin as Plugin <id> <version> (<name>), or why it was not loaded; the messages are listed in Plugin API and explained in Debugging plugins.

Playerbots on SQLite. The plugin owns a database of its own. Its playerbots.conf.dist defaults to a SQLite file next to the core's, with the characters database attached, the form LonelyIce uses:

PlayerbotsDatabaseInfo = "sqlite:db/playerbots.sqlite;attach=characters=db/characters.sqlite"

Keep the attach path equal to CharacterDatabaseInfo's file; if you move the core's databases, set it in modules/playerbots.conf. With MySQL use the MySQL form (see the comment in the .dist), on the same backend as the characters database.

Every option can also be set from the environment as AC_<KEY> (AC_PLUGINS_DIR, AC_WORLD_DATABASE_INFO, ...); see Environment variables.

MySQL instead of SQLite

Build mod-lonelyice-mysql as a plugin (its README: add the folder to AC_PLUGIN_SOURCE_DIRS and set LONELYICE_MYSQL_DIR to a MySQL 8 distribution) and put the lonelyice.mysql folder into plugins/. It registers the MySQL backend in worldserver, authserver and dbimport, which then accept host;port;user;password;database strings (optionally with a mysql: prefix). Details in Storage plugins.

LonelyIce with your own core checkout

The LonelyIce repository includes the fork as the submodule external/azerothcore and builds it as a subproject. To build against another checkout, for example your branch of the fork:

cmake -S . -B build -DBOOST_ROOT=<boost> -DOPENSSL_ROOT_DIR=<openssl> -DLONELYICE_CORE_DIR=C:/dev/azerothcore-wotlk
cmake --build build --config RelWithDebInfo --target lonelyice_release

You can also work in external/azerothcore directly: it is a normal Git checkout of the fork, so add your own fork as a remote there.

The LonelyIce build forces these core options, whatever your cache says:

Option Value
WITH_DYNAMIC_LINKING ON
WITH_PLAYERBOTS_HOOKS ON
AC_PLUGIN_ABI lonelyice-ac-2
AC_PLUGIN_SOURCE_DIRS LONELYICE_PLUGIN_DIRS (default: every plugins/* folder with a plugin.json)
TOOLS_BUILD maps-only (LonelyIce embeds the map extractors)

Programs, core libraries and plugins all go to build/bin (build/bin/<config> with Visual Studio). The full build instructions are in Building LonelyIce.

Plugins built with a changed core only work with that build. A change that alters headers in a way that breaks existing plugin binaries needs a new ABI name for releases (ABI); what that involves is in Contributing.