Extra Scripting Functions

Feedback on past, current, and future development.
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Extra Scripting Functions

Post by Zini » 26 Apr 2015, 09:29

I only just learned I can do that. I believe I will be somewhat hampered by the inability to use the references to external locals on the right ride of assignments, unless that limitation is not present in OpenMW.
Yes, this limitation is not present in OpenMW.
Specifically I want to optionally disable the skill increase and level up notifications in the game, I'd like to know which is the best way to do that. You are planning to move much of the game logic out of the engine and into scripting? So things like vanilla level up would be scripted and rewriting the system would be a breeze as all the features required to do it would have to already exist.
That sounds like it would be covered by what I am planning and that may indeed involve GMSTs. Not really convinced of using the settings.cfg file here. This will cause all kinds of problems, because these additional settings will be specific to the respective plugin. We could work around that, but I hope we can find a better approach.

Most of the game logic will eventually be moved into scripts. That is a long term plan though. Most likely in 1.1 and 1.2 we will start by tackling easier issues.

Klepto
Posts: 19
Joined: 16 Apr 2015, 03:56

Re: Extra Scripting Functions

Post by Klepto » 29 Apr 2015, 04:05

sjek wrote:
Am I right in thinking that skills and attributes in OpenMW are already uncapped?
there's no problem making handtohand skill 199999 at least.
It seems that SetStat is uncapped, but ModStat isn't. This is a bit of a problem since they do different things and ModStat is the one that is useful for me. I may have to make that change to my fork in the short term, probably by adding new functions rather than modifying the behaviour of ModStat as that would be likely to break existing scripts.
Zini wrote:
I believe I will be somewhat hampered by the inability to use the references to external locals on the right ride of assignments
Yes, this limitation is not present in OpenMW.
I hate to contradict you, but I can't make that work. In the console I can assign values to a script's variables, but I can't read them, at least trying to use them as arguments to messagebox causes an 'Unexpected name' error on the script name. The same happens when I try to read the values in scripts...

Code: Select all

set iLocalVar to MyScript.iVar
I've put everything into one big script, which works fine.
Greywander wrote:(Actually, how difficult would it be to create OpenMW mods using the Morrowind CS? Or how soon will the OpenMW-CS be usable for mod creation?
It's what I'm using, but my needs are very simple, global scripts only. From what I understand it's getting towards the end of alpha.
Greywander wrote:Creating a GCD clone would be a fun and educational experience.
Yes, it is!
Greywander wrote:Does OpenMW remember what specialization (Combat, Magic, or Stealth) and what favored attributes you chose at character creation? Because that would make it much easier to implement a GCD-like system on an existing save file, not to mention other modding possibilities.)
I'm not sure about that, I'm pretty sure it will do sometime after 1.0. I'm planning that feature at some point, but will most likely wait until de-hardcoding has made it easy. There are other more ugly ways of importing existing characters.

In the mean time the levelling mod is mostly working, just a few last features and tidying up. I've removed skill slowdowns and changed the way neglect works to compensate. When a skill over a certain level it automatically delevels over time, and faster the higher it is. At very high skill levels it will become impossible to improve the skill faster than it is delevelling. This should feel more organic. I have the level meter working, kind of. It displays percentage of progress until next level, it never gets to 100% even if there is a level pending, if it did it would trigger vanilla levelup. I have integrated dynamic health and health and magicka regen. Everything is dependant on game time rather than real time, and configurable via the console.

Fun :)

Klepto
Posts: 19
Joined: 16 Apr 2015, 03:56

Re: Extra Scripting Functions

Post by Klepto » 29 Apr 2015, 04:16

Zini wrote:Most of the game logic will eventually be moved into scripts. That is a long term plan though. Most likely in 1.1 and 1.2 we will start by tackling easier issues.
After thinking about the implications of that I'm very much looking forward to it.

User avatar
openmwfan27
Posts: 113
Joined: 23 Apr 2015, 22:11

