Skip to content

Loreline v0.10.0

Latest

Choose a tag to compare

@github-actions github-actions released this 25 Aug 21:51
og-banner

This release rather well packed with changes: beat parameters and dynamic beat calls, PHP support, pure GDScript runtime for Godot, and various interpreter and language fixes.

Beat Parameters & Dynamic Beat Calls

Beats can now take parameters, with optional default values, and be invoked in every form the language supports:

beat Greet(name, mood = "happy")
  $name looks $mood.

beat Main
  Greet("Ana", "curious")   // runs the beat, then comes back here
  -> Farewell("Ana")        // transitions with arguments
  • Beat call statements: calling a beat like Greet("Ana") runs it and returns to the caller, preserving the call stack, like a subroutine.
  • Dynamic beat calls: beat(expr, args...) resolves the target beat at runtime, from a beat value or a computed name. The same works for transitions (-> beat(expr, ...)) and choice insertions (+ beat(expr, ...)).
  • Dynamic function calls: call(expr, args...) does the same for functions, including inside function code.
  • Everything integrates with save/restore, and the LSP provides completion and hints for beat parameters and dynamic calls.

PHP Support

Thanks to being written in Haxe, Loreline can now run on PHP (8.1+). The library is plain PHP, ships with a Composer-friendly layout, and mirrors the API of the other targets: parse(), play(), resume(), custom functions, character and state access.

Look at the PHP integration guide to learn more about it!

Pure GDScript Runtime for Godot

Alongside the native GDExtension, Loreline now ships a pure GDScript version of the runtime, which can be used as a drop-in replacement.

The native GDExtension remains the recommended option where available, since it is meaningfully faster. The pure GDScript build is there for platforms where native libraries are not an option, or for purists who want to use GDScript everywhere to rule them all...

Interpreter Lifetime & Memory Model

  • Fixed a race condition where an interpreter could be released too early while the native runtime still needed it, which crashed exported Godot Android builds that worked fine in the editor.
  • C++ API (breaking): the advance and select continuations handed to dialogue and choice handlers are now Loreline_Advance and Loreline_Select values, each bound to the interpreter that produced it. Call sites are unchanged (advance(), select(index)), but storing one and answering later, from a UI event for instance, is now safe, including with several interpreters running side by side. The previous function pointers resolved a global interpreter and could drive the wrong story.
  • Added a more automated tests to cover this area and make sure it doesn't stop working because of some future change.

Language & Runtime Improvements

  • Arrays and key-value objects now cross the host boundary in the C API and the Godot extension, as deep-copy snapshots with a consistent contract.
  • UTF-8 performance: targets that are slow at random access into UTF-8 strings, PHP first among them, can now use a code point vector representation, with further UTF-8 optimizations across the board.
  • Parser fixes: trailing if conditions using chained dot access and calls, several save/restore fixes when choice insertions are involved, choice introspection returning the full flattened list mid-collection, and state field values that look like expressions but are not.
  • Haxe 4.3.7 toolchain update, plus Haxe 5 compatibility fixes (thanks @mikaib!).

New Contributors

Full Changelog: v0.9.1...v0.10.0