Elder-scrolls IV Oblivion

Feedback on past, current, and future development.
1Zero
Posts: 31
Joined: 09 Feb 2020, 18:44

Re: Elder-scrolls IV Oblivion

Post by 1Zero » 15 Feb 2020, 21:03

Hello,

Yesterday, I started reimplementing the Oblivion scripting engine. Thus far I made the Lexer by defining its rules and let Flex generate it.
https://github.com/1-Zer0/openob

It's able to generate the Tokens (Lexem, Type) of an Oblivion script.

I am going to work on it occasionally, mostly on weekends, repo contains a roadmap.

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

Re: Elder-scrolls IV Oblivion

Post by AnyOldName3 » 15 Feb 2020, 23:08

The thing we'll need here is something that transpiles OBScript into OpenMW-Lua, and OpenMW-Lua doesn't exist yet. We don't want to be stuck maintaining eight scripting engines.
AnyOldName3, Master of Shadows

1Zero
Posts: 31
Joined: 09 Feb 2020, 18:44

Re: Elder-scrolls IV Oblivion

Post by 1Zero » 15 Feb 2020, 23:24

AnyOldName3 wrote:
15 Feb 2020, 23:08
The thing we'll need here is something that transpiles OBScript into OpenMW-Lua, and OpenMW-Lua doesn't exist yet. We don't want to be stuck maintaining eight scripting engines.
You can from the AST of an Oblivion script generate code for the LUA VM if the team prefers to use that. It might be a bit hackery and could turn out to be more of a hassle than using a custom VM optimized for the game, but it's easier to maintain. If that's the consensus of the forum, so shall it be, for Oblivion.
Either way, there needs to be a front end to create an AST from a Oblivion Script, no matter the backend. Means writing a Bison module with the Oblivion scripting formal grammar.

davidcernat
Posts: 225
Joined: 19 Jul 2016, 01:02

Re: Elder-scrolls IV Oblivion

Post by davidcernat » 16 Feb 2020, 06:03

cc9cii wrote:
15 Feb 2020, 08:03
Also, I've pushed the code to read the ESM/ESP files a long time ago and as far as I know nobody has made any use of that - even though that code has far less dependencies than the NIF related code. So I don't know if there is any real urgency.
I did personally make an attempt at updating your ESM-reading code to the latest OpenMW, but – lacking the other half of the code – I did not really have the ability to see it working as intended and to determine what I was doing wrong.

I guess I can give it another try, if no one else does.

User avatar
psi29a
Posts: 4798
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Elder-scrolls IV Oblivion

Post by psi29a » 17 Feb 2020, 09:49

1Zero wrote:
15 Feb 2020, 23:24
AnyOldName3 wrote:
15 Feb 2020, 23:08
The thing we'll need here is something that transpiles OBScript into OpenMW-Lua, and OpenMW-Lua doesn't exist yet. We don't want to be stuck maintaining eight scripting engines.
You can from the AST of an Oblivion script generate code for the LUA VM if the team prefers to use that. It might be a bit hackery and could turn out to be more of a hassle than using a custom VM optimized for the game, but it's easier to maintain. If that's the consensus of the forum, so shall it be, for Oblivion.
Either way, there needs to be a front end to create an AST from a Oblivion Script, no matter the backend. Means writing a Bison module with the Oblivion scripting formal grammar.
The eventual goal is to also do this with mwscript as well, that way the core engine's scripting language is Lua and we support mapping mwscript, obscript (and etc.) calls to the Lua-VM equivalents. This also makes clear which mods are for Morrowind and which mods are for OpenMW specifically.

OpenMW-Lua exists but currently only in TES3MP, the idea here is to get both forks using the same Lua.

1Zero
Posts: 31
Joined: 09 Feb 2020, 18:44

Re: Elder-scrolls IV Oblivion

Post by 1Zero » 18 Feb 2020, 14:25