Re: Extra Scripting Functions

Post by openmwfan27 » 01 May 2015, 08:49

Klepto wrote:
Zini wrote:Most of the game logic will eventually be moved into scripts. That is a long term plan though. Most likely in 1.1 and 1.2 we will start by tackling easier issues.
After thinking about the implications of that I'm very much looking forward to it.
Does this mean the fundamental game mechanics and previously un-moddable areas of the game can be over-ridden by mods? If so this is a feature I am also looking forward to very much 8-)

Tinker
Posts: 231
Joined: 06 Mar 2013, 17:35

Re: Extra Scripting Functions

Post by Tinker » 01 May 2015, 09:45

I believe this will be so. I am looking forward to being able to have mod created skills and abilities counting for level up.
Arch Linux - rolling release, always up to date, often partly broken.

ezze
Posts: 495
Joined: 21 Nov 2013, 13:20

Re: Extra Scripting Functions

Post by ezze » 01 May 2015, 14:00

Zini wrote:Most of the game logic will eventually be moved into scripts. That is a long term plan though. Most likely in 1.1 and 1.2 we will start by tackling easier issues.
Game logic in script? Will it be fast enough? Or by script you mean c++ shared objects like doom3?

SquireNed
Posts: 402
Joined: 21 Dec 2013, 22:18

Re: Extra Scripting Functions

Post by SquireNed » 01 May 2015, 16:42

ezze wrote:
Zini wrote:Most of the game logic will eventually be moved into scripts. That is a long term plan though. Most likely in 1.1 and 1.2 we will start by tackling easier issues.
Game logic in script? Will it be fast enough? Or by script you mean c++ shared objects like doom3?
When I heard this I assumed something like Dungeon Siege, where the core game mechanics are accessible in C-variant scripts that the user can edit.

User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Extra Scripting Functions

Post by Zini » 01 May 2015, 17:41

The standard MW scripting language. Well, our improved version of it. So far our script engine performs pretty well. I haven't heard any complains about it yet (except for the one time when I accidentally made OpenMW create a new VM for every running script once per frame). And currently our script engine isn't even optimized. There is more performance to get, if we really need it.

Golken
Posts: 27
Joined: 04 May 2015, 05:03

Re: Extra Scripting Functions

Post by Golken » 04 May 2015, 10:42

The standard MW scripting language. Well, our improved version of it. So far our script engine performs pretty well. I haven't heard any complains about it yet
Well, I'd say the main complaint is that it's the Morrowind scripting language. I wish this will be reconsidered.
When I first heard of OpenMW, I imagined a Morrowind with a modern engine, as well as more moddability and less hard-coded stuff. The first thing I dreamed of was a modern scripting language, because of the huge amount of freedom and convenience it would bring. And Morrowind's scripting language is anything but modern, or convenient. In fact, IMO it barely qualifies to be called a 'scripting language' at all. It would seem to me that almost anything else would be better, since even JavaScript offers far more powerful capabilities. Morrowind is a complex game and it needs a more complex language.

