While Naninovel is focused around traditional visual novel games the engine is designed to allow integration with existing projects. If you're making a 3D adventure game, RPG or game of any other genre — you can still use Naninovel as a drop-in dialogue system.
There are multiple ways you can integrate Naninovel with a custom project and specific implementation will depend on the type of the project and what exactly you want to achieve with Naninovel. In the following documentation we'll list various configuration options and API that could be useful for "pairing" Naninovel with a standalone game. Before you continue, consider checking the engine architecture to better understand how the engine behaves on a conceptual level.
The first thing you'll probably want to change is disable the
Initialize On Application Load option in the engine configuration menu.
When enabled, the engine services will automatically initialize on application start. Unless you want to begin your game in dialogue mode, you would rather manually initialize the engine when it's actually needed.
Use the static async
RuntimeInitializer.InitializeAsync() method to initialize the engine at runtime before using any of the built-in service APIs.
You can check whether the engine is currently initialized with
Engine.IsInitialized property. Use
Engine.OnInitialized event to listen for the initialization finished events.
To destroy all the engine services and completely remove Naninovel from memory, use
Engine.Destroy() static method.
To preload and play a naninovel script with a given name, use
PreloadAndPlayAsync(ScriptName) method of the
ScriptPlayer service. To get an engine service, use
Engine.GetService<TService>() static method, where
TService is the type of the service to retrieve. For example, the following will get the player service, then preload and play a script with name "Script001":
var player = Engine.GetService<ScriptPlayer>(); await player.PreloadAndPlayAsync("Script001");
When exiting the dialogue mode and returning to the main game mode, you probably would like to unload all the resources currently used by Naninovel and stop all the engine services. For this, use
ResetStateAsync() method of the
var stateManager = Engine.GetService<StateManager>(); await stateManager.ResetStateAsync();
A built-in title menu implementation will be automatically shown when the engine is initialized, while you'll most likely have your own title menu. You can either modify or completely replace the built-in title menu using UI customization feature or just disable it by turning off
Show Title UI toggle in the engine configuration menu.
You can set a specific layer for all the objects created by the engine via configuration menu.
This will also make the engine's camera to use culling mask and render only the objects with the specified layer.
To change the layer of the UI objects managed by the engine, use
Objects Layer option in the UI configuration menu.
You can make the engine's camera render to a custom render texture instead of the screen (and change other camera-related settings) by assigning a custom camera prefab in the camera configuration.
The following video shows a basic way to integrate Naninovel with Unity's 3D Game Kit project and use it as a drop-in dialogue system.
Be aware, that the video was created with a previous version of the engine and some of the steps may not reflect how things currently work. We'll update the video after the stable release, but you can still use the current one to get a grasp on how the integration could be implemented on a conceptual level.
The sources of the project shown in the video are available on GitHub.