Hello,
to my disappointment I realized that Urho does not support running scripts outside of the main thread. I only found this thread that expresses similar concerns but no ideal solution. That was quite some time ago, perhaps by now someone knows of a better way to handle this.
Assuming that using AngelScript instead of LUA would have the same issue, I only see two options:
a) Modify Urhos LUA subsystem so that there can be multiple LuaScript instances (one for each thread) which don’t interfere with each other. No idea how feasible/how much work this would be
b) Ditch Urhos LUA altogether and use a different, perhaps more up to date, implementation that can do this. What would be best here?
c) …other ideas?
If you wonder why I want this it is simple: In my game I have multiple AI actors and I want their behaviour completely scriptable but also run in threads as these scripts could get expensive or there could be a lot of actors at the same time.
Trying it out I had to find out the hard way that running the script in a thread (not even parallelizing the scripts themselves, just having a single worker thread in the background) definitely crashes the application after some ticks.
Thanks for any input.