Skip to content
Julian Benda edited this page Sep 21, 2023 · 4 revisions

Unreal

General Informations

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 with LoadSnapshot(<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.

Building

Instructions:

  1. create an unreal project and close it
  2. not down path to unreal project (PATH/TO/UNERAL_PROJECT) e.g. D:\Dokumente\Unreal Projects\InkDemo
  3. git clone --branch feature/Unreal_fixes https://github.com/JBenda/inkcpp.git
  4. cd inkcpp
  5. mkdir build
  6. mkdir plugin
  7. cd build
  8. cmake -DCMAKE_INSTALL_PREFIX=../plugin ..
  9. cmake --install . --component unreal
  10. 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 Image of Compiled File Directory
  11. Copy content of the InkUnrealExample in PATH\TO\UNREAL_PROJECT\Content
  12. Start unreal project
  13. Select Level NewMap from the Content Drawer
  14. 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 ...

A Record of the terminal side of the build process can be found here Example Data

Clone this wiki locally