In my dream, I saw (except the last one, perhaps, these are all basic stuff, but 'MWScript' simply doesn't do those)...
Functions. (God, the notion of considering using a primary language that doesn't even have those...)
Arrays. Potentially linked lists, hash tables or other goodies, but some form of arrays or lists is fundamental.
Hooks. Overrides. Ability to react to game events as they happen, rather than polling for them constantly every frame from every object. Ability to override fundamental game formulas and calculations.
Dynamic, convenient in-game object accessing (referring to items, characters, containers, activators etc).
The full set of elementary programming tools: the conventional looping constructs, operators and built-in functions. Flexible, powerful syntax supporting complex expressions everywhere, with no arbitrary limitations.
Debugging and error-checking.
Object Oriented Programming.
More.

I would recommend not creating a new language, due to time and familiarity (and documentation) constraints. I believe the above can be done via LUA. I think it could be a good choice, though, of course, it isn't the only one. Wikipedia says the following about it:
In video game development, Lua is widely used as a scripting language by game programmers, perhaps due to its perceived easiness to embed, fast execution, and short learning curve.[16]

In 2003, a poll conducted by GameDev.net showed Lua as a most popular scripting language for game programming.[17] On 12 January 2012, Lua was announced as a winner of the Front Line Award 2011 from the magazine Game Developer in the category Programming Tools.[18]
I think that in OpenMW the Morrowind scripting language should be used mostly for legacy purposes (for compatibility with ESMs and ESPs). To this end, if legacy compatibility is important to us, we should also consider supporting MWSE functions. It shouldn't be hard to do. Other extenders might come later, but MWE is much less used and MGE functions might not be relevant.

The Morrowind scripting language is convoluted, quirky, buggy, poorly documented and, as a result of all these, difficult to master and to debug. It requires ugly convoluted workarounds to do too many things, not to mention constant awful "are we there yet" polling-style programming. From a programming perspective, it is very basic and not powerful (limited). It suffers from frankly awful design issues, some of which I've already referred to, including: all scripts period forcibly re-executed anywhere from 30 to 60 to 100+ times per second, the need to attach scripts that poll constantly to in-game objects to do most useful things with them (meaning if you have 100 items loaded in the cell, you're going to have 100 scripts running every frame, even if they're not meant to do anything 99.99% of the frames, and you will also break item stacking, for examples see conventional mods such as Book Rotate and Weapon Rotate), etc.
Thinking up clever and hackish workarounds for those issues is good stuff only when you're forced to succumb to them.

I believe you've said one of the reasons not to implement a scripting language is it would cause divisions in the community. That's a silly reason and possibly not much of a negative at all. There are already certain divisions (vanilla scripting, MWSE, MGE, MCP, MGE), and there will inevitably be a major division of Morrowind and OpenMW; many OpenMW mods will never work with Morrowind, period, at any case. Modders will need to learn to use a new engine and CS as well. And if OpenMW base doesn't include sensible scripting options, then you will have further divisions in OpenMW itself, as multiple forks will be doubtlessly created to address that major deficiency. In the first place, as you have admitted to in this thread, your implementation of 'MWScript' is not even going to be consistent with Morrowind's (it's going to have new features and support new possibilities and syntaxes, even if merely so it's less of a pain to work with). If a good language is included in the main fork, it will be made the primary language and 'MWScript' will be there for legacy purposes only.

Armed with MWSE and a bunch of workarounds, it's true that I can accomplish a lot of things in Morrowind mods. But not in a remotely convenient and certainly not an ideal manner. The truth is that there needs to be division and some new learning when modding OpenMW, for the simple truth that Morrowind modding is very limited, and OpenMW modding would be, in comparison, with huge amounts of freedom. Modders certainly should NOT approach OpenMW scripting with their previously acquired notions of limitations, inefficiency and constant need for outlandish workarounds.

I want to also thank you and all other developers and contributors for your amazing work. The OpenMW project is essentially a godsend to Morrowind modding. 'MWScript' simply isn't up to par with that. Just my opinion. Apologies for the wall of text. ^_^"

User avatar
jirka642
Posts: 117
Joined: 23 Aug 2014, 11:39
Location: Czech Republic
Contact:

Re: Extra Scripting Functions

Post by jirka642 » 04 May 2015, 11:04

Golken wrote:I believe the above can be done via LUA.
If you don't know, there was actually thread about that, and it even produced some basic python and lua functionality.

viewtopic.php?f=6&t=2713&hilit=python

https://wiki.openmw.org/index.php?title ... _Extension
On GitHub as kunesj, on GitLab as kunesj.
OS: Linux Mint 18, CPU: Intel Core i5-3330, RAM: 16GB, GPU: GeForce GTX 650Ti, OpenMW: from source

Post Reply