Versiones comparadas

Clave

  • Se ha añadido esta línea.
  • Se ha eliminado esta línea.
  • El formato se ha cambiado.

...

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

 


Tabla de contenidos

Enabling the hotswap system

...

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 when working with scripts. 


Nota

Script projects which were built statically into the worldserver aren't reloadable at runtime!

...

Nota

Script projects which were built dynamically are reloadable at runtime, (since it is built into separated shared libraries, which you will find in the the "script" directory).


 


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.

...

If you want to disable the whole system you may disable it through the HotSwap.Enabled worldserver.conf setting. 


Nota

To run the system without errors you need to run the worldserver outside of your build directory.

Use the CMAKE_INSTALL_PREFIX to install TrinityCore to your preferred install location when using the hotswap system.

  1. Set the CMAKE_INSTALL_PREFIX to a location in your filesystem (not C:/ on windows since it's write protected in most cases).
  2. Use the cmake INSTALL project target in Visual Studio (or `make install on unix`), to install TrinityCore to the location specified by CMAKE_INSTALL_PREFIX .
  3. Start the worldserver from the location specified by the CMAKE_INSTALL_PREFIX.

Starting the worldserver inside your build directory may work but this method is unsupported!



Additionnaly, you cannot use the built-in feature of VS around cmake (using the project as a cmake ready directory).

You have to make cmake create a .sln project file and open that file in VS. (back-story behind this is that the internal feature of VS will add path of VS installation of std includes that the recompiler wont have at the time of recompile : https://github.com/TrinityCore/TrinityCore/issues/25445 ).


The hotswap system checks the CMAKE_INSTALL_PREFIX at startup and will correct it in your build directory automatically if needed (HotSwap.EnablePrefixCorrection=1 -> default).

...

which will cause the worldserver to reload the associated shared library:

 


Just change a script source file in your dedicated IDE or text editor → the worldserver will recompile and reload it in a short time.

...

It also observes the directories and re-invokes CMake to take care of added or removed source files.


Troubleshooting

...


Expandir
titleFailed to create Cache entry assertion

Make sure you are running the server outside your build directory see "Configuring the Hotswap System"

...