Search found 69 matches

by ptmikheev
15 Nov 2020, 20:08
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 137
Views: 113573

Re: Lua scripting in OpenMW

AnyOldName3 wrote: 15 Nov 2020, 19:18 We're already processing the world state during the rendering of the previous frame. If scripting happens then, too, then it's necessarily ignoring that frame's world state changes.
Could you point me to the place in the code where it is happening?
by ptmikheev
15 Nov 2020, 18:05
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 137
Views: 113573

Re: Lua scripting in OpenMW

Extracting the whole scripting to a separate thread is more important than multithreaded scripting. It should be safe because rendering and scripting work on different data. I'm not convinced this has been thought through. Rendering works on the world state after all processing has been done, so yo...
by ptmikheev
14 Nov 2020, 18:03
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 137
Views: 113573

Re: Lua scripting in OpenMW

I've written some ideas in a google doc . Open for comments. Key points about threads and events: Extracting the whole scripting to a separate thread is more important than multithreaded scripting. It should be safe because rendering and scripting work on different data. Local scripts are always syn...
by ptmikheev
08 Nov 2020, 23:07
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 137
Views: 113573

Re: Lua scripting in OpenMW

Personally, I think a combination of 1 and 3 is the way to go. We could have local scripts run on the main thread, and delegate to them features which are necessary to run every frame (e. g. smooth UI animations, or manipulating actor positions in a very specific way). Since there was some misunder...
by ptmikheev
08 Nov 2020, 19:49
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 137
Views: 113573

Re: Lua scripting in OpenMW

Could we have something like a bunch of scripts that need to be run at some point during the frame, and the main thread sticks them in a queue of waiting scripts that get picked up by a pool of worker threads, then once it needs the results of things, it can either deal with what the worker threads...
by ptmikheev
08 Nov 2020, 00:04
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 137
Views: 113573

Re: Lua scripting in OpenMW

Lua doesn't support threads. Async logic can be implemented with coroutines, but it's not real threads. Well, there is a library that adds multithreading to Lua, but anyway, a worker thread is not a solution. In a general case we will have a bunch of scripts, each of them is too small to be moved t...
by ptmikheev
07 Nov 2020, 23:52
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 137
Views: 113573

Re: Lua scripting in OpenMW

It might be better for us to make modders deal with it. If you're writing a resource-hungry mod, maybe it should be your responsibility to spin the heavy lifting off into its own worker thread. That way, no one pays the complexity cost unless they're actually causing problems. Lua doesn't support t...
by ptmikheev
07 Nov 2020, 22:31
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 137
Views: 113573

Re: Lua scripting in OpenMW

Multithreading and Lua scripting Let's discuss the question "do we need a separate evaluation thread for lua scripting". Currently scripting (mwscript) works in the same thread as rendering and in most cases doesn't take a lot of time. Why would we want to run lua in a separate thread? Lu...
by ptmikheev
01 Nov 2020, 00:24
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 137
Views: 113573

Re: Lua scripting in OpenMW

Did some benchmarking. It turned out that sol3 has much better performance. Still don't understand how does it work (28K lines of template magic :shock: ), but it is twice faster.
Most probably I'll give up with the idea of custom lua wrapper, but it was worth to try.
by ptmikheev
30 Oct 2020, 15:59
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 137
Views: 113573

Re: Lua scripting in OpenMW

Problem solved... sol2/3 is just a another dep to download, we make sure our build system has access to it in include path, done. https://github.com/ThePhD/sol2/tags There is no need to pull it into /extern The problem is not only in CI builds. It also complicates setting up a development workflow....