Новости Clair Obscur: Expedition 33 – новая ролевая игра, ломающая стереотипы
  • 177
  • 1
Clair Obscur: Expedition 33 – уникальная ролевая игра, которая могла появиться только у инди-разработчика Раз в год Художница просыпается и рисует на Монолите. Выводит свое проклятое число. И...
Новости Состоялся релиз The Elder Scrolls IV: Oblivion Remastered
  • 1.173
  • 18
22 апреля 2025 года состоялся релиз игры The Elder Scrolls IV: Oblivion Remastered. Это ремастер игры 2006 года, разработанный студиями Virtuos и Bethesda Game Studios, изданный Bethesda...
Важно Форуму RPGRUSSIA 15 лет!
  • 3.053
  • 19
Друзья, сегодня нашему форуму исполняется 15 лет! Кажется, только вчера мы открывали первые разделы, спорили о правилах и радовались каждому новому участнику. Но годы пролетели - а мы всё здесь, и...
Новости Path of Exile 2: Патч 0.2.0 «Dawn of the Hunt» - краткое описание
  • 1.613
  • 0
Вчера вечером, в 22.00 по МСК, в прямом эфире вышла презентация по будущему патчу 0.2.0. В целом, игроки ждали нового класса и ребаланса существующих умений, но то что выкатили GGG на публику...
Union: Создание и запуск плагина / Creating and running a plugin

Гайд Union: Создание и запуск плагина / Creating and running a plugin

Работа с плагином Юнион. Этап создания плагина.
*Before the beginning, read this topic.

Creating a project:
Launch Visual studio, select 'Create project', or hold Ctrl + Shift + N.
In the window that opens, we find the plugin template UnionPlugin_X_Xx for Visual C ++.
Click ok and look in the browser window.

We have the interfaces of 4 versions of ZenGin and several source code files. Now we need Application.cpp.
Open the file and you can see several functions. Each will be called automatically when a game event is performed:
- Game_Entry occurs when initializing game resources and entering the main menu.
- Game_Init occurs when the game ends correctly.
- Game_Exit occurs every time the frame is redrawn during the game.
- Game_Loop happens before saving starts.
- Game_SaveBegin occurs before saving starts.
- Game_SaveEnd occurs after saving is completed.
- LoadBegin before any game loading.
- LoadEnd occurs after any loading of the game
- Game_LoadBegin_NewGame happens before loading a new game.
- Game_LoadEnd_NewGame happens after loading a new game.
- Game_LoadBegin_SaveGame happens before loading a saved game.
- Game_LoadEnd_SaveGame occurs after loading a saved game.
- Game_LoadBegin_ChangeLevel happens before loading another location.
- Game_LoadEnd_ChangeLevel occurs after loading another location.
- Game_LoadBegin_Trigger occurs before loading another location via a trigger (before calling Game_LoadBegin_ChangeLevel).
- Game_LoadEnd_Trigger occurs before loading another location via a trigger (after calling Game_LoadEnd_ChangeLevel)
- Game_Pause occurs when a game is paused.
- Game_Unpause occurs when the game resumes.
- Game_DefineExternals occurs before initializing external script functions.

Program code implementation:

These functions will be basic in writing any plugin. Therefore, within the framework of the current tutorial, I propose to check how they work.
When entering the main menu, we will output a message with the name of the current plugin, version of Union and the current engine.
We will use the Game_Init function.
C++:
// The function returns the name of the engine based on its version.
string GetEngineVersionName(TEngineVersion version) {
  switch( version ) {
  case Engine_G1:  return "Gothic I Classic";
  case Engine_G1A: return "Gothic I Addon";
  case Engine_G2:  return "Gothic II Classic";
  case Engine_G2A: return "Gothic II Addon";
  }
  return "Unknown";
}

void Game_Init() {

  // We get a pointer to the current
  // plugin and get its name
  const CPlugin* plugin = CPlugin::GetCurrentPlugin();
  string pluginName = plugin->GetName();

  // Get the instance version of the union
  // and convert it to a text string.
  TVersion unionVersion = Union.GetUnionVersion();
  string unionVersionName = unionVersion.ToString();

  // Get the version of the engine and its name
  TEngineVersion engineVersion = Union.GetEngineVersion();
  string engineVersionName = GetEngineVersionName(engineVersion);

  // Show a message on the screen
  Message::Info( string::Combine(
    "Plugin name: %s\nUnion version: %s\nEngine version: %s",
    pluginName,
    unionVersionName,
    engineVersionName
  ) );
}
Compilation and running:
In the project 'Configuration manager', set 'Release'. We collect the project and add it to the ini file. We start the game and wait for the menu to load.

Result:
Сверху Снизу