-
-
Notifications
You must be signed in to change notification settings - Fork 15
Unreal
Julian Benda edited this page Sep 21, 2023
·
4 revisions
For the usage in Unreal a plugin is provided which allows including ink json files as assets.
Its 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 triggert, 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 knowlagde of the usage, template decution is no way to for determining external function arguments. Therfore all external functions must take FInkVars, which then can be queryied what kind of type they include, and this type can be readed.
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 --branch feature/Unreal_fixes 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 Example Data