How to use advanced features
Android Setup¶
To use Hercules additional features, the prefab feature must be enabled in the Android Gradle module.
Android Studio Project Configuration¶
-
When using Android Gradle Plugin lower than 4.1
-
Add the following to the gradle.properties file.
-
-
When using Android Gradle Plugin 4.1 or higher
-
Add the following to the android block in the build.gradle file.
-
-
In your module-level build.gradle file, add the following libraries to the
dependenciessection:
CMake / ndk-build Configuration (for C/C++ Usage)¶
-
When using NDK r21 or higher
// When using CMake find_package(Hercules REQUIRED CONFIG) target_link_libraries( ... Hercules::Hercules ) // When using Android.mk LOCAL_SHARED_LIBRARIES := Hercules include $(BUILD_SHARED_LIBRARY) ifneq ($(call ndk-major-at-least,21),true) $(call import-add-path,$(NDK_GRADLE_INJECTED_IMPORT_PATH)) endif $(call import-module, prefab/Hercules) -
When using NDK r21 or lower
-
Add the Hercules.h file to your project separately, and link the .so file directly by specifying its path.
// When using CMake target_link_libraries( ... ${CMAKE_CURRENT_SOURCE_DIR}/../build/intermediates/merged_native_libs/${CMAKE_BUILD_TYPE}/out/lib/${ANDROID_ABI}/libHercules.so ) // When using Android.mk include $(CLEAR_VARS) LOCAL_MODULE := Hercules LOCAL_SRC_FILES := ../build/intermediates/merged_native_libs/release/out/lib/$(TARGET_ARCH_ABI)/libHercules.so include $(PREBUILT_SHARED_LIBRARY) LOCAL_SHARED_LIBRARIES := Hercules
-
iOS Setup¶
Configuration Method¶
- Locate the
.hfile under the path of the Hercules framework installed in the project via CocoaPods, and import it into the project.
You may use any header included in either the simulator or device target path.
The path is as follows.
Unity Setup¶
Project Configuration¶
-
Add
USE_HERCULESto the Unity preprocessor flags.- Player Settings → Other Settings → Script Compilation → Scripting Define Symbols
-
Enable the option to allow ‘unsafe’ code.
- Player Settings → Other Settings → Script Compilation → Allow ‘unsafe’ Code
Unreal Setup¶
The Hercules module included in the SDK Unreal Plugin does not support Hercules add-ons.
To use Hercules add-ons in an Unreal environment, refer to the following.
- Remove the Hercules module included in the HiveSDK UE Plugin
-
Enable the HerculesPlugin located at the top of the HiveSDK UE Plugin (select according to the platform to use in Build.cs)
if (Target.Platform == UnrealTargetPlatform.Android) PrivateDependencyModuleNames.AddRange(new string[] { "HerculesPlugin" }); if (Target.Platform == UnrealTargetPlatform.IOS) PrivateDependencyModuleNames.AddRange(new string[] { "HerculesPlugin" }); if (Target.Platform == UnrealTargetPlatform.Win64) PrivateDependencyModuleNames.AddRange(new string[] { "HerculesPlugin" }); -
When using the HerculesPlugin included in the HiveSDK UE Plugin, the main functions must be called directly.
#include "HerculesPlugin.h" // Use the game_id and app_id values issued from HiveConsole. #if PLATFORM_WINDOWS CHerculesPlugin::Initialize(game_id, 0, app_id, app_version); #else CHerculesPlugin::Initialize(game_id, 0); #endif // Set the value when a Hive Device ID is issued. ::HerculesSetDeviceId(TCHAR_TO_UTF8(*deviceId)); // Set the Player ID when the user logs in, and set it again on re-login. ::HerculesSetPlayerId(TCHAR_TO_UTF8(*playerId));

