Search found 42 matches

by ptmikheev
21 Nov 2020, 16:49
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 69
Views: 6068

Re: Lua scripting in OpenMW

by ptmikheev
20 Nov 2020, 01:25
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 69
Views: 6068

Re: Lua scripting in OpenMW

cc9cii wrote:
16 Nov 2020, 06:18
EDIT: would you have an example of a global script?
Sorry for delay with the answer. Still thinking how the API should look like. On the weekend I'll write an example with both local and global scripts.
by ptmikheev
16 Nov 2020, 03:12
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 69
Views: 6068

Re: Lua scripting in OpenMW

I'm intrigued by this - would you mind adding some commentary on each bullet point to explain the thought behind them? Is this geared towards multiplayer setup? My aim is to develop a universal scripting system that will be convenient for both singleplayer and multiplayer. Also it should allow to d...
by ptmikheev
15 Nov 2020, 20:08
Forum: General Development
Topic: Lua scripting in OpenMW
Replies: 69
Views: 6068

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: 69
Views: 6068

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: 69
Views: 6068

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: 69
Views: 6068

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: 69
Views: 6068

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: 69
Views: 6068

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: 69
Views: 6068

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...