Ir al final de los metadatos
Ir al inicio de los metadatos

Estás viendo una versión antigua de esta página. Ve a la versión actual.

Comparar con el actual Ver el historial de la página

« Anterior Versión 6 Siguiente »

Since April 2016 TrinityCore supports C++ script reloading while the server is running (without restarting the server).

This tutorial will guide you step by step through the features which the script hotswap system offers.

Enabling the hotswap system

Static linking (default)

Maybe you came in touch already as you read the core setup guide with the SCRIPTS CMake variable which controls the build behaviour of the C++ scripts (the .cpp files you'll find in the src/server/scripts directory).

When you build the scripts statically (SCRIPTS="static") all scripts are compiled into the worldserver, that's why the size of it's executable is huge when building statically. The static build is easy to build and maintain and isn't error prone, but it requires the worldserver to be rebuilt as soon as you edit a script which heavily slows down the fun/ and time working with scripts.

Dynamic linking

Dynamic linking splits the compiled code into multiple shared libraries (.dll on Windows, .so on Linux), which decreases the worldserver executable size but also makes it possible to attach/detach shared libraries while the application is running.

The hotswap system heavily abuses shared library attaching and detaching to hotswap C++ code into the running server without restarting, which heavily speeds up the development time of scripts.

You can always enable the dynamic linking by enabling the CMake WITH_DYNAMIC_LINKING option ("-DWITH_DYNAMIC_LINKING=ON") without making any change to the script configuration.

Scripts as independent modules

You can choose for every script subproject how you want to build it, there are 4 options available, which you can configure through the SCRIPTS_${MODULENAME} CMake variables:

 

  • "default": The linking mode from the SCRIPTS variable is used
  • "disabled": Exclude the script subdirectory from the build (excluding unused scripts will speed up the build time).
  • "static": Build the subdirectory always statically (no hotswapping is supported for this module then).
  • "dynamic": Builds the subdirectory dynamically (to a shared library), which is reloadable.

Setting the variable for a script subdirectory automatically overwrites the value of the SCRIPT variable which offers you some predefined build templates:

 

  • "none": disables all scripts
  • "static": builds all scripts statically (this is the old -DSCRIPTS=1 option).
  • "dynamic": builds all scripts dynamically
  • "minimal-static": builds commands and spells statically, disables other scripts (this is the old -DSCRIPTS=0 option).
  • "minimal-dynamic": builds commands and spells dynamically, disables other scripts.

Configuring the hotswap system

 

  • Sin etiquetas