psi29a wrote:
17 Feb 2020, 09:49
1Zero wrote:
15 Feb 2020, 23:24
AnyOldName3 wrote:
15 Feb 2020, 23:08
The thing we'll need here is something that transpiles OBScript into OpenMW-Lua, and OpenMW-Lua doesn't exist yet. We don't want to be stuck maintaining eight scripting engines.
You can from the AST of an Oblivion script generate code for the LUA VM if the team prefers to use that. It might be a bit hackery and could turn out to be more of a hassle than using a custom VM optimized for the game, but it's easier to maintain. If that's the consensus of the forum, so shall it be, for Oblivion.
Either way, there needs to be a front end to create an AST from a Oblivion Script, no matter the backend. Means writing a Bison module with the Oblivion scripting formal grammar.
The eventual goal is to also do this with mwscript as well, that way the core engine's scripting language is Lua and we support mapping mwscript, obscript (and etc.) calls to the Lua-VM equivalents. This also makes clear which mods are for Morrowind and which mods are for OpenMW specifically.

OpenMW-Lua exists but currently only in TES3MP, the idea here is to get both forks using the same Lua.
I am not perfectly familiar with LUA currently but can manage to understand the language in time.
If I get the current plan it should look as follows

Morrowind Vanilla -----\
| ---------------> Lua Morrowind Virtual Machine
Lua- Morrowind --------/

With the Vanilla Vanilla Morrowind Script and Lua Morrowind scripts all being compiled to run on the Lua Morrowind Virtual Machine

and

Oblivion Vanilla--------\
| ---------------> Lua Oblivion Virtual Machine
Lua- Oblivion-----------/

As both games have different Opcodes for their instruction (I presume at least, I don't really know Morrowind's bytecode and the game in general all too well) and as such require adapted Lua Virtual Machines

User avatar
psi29a
Posts: 4798
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: Elder-scrolls IV Oblivion

Post by psi29a » 18 Feb 2020, 15:13

Yeah, the target is OpenMW in that OpenMW exposes an API in Lua that developers can use. One layer of abstraction is that anything calling mwscript or obscript function/method/variable then maps to an equivalent OpenMW's Lua.

1Zero
Posts: 31
Joined: 09 Feb 2020, 18:44

Re: Elder-scrolls IV Oblivion

Post by 1Zero » 18 Feb 2020, 20:54

psi29a wrote:
18 Feb 2020, 15:13
Yeah, the target is OpenMW in that OpenMW exposes an API in Lua that developers can use. One layer of abstraction is that anything calling mwscript or obscript function/method/variable then maps to an equivalent OpenMW's Lua.
The abstraction layer for Morrowind already exists for MorrowindMP?

1Zero
Posts: 31
Joined: 09 Feb 2020, 18:44

Re: Elder-scrolls IV Oblivion

Post by 1Zero » 20 Feb 2020, 02:46

I need to comprehend a few things about the architecture, I could go through the code the next few hours but I suppose it's more efficient to just ask

I see that those are the main modules that need to be adapted for the LUA VM

https://github.com/OpenMW/openmw/tree/m ... nterpreter
https://github.com/OpenMW/openmw/tree/m ... w/mwscript
https://github.com/OpenMW/openmw/tree/m ... s/compiler

OpenMW appears to not have changed any of those, but instead has its own:

https://github.com/TES3MP/openmw-tes3mp ... -mp/Script

So OpenMW MP is currently still using the "vanilla" scripting engine for the client side script processing
but LUA for the Server side script processing?

ponyrider0
Posts: 7
Joined: 11 Jun 2019, 23:53

Re: Elder-scrolls IV Oblivion

Post by ponyrider0 » 25 Feb 2020, 06:07

Very cool progress on an Oblivion interpreter. I'll try to finish moving my TES3-to-TES4 transpiler into standalone translator and compiler as soon as I can. The TES3 translator is still incomplete, but the TES4 byte compiler has been near complete and working very well in my production tool chains for a couple years now. I've also gotten it to properly compile a small subset of OBSE instructions too.

https://github.com/ponyrider0/openmw

Post Reply