+1
Answered

Can you download Graphs and run them at runtime on AOT platforms like IOS?

jens 3 years ago updated by Lazlo Bonin (Lead Developer) 3 years ago 6

Hi, we are developing an mobile app and are considering getting Bolt if it fulfills our criteria of being able to be download and run game logic at runtime on the IOS platform.

Is this possible with bolt? We are open to many limitations and workflows as long as it allows downloading new content with its own game logic not defined in the core application.

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
GOOD, I'M SATISFIED

Fast response and clear answers.

Satisfaction mark by jens 3 years ago

Yes.  Take a look here, https://support.ludiq.io/forums/4-bolt-manual/topics/161-building-for-aot-platforms/

Lazlo, the dev no doubt can answer any specific questions. 

I did have a look at that page, but what I am wondering about is whether it would work in a scenario like this:
  1. Create a build of the app which includes the Bolt plugin.
  2. Make a minigame where all game logic is made using Bolt graphs.
  3. Export the minigame as part of an asset bundle.
  4. Using the app you download the asset bundle from an server.
  5. Load and play the minigame using the app.

What I see as a potential problem is that when the AOT Pre-Build system scans assets and scenes to generate required AOT stubs, it wouldn't be able to do this for the content made in step 2.

So I was wondering if it is possible to have it generate "all" conceivable stubs and not only specifically for the content contained in the current build, or if there is some workflow that allows downloading and playing content at runtime made after the build without being too limited with regards to having to predict in advance what developers would want to do in step 2.

Ahh. Seems your use case scenario is a bit unique and as an end user only I could not in all confidence tell you yes. Lazlo is quick to reply though and if you have discord you could also ask there.

Answered

Hi Jens,

Unfortunately, AOT pre-build will not work with scripts in asset bundles for the reason you mentioned. Generating "all conceivable stubs" would mean generating stubs for everything in the .NET, Unity, third party plugins and your custom codebase, which would result in dozens of megabytes of bloat (that's why code is stripped in mobile builds in the first place).

In the mid- to long-term future, there may be graph-to-script compilation as part of Bolt. This would replace AOT pre-build and allow you to include your compiled graph-scripts right into your asset bundles, solving this issue. At the moment however, this is not available.

I might be missing something, but will you be able to compile graph-to-script at runtme on a AOT platform like IOS? I am only considering using visual scripting as a solution to not being able to compile code at runtime and sidestep the Apple policy.

Also would it be possible to not generate all, but a defined collection of variants of stubs, beyond what is used in the project at build time, I wouldn't care if it adds an extra 10mb of space as long as it performs OK.

No, graph-to-script at runtime wouldn't be possible. The goal of Bolt is not to go around AOT.

There could be a way of forcing AOT stubs to generate for a specific subset of types, but that's not planned at the moment, as this would be the only (and very rare) use case for it.