Author Topic: Can SCI script be modernized into the current age of programming languages?  (Read 790 times)

0 Members and 1 Guest are viewing this topic.

Offline deckarep

Very cool! And yes that makes sense actually that sounds pretty slick actually.

-deckarep

Offline mnicolella

I've long dreamed of getting access to SCI scripts in a modern programming language.

Can you elaborate? What is the end goal here, there are some specific game or system SCI scripts that you really like, but you'd like to be able to use them from another language? I'm pretty sure all of the SCI scripts are readable, either the original Sierra version has been leaked, or the decompilers are good at reconstructing the original code. Which scripts do you want to use elsewhere, it seems like it wouldn't be a hard task to rewrite them in a different language?

...what I don't like is reading an old Small-talk, Lisp style language with a bajillion parenthesis and prefix-notation for expressions. It makes my eyes bleed.

I think it would be pretty easy to take SCI source and convert it to a different style using pretty simple pattern matching. For example, "(+ a b)" turns into "(a + b)" and "(obj x: 12)" turns into "obj.x = 12" or "(obj.x(12))" depending on whether "x" is a property or method...

I guess I don't really see the utility in trying to get an embeddable SCI interpreter to be able to call into SCI scripts. Of course, that's not really a super hard task (I rewrote the SCI interpreter from asm->C++ for The Realm, it was a pretty mechanical process and it resulted in PMachine.cpp being around only 1800 lines of code)

Offline deckarep

This post was more of curiosity post to get some opinions on what others thought about SCI script being transpiled into another language to unlock additional potential of this engine.

In my previous posts I explained in detail my end goal and just proposed some additional possibilities to get some opinions. In my first, I posted example code of SCI transpiled into Python where I migrated to Python's most equivalent language constructs and moved from prefix notation to infix notation.

-deckarep

Offline Kawa

I just remembered I have this.

Offline deckarep

Oh cool @Kawa!

I'm no so off my rocker after all!  ;D

I'm trying to see for Lua how you represented cascade syntax.

Here is so far the best I can do in Python, too bad I can't have colons in identifiers:

gEgo.send(
         egoSpeed_,
         normal_, 0,
         view_, 811,
         setLoop_, 0 if register else 1,
         setCel_, 8,
         setCycle_, End, self
)

Original syntax:

(gEgo
          egoSpeed:
          normal: 0
          view: 811
          loop: (if register 0 else 1)
          cel: 0
          cycleSpeed: 1
          setCycle: End self
)

Latest code: https://gist.github.com/deckarep/a4af4b8b16851e65688a94f445fb1a8e

Also one super cool benefit already is in my private Github repo, now all of this code is easily navigable with Github's powerful indexing abilities and what not. For searching, hopping around it's great!

-Deckarep


Offline Kawa

That's kinda the problem with sends, actually. So instead of trying to wrangle Lua (or Python, or whatever) into allowing something like 'em, I Just Don't.

Code: [Select]
SCI:
(idObject loop: 8, cel: 7, looper: StandAndLook, target: egoObject)
Lua:
idObject.loop = 8
idObject.cel = 7
idObject.looper = StandAndLook
idObject.target = egoObject

Makes it vaguely smell like AGI in a way, which makes sense.

I'm no so off my rocker after all!  ;D
I'm not one to consider myself in any way sane, so you're not out of the henhouse yet.

Offline deckarep

@Kawa regarding sends I agree. On one hand I?d like the code to read as close as possible to the original. On the other hand my solution would have more overhead and goes against the grain of the target language.

I may just resort to taking your approach and calling it a day. We shall see.

Thanks for the feedback and for the reference to your lua approach. I love lua too as the language is small and the vm is brilliantly designed.


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.02 seconds with 19 queries.