JBenda / inkcpp

Inkle Ink C++ Runtime with JSON>Binary Compiler
MIT License
70 stars 13 forks source link

Fix and Update Unreal Plugin for UE 5 #49

Closed JBenda closed 1 year ago

JBenda commented 2 years ago

Inkcpp got many new features which are not mirrored in the Unreal Plugin. On top, many small name clashes with UE5 exists.

JBenda commented 2 years ago

So the unreal plugin is reworked:

Please don't hesitate to test it and provide feedback :)

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
  11. Start unreal project
  12. load assets
  13. start level, for the control use the 1,2,3 and 4 Key to select the corresponding choice

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

UnrealAssets.zip

JBenda commented 2 years ago

So the unreal plugin is reworked:

Last Update: 20.09.2022

Please don't hesitate to test it and provide feedback :)

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
  11. Copy content of the InkUnrealExample in PATH\TO\UNREAL_PROJECT\Content grafik
  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

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

sinbad commented 1 year ago

I'm just checking this PR out because I'm investigating Ink in UE5, but I think the attachment for "InkUnrealExample" is missing?

JBenda commented 1 year ago

I'm just checking this PR out because I'm investigating Ink in UE5, but I think the attachment for "InkUnrealExample" is missing?

Thanks for letting me know. The upload link expired, now it is a permanent one.

JBenda commented 1 year ago

Merged Snapshot (Save/Load) Functionality

Namely, a new function for the InkRuntime was added InkSnapshot Snapshot() this creates a snapshot which can then be loaded with LoadSnapshot(InkSnapshot).

Be aware that loading a snapshot invalidates all existing Threads, so best stop them or reinitialize them with StartExisting().

A snapshot contains all corresponding Threads of the Runtime. Currently, you create new threads in the same order they were created before, later a label feature should be introduced.

Feel free to try, and comment if you have any input.

PS: A Unreal example Project which uses the new functionality can be fond below. For the instructions, please refer to the post before.

Extended Example

sandiz commented 1 year ago

ink compiler 1.1.1 is no longer able to compile TagsStory.ink / all tags tests are failing as inklecate is not able to compile ink files.

This might be because of dynamic tag introduction -- RELEASE

image

/Users/sandi/Projects/inkcpp/cmake-build-release/inkcpp_test/inkcpp_test -r xml -d yes --order lex
Testing started at 2:29 AM ...

/Users/sandi/Projects/inkcpp/inkcpp_test/Tags.cpp:145: Failure:
due to unexpected exception with message:
  Diverting past end of story data!

ERROR: 'TagsStory.ink' line 9: Expected end of line but saw '# choice_tag_b'
ERROR: 'TagsStory.ink' line 21: Expected end of line but saw '# close_tag'

/Users/sandi/Projects/inkcpp/inkcpp_test/Tags.cpp:46: Failure:
due to unexpected exception with message:
  Inklecate failed with exit code 256

/Users/sandi/Projects/inkcpp/inkcpp_test/Tags.cpp:31: Failure:
due to unexpected exception with message:
  Unrecognized command!

/Users/sandi/Projects/inkcpp/inkcpp_test/Tags.cpp:179: Failure:
due to unexpected exception with message:
  Unrecognized command!

Process finished with exit code 4

Any pointers on how to fix this ?

JBenda commented 1 year ago

Looks like they changed the syntax. It seems the tag must now be in front of the jump. I will take a deeper look on Monday.

+ Hey # choice_tag
   -> knot2
JBenda commented 1 year ago

The notation with * [b # choice_tag_b]->knot2 results in the expected output for inky. Sadly, it also introduced a new tag, which is not yet supported by us. But WIP ^^

JBenda commented 1 year ago

TagsStory.ink is now updated and the c++ part also supports now tag annotate choice (see choice::get_tag(size_t))

sandiz commented 1 year ago

Thanks so much for pushing a fix @JBenda 🙏 🎉 , i'll test this ~soonish™~ and get back! is there a patreon or github sponsor option available ? would love to support you guys! ❤️

sandiz commented 1 year ago

tested on mac / windows - inkcpp is working correctly (cpp library) with latest inklecate v1.1.1

JBenda commented 1 year ago

Thanks so much for pushing a fix @JBenda pray tada , i'll test this ~soonish™~ and get back! is there a patreon or github sponsor option available ? would love to support you guys! heart

There is no inkcpp patreon, but please don't hesitate to use GitHub sponsoring