intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Jan 19, 2019 5:02 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 15 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sun Nov 11, 2018 10:54 pm 
Offline

Joined: Tue Aug 22, 2017 10:57 am
Posts: 5
I think the TADS3 stuff is running properly now, but I haven't tested extensively.

https://my2iu.itch.io/tads3-interpreter

I also cleaned up the UI a bit so that it isn't completely embarrassing like before.

I tried looking into implementing the WebUI stuff, but that looks iffy because it seems like a lot of the WebUI HTML and JS code is embedded in the game file itself, so it's not possible to get it working by just changing the TADS interpreter. The game files would have to be modified too somehow with updated HTML and JS code.

The project targets WebAssembly. I find that there are too many strange errors when targeting asm.js with Emscripten. Sometimes the code runs on certain browsers and sometimes it doesn't. Plus, the code is so large that it loads really slowly.

SharedArrayBuffers were necessary because JavaScript is event based whereas the TADS code is not. For example, the TADS code will stop in the middle of execution to wait for input. Traditional JavaScript does not allow a thread to receive any form of input until it exits, allowing it to receive an event with the new input. Doing that with TADS would cause the TADS interpreter to exit. SharedArrayBuffers provide new synchronization primitives that allow the TADS WebAssembly code to stop and wait for input in a way that's compatible with the TADS codebase.

Unfortunately, it's unclear what the fate of SharedArrayBuffers is. I think a lot of the SharedArrayBuffer developers are the same as the WebAssembly people. In the end SharedArrayBuffers are not usable directly by WebAssembly, so those browser developers have lost interest in pushing for SharedArrayBuffers and are instead working on something new for WebAssembly instead. That could take 2-3 years.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Nov 11, 2018 11:06 pm 
Offline

Joined: Tue Aug 22, 2017 10:57 am
Posts: 5
Oh, just to clarify. The SharedArrayBuffer stuff was needed for TADS2 because of the design of the TADS2 interpreter. Since I already had everything working for TADS2, getting TADS3 working mostly just involved compiling it. I didn't actually take a close look at the TADS3 code base.

It's possible that the TADS3 interpreter has a design that doesn't require SharedArrayBuffer (notably, an interpreter loop that manages its own stack). TADS2 didn't use that design. The TADS2 interpreter loop interprets subroutines by actually calling a TADS2 function, storing data in the normal program stack, so that design required the use of SharedArrayBuffer.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Nov 12, 2018 12:36 am 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2579
I'm using the Emterpreter, which lets it all run in a single thread, but at a performance hit. It hasn't been too noticeable of a performance hit so far, except for the heaviest Glulx games. I'd expect TADS 2 could cope fine being partially Emterpreted. Not sure about TADS 3.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Nov 12, 2018 12:48 pm 
Offline

Joined: Tue Aug 22, 2017 10:57 am
Posts: 5
I tried using the Emterpreter on TADS2 a couple of years back, and I couldn't get it to work then. The TADS interpreter did different things and corrupted itself when run in the Emterpreter when compared to running as asm.js (TADS in the Emterpreter was interpreting a different set of TADS instructions than what was running in the non-Emterpreter version). Unfortunately, it was too hard for me to figure out how to debug the Emterpreter. It's possible I had a memory bug or something with my modifications to the TADS code, but I think I had made very few changes to the code at that point (just enough to print out some text). So I had to abandon that approach.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Nov 13, 2018 4:42 am 
Offline

Joined: Mon May 10, 2010 7:32 am
Posts: 66
Wow! These are very good news! Will it be possbile then to integrate TADS 2/3 into Lectrote?
If I can test or help out, let me know.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group