The Future of OpenMW Scripting

Everything about development and the OpenMW source code.
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: The Future of OpenMW Scripting

Post by raevol »

Just to add my voice to the fray, I wrote piles of Lua at one point years ago, and I loved it to pieces. Yes, it was missing OOP features once I started getting to a project of a certain size, but for what I used it for it was amazing. Just because something is different doesn't mean it's bad.

I've noticed programmers tend to hate on whatever they're not familiar with. Everyone needs to remember that programming languages are tools, and you need to pick the right tool for the task. Just because you don't know a language, or don't know how to use a language right, doesn't mean it is bad.
User avatar
psi29a
Posts: 5355
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: The Future of OpenMW Scripting

Post by psi29a »

Not to start a flame war (or well? :twisted: ) but really that is the _key_ difference between types of engineers and programmers.

People who stick to one language because they are familiar with it are pretty much one-trick ponies... that's fine. But once you realize that the same algorithms and design 'patterns' can be used across languages regardless of them being more directed towards OO, Functional, Contract, Event-Driven... then all of that falls away.

Being multi-lingual is a plus in my opinion... except for Java, please let it die. ;)

Right tool for the right job still holds true, if you're going OO for a project, then don't use a Functional language.

Lua... same thing. We need to provide an API that modders can use. If they need more power, then perhaps a PR/MR to OpenMW proper is necessary instead of cramming tons of logic into your mod. OpenMW allows that where as other pay-for game-engines do not.

To clarify, I mean games... as some game-engines are available online with full source access and in theory you can send a PR/MR to them. That doesn't mean that your game that uses that game-engine will get that feature. OpenMW gives you access to the whole stack no strings attached.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: The Future of OpenMW Scripting

Post by Zini »

Here is a small update on the situation:

I recently released the post-1.0 design document to the public. This document will be the basis for the development of newscript. Which features we are going to support post-1.0 will influence newscript heavily. Also, all the functionality covered in oldscript+ (as described in the document) needs to be present in newscript.

Since I only just released the document, it will need more time to collect feedback and to mature. Therefore we can not get started on newscript yet.

I envision the following roadmap for newscript development:

Step 1: An early design phase where we hash out the core features and how we want to integrate newscript into OpenMW. I will take the lead on this, but I hope for some heavy consulting; preferably from people who already have experience with integrating Lua as a scripting language.

Step 2: We work out the details (commonly referred as API in this and other discussion threads). This should be straight forward and the task could easily wait until we are ready to start with the implementation. However since there is demand to get the API specified early we can as will get going immediately after step 1 is completed. I am happy to let someone else take the lead on this, with me only doing a bit of consulting and sanity-checking.

Step 3: The implementation. Still a post 1.0 task. But we need newscript ready before we can begin development of 1.1 (a.k.a. post-1.0). Therefore it is advisable to get a head start on this. Maybe not immediately after completion of step 2, but definitely before 1.0 is released. The code for new script can go into a separate feature branch that we merge into master after the 1.0 release.

Regarding the choice of newscript language: I had a look at Lua and I am not impressed. IMO the only things it has going for it is its simplicity and its sandboxing-abilities (admittedly two large benefits). Apart from that Lua looks kinda ugly, barely better than oldscript (plus the missing functionality, obviously).

Still, there seems to be a consensus for Lua (for the most part) and I don't see anyone bringing forth viable alternatives. But feel free to keep the discussion going. I don't expect anything to come from it, but we only have to make a final decision when we enter step 1. Maybe the discussion does result in something useful and we get a pleasant surprise.
nwah
Posts: 45
Joined: 21 Nov 2013, 07:40

Re: The Future of OpenMW Scripting

Post by nwah »

C# is actually free and open source these days, and an ISO standard. Unity uses C# for scripting. I find it to be an elegant language, with wide support, and great performance.

Other possibilities would be Julia or javascript.

Javascript obviously has tons of coders, and a large number of libraries. But lacking in elegance.

Julia seems interesting. It doesn't seem used much for game engines, but seems like it could have a lot of potential.
raven
Posts: 66
Joined: 26 May 2016, 09:54

Re: The Future of OpenMW Scripting

Post by raven »

Still, there seems to be a consensus for Lua (for the most part) and I don't see anyone bringing forth viable alternatives.
Well, Lua is lightweight and fast for a scripting language, making it somewhat popular.

As for alternatives:

There is Squirrel, which is also pretty lightweight but is closer to C++ syntax-wise. I think Valve Source engine uses it.
http://www.squirrel-lang.org/

There is also Lua inspired GameMonkey Script, very lightweight, C style syntax.
https://github.com/publicrepo/gmscript
User avatar
Ace (SWE)
Posts: 887
Joined: 15 Aug 2011, 14:56

Re: The Future of OpenMW Scripting

Post by Ace (SWE) »

It is possible to embed a JavaScript engine as well, I've seen that used in at least two projects before. Personally not going to vouch for that solution though.

But hey, if alternatives are wanted I'm again going to suggest AngelScript - http://www.angelcode.com/angelscript

It's not quite as well known or used as Lua, but it's been successfully implemented in quite a lot of games over the years, from Wolfire's Overgrowth, to Frictional's games (Penumbra, Amnesia, SOMA), Blind Mind Studios (Star Control), and a whole heap more. Blind Mind have even written a JIT compiler implementation for it, though it seems to not have been updated for the current WIP version of AngelScript.

Syntax is close to C++, it uses static typing, and has an amazing interface for binding things to the script VM.
And it's zlib licensed, so it's compatible with GPL.
Eli2
Posts: 52
Joined: 27 Nov 2011, 08:23

Re: The Future of OpenMW Scripting

Post by Eli2 »

The more i read about AngelScript, the more i like it.
There is even support for writing a nice debugger.
http://www.angelcode.com/angelscript/sd ... ugger.html

Edit:
AngelScript should be seriously looked at, it might fit better than lua.
User avatar
AnyOldName3
Posts: 2666
Joined: 26 Nov 2015, 03:25

Re: The Future of OpenMW Scripting

Post by AnyOldName3 »

If we have JavaScript and it's not because we use something like .NET which supports a zillion languages, I'll be very upset. I am not a fan of JavaScript at all.

AngelScript seems to fail my "Google 'how to sort list' and see how far away something that a complete idiot could copy and paste is' test. The first page seems to be mostly official documentation, but I don't know if the dumbest person who'd want to make a mod could figure out that they're meant to look within the page. There seems to be a pretty good guide on getting used to the basics written for SOMA, though.

Basically, from the little I've seen, I don't think I have any complaints about the language itself, but I'm not sure how easily someone with no programming skill or experience could do something which wasn't completely trivial. For C++ and Python, you can google how to do pretty much anything and find an example implementation which can be copied and pasted, even if it's a stupid implementation. Lua has more of this than AngelScript, but also has more weirdnesses like arrays starting at one.

I have no attachment to Lua, but it's a reasonable thing to use to benchmark other candidates against as it's something we know we could use and has no particular disadvantages compared to MWScript.
User avatar
Ace (SWE)
Posts: 887
Joined: 15 Aug 2011, 14:56

Re: The Future of OpenMW Scripting

Post by Ace (SWE) »

The issue with AngelScript is that the only truly built-in types are numeric, everything else is an optional add-on. So the list type depends entirely on what you make it.
For instance, the officially supplied script extension for an array type is documented on http://www.angelcode.com/angelscript/sd ... rrays.html - but nothing requires you to use it, you can implement your own array type if you want. Just like you can implement your own string type or use the officially supplied add-on.

The documentation - while very well written and thorough - is more focused towards the developer rather than the user, so using it for OpenMW would probably involve writing our own set of docs to help modders.
User avatar
wareya
Posts: 338
Joined: 09 May 2015, 13:07

Re: The Future of OpenMW Scripting

Post by wareya »

No matter what scripting language openmw uses openmw is going to have to write a lot of documentation for it.

Unless you pick, like, python or javascript, which would be a terrible idea.

It's better to think of embeddable scripting languages as tools with which to implement your own programming environment.
Locked