The Future of OpenMW Scripting

Everything about development and the OpenMW source code.
Locked
Mishtal
Posts: 12
Joined: 13 Dec 2016, 06:45

Re: The Future of OpenMW Scripting

Post by Mishtal » 22 Jun 2018, 23:23

I don't have much of a dog in this fight, but I've recently been trying to use Lua to make a mod for a completely unrelated game.

It's a freakin nightmare. I'm struggling to understand how anyone could consider Lua to be a legitimate interface for creating mods for games?

If OpenMW ends up going against Zini's original plans, and adopting one of the 3 options detailed in the OP of this thread, why not use C# instead of Lua? The Mono project has been embedded into game engines for a good long while now. And if there's still someone out there that insists on Lua they can add http://www.moonsharp.org/ on top of the C# integration.

User avatar
AnyOldName3
Posts: 1032
Joined: 26 Nov 2015, 03:25

Re: The Future of OpenMW Scripting

Post by AnyOldName3 » 22 Jun 2018, 23:33

Because no-one outside the two of us likes .NET or Mono at all apparently.

More seriously, it's quite a big dependency to add, and Zini isn't keen on a scripting system that lets mod scripts be loaded as bytecode. .NET languages aren't really designed to be run directly from source as the bytecode compiler takes a while to run and adds a bunch of optimisations.
AnyOldName3, Master of Shadows

User avatar
Ace (SWE)
Posts: 794
Joined: 15 Aug 2011, 14:56

Re: The Future of OpenMW Scripting

Post by Ace (SWE) » 23 Jun 2018, 00:22

Lua's not a perfect tool, but the core of it is unmistakeably designed to be an embedded script system, something that's immediately noticeable in the control your application gets over the scripts. Running .Net or Python as scripting is really nice, but it's just as easily noticeable that they're not really designed for such a purpose, as your script integrations feel more like two applications running side-by-side instead of one being the application and the other just a script. In Lua the sandbox only permits what you explicitly expose for it, while both .Net and Python will by default expose everything those languages get, which in some cases can leave scripts with even more access than your game code itself.

I've personally never been much of a fan of embedding Lua into projects just because their integration interfaces are a bit annoying to work with, you have to do much more manual work than strictly necessary to set up the bindings against your code and types, but on the other hand the result tends to be rather robust. Usually my go-to for wanting to add scripting to something has been AngelScript as the integration of that can be as simple as a single method call against your already existing code, though the standard libs are much less well developed - read basically nonexistant - on there, and the strictness of the language seems to put people off of it.

NullCascade
Posts: 97
Joined: 16 Jan 2012, 07:58
Github profile: https://github.com/NullCascade/

Re: The Future of OpenMW Scripting

Post by NullCascade » 23 Jun 2018, 02:52

Ace (SWE) wrote:
23 Jun 2018, 00:22
I've personally never been much of a fan of embedding Lua into projects just because their integration interfaces are a bit annoying to work with, you have to do much more manual work than strictly necessary to set up the bindings against your code and types, but on the other hand the result tends to be rather robust.
I've been in love with sol2, using it for binding MWSE data types to Lua. It was always annoying to manage the Lua stack at my last job, and sol2 is just... mmh. So good. It comes at the cost of compile times and binary size (it leverages the hell out of templating), but it's absolutely worth it IMO. sol3 is on around the corner and from some of the presentations the author has done at some C++ conventions it's going to help solve these issues. Can't recommend it enough. Has cut out hours and hours of tedious work and debugging.

And yeah. I'd kind of prefer .NET day-to-day, but it's all about the right tool for the job. I just don't think that C# is the right tool for that job if OpenMW wants sandboxing. That said, we did put C# scripts as an alternative scripting language in Neverwinter Nights 2 and it was great. It can certainly be done, it's just sort of not the ideal fit.
MWSE 2.x lead.

User avatar
psi29a
Posts: 4077
Joined: 29 Sep 2011, 10:13
Github profile: https://github.com/psi29a/
Contact:

Re: The Future of OpenMW Scripting

Post by psi29a » 23 Jun 2018, 07:26

Speaking of NWN: https://github.com/xoreos/xoreos - A reimplementation of BioWare's Aurora engine (and derivatives)

They also use Lua and target the following:
Neverwinter Nights
Neverwinter Nights 2
Knights of the Old Republic
Knights of the Old Republic II: The Sith Lords
Jade Empire
Sonic Chronicles: The Dark Brotherhood
The Witcher
Dragon Age: Origins
Dragon Age II
They have done a tremendous amount of work and have been at it as long like OpenMW. They went breadth first while OpenMW focused on one game in particular and it shows (still foundational) but they are doing brilliant work none-the-less. Thought I would toss this in here since they too use Lua.

raven
Posts: 65
Joined: 26 May 2016, 09:54

Re: The Future of OpenMW Scripting

Post by raven » 23 Jun 2018, 09:16

They also use Lua and target the following:
Afaik The Witcher requires Lua. The others run nwscript.

Eli2
Posts: 51
Joined: 27 Nov 2011, 08:23

Re: The Future of OpenMW Scripting

Post by Eli2 » 23 Jun 2018, 13:30

Just to get this straight.
Zini would have donated one week full time to the project.
Lets see what the lua crowd brings to the table.

User avatar
Shnatsel
Posts: 64
Joined: 31 Oct 2014, 01:06
Location: Moscow
Contact:

Re: The Future of OpenMW Scripting

Post by Shnatsel » 25 Jun 2018, 07:53

Mishtal wrote:
22 Jun 2018, 23:23
It's a freakin nightmare. I'm struggling to understand how anyone could consider Lua to be a legitimate interface for creating mods for games?
Could you describe specific issues you were having with it, so that OpenMW could make a more informed decision?

Muehe
Posts: 1
Joined: 26 Jun 2018, 19:40
Github profile: https://github.com/Muehe

Re: The Future of OpenMW Scripting

Post by Muehe » 26 Jun 2018, 20:56

Hello everybody. As this is my first message on this forum I wanted to say, thank you for this project!

But back to topic. I am following and contributing to some nostalgia driven re-implementation projects and have some experience with Lua as a scripting language for games, so I thought I might add my 2¢, although I have no idea about MW scripting.

My experience is mainly with WoW-addons, which are based on a very limited subset of Lua for security reasons. For example you have no access to the file system or the internet. The only way to save data for the addons is to save it to pre-registered Lua variables at runtime, which get saved to a certain file when the game closes. Most of the things they can do are related to the UI and information about the game state, which are exposed through an API. This would of course not be acceptable for many mods (like the sky-mod already mentioned in this thread, which loads new textures from the internet), but in the context of the multiplayer version it might prove necessary due to security considerations, which have also already been voiced here. To remedy this, you could check mods when they are loaded and classify them as safe/unsafe based on the subset of Lua they use. Then users could be made aware of loading a potentially dangerous mod and they could be generally disallowed for multiplayer games. If the decision comes down to "some mods don't work" or "every mod can run arbitrary code", I would be partial to the former. But in my mind informed consent should be possible for users when they really "need" this one shiny mod.

I am not actually that fond of Lua, it sure has some quirks, like arrays starting with 1 and whatnot. But on the other hand it is reasonably easy for beginners, unless you are trying to do OOP. My main point is that WoW has many of the same problems any game, especially a multiplayer game, would have with a scripting language already solved with Lua and, independently of OpenMW choosing it as the newscript language, it might be worth taking a look at the solutions they came up with. Like putting all mods in a dedicated folder, instead of cramping them together in one, overwriting files and whatnot. :lol:

I hope this is useful to someone. Anyway, I am excited to see where this discussion goes.

User avatar
Thunderforge
Posts: 477
Joined: 06 Jun 2017, 05:57
Github profile: https://github.com/Thunderforge

Re: The Future of OpenMW Scripting

Post by Thunderforge » 27 Jun 2018, 23:50

Welcome Muehe! We're glad to have you! It's really nice to find someone who has worked in Lua on a game engine, and we hope you'll stick around because that sort of experience will be extremely valuable!

One advantage that OpenMW has over World of Warcraft is that we have full control over the source code, so we can make whatever sort of modifications we like to support mods.

Locked

Who is online

Users browsing this forum: No registered users and 3 guests