-
-
Notifications
You must be signed in to change notification settings - Fork 16
Unreal
JBenda edited this page Oct 17, 2023
·
4 revisions
For the usage in Unreal a plugin is provided which allows including ink JSON files as assets.
It provides the following objects:
- AInkRunner: loading a story and managed threads
- UInkThread: can be started by connecting to a story. Has different Events which can be triggered, most important:
- OnLine(FString line, const TArray& tags): a line of story output was generated attention: tags are collected until a choice is taken, then cleared if this is a bad way to handle it feel free to state your opinion in a github issue
- OnChoice(const TArray<UChoice*>& choices): a choice is to be taken, this are the options.
- PickChoice(int index): select a choice
- InkSnapshot: can be created with
Snapshot()
and loaded withLoadSnapshot(<InkSnapshot>)
for more details, visit the inkcpp page - UChoice: a choice to select
- GetIndex() get index for PickChoice
- GetText() get text contained in the choice
- GetTags() get tags attached to choice
- FInkVar: because the plugin must be compiled without knowledge of the usage, template decution is no way to for determining external function arguments. Therefore all external functions must take FInkVars, which then can be queried what kind of type they include, and this type can be read.
Instructions:
- create an unreal project and close it
- not down path to unreal project (PATH/TO/UNERAL_PROJECT) e.g. D:\Dokumente\Unreal Projects\InkDemo
git clone https://github.com/JBenda/inkcpp.git
cd inkcpp
mkdir build
mkdir plugin
cd build
cmake -DCMAKE_INSTALL_PREFIX=../plugin ..
cmake --install . --component unreal
- compile plugin:
\PATH\TO\UNREAL_ENGINE\Build\BatchFiles\RunUAT.bat BuildPlugin -plugin="PATH\TO\GIT\REPO\plugin\inkcpp\inkcpp.uplugin" -package="\PATH\TO\UNERAL_PROJECT\Plugins\inkcpp" -TargetPlatforms=Win64
- Copy content of the InkUnrealExample in PATH\TO\UNREAL_PROJECT\Content
- Start unreal project
- Select Level
NewMap
from the Content Drawer - start level, for the control use the 1,2,3 and 4 Key to select the corresponding choice
- in the main world is a MyInkRuntime instance which takes a InkAsset for the story to play
- unreal_example shows different kind of interaction between engine and ink
- TheInterceptor is a larger example story from ink
- to create a InkAsset import a
.ink
. file or an inklecate compiled.json
← we will probably not in future keep high priority on json imports ...
- in the main world is a MyInkRuntime instance which takes a InkAsset for the story to play
A Record of the terminal side of the build process can be found here
The Data can be found here: Example Data