Regarding language, I chose Javascript for three reasons:
- the (ab)use of `eval` lets you do all sorts of sorcery, like instant evaluation
- the JS Redux library makes it easy to work with state, and I couldn't have implemented SCRIPT-8's time-traveling debugger without it
- I dream in Javascript
I love Lua's small footprint, and very early on I considered writing SCRIPT-8 in MoonScript, which compiles to Lua and has gorgeous syntax. Maybe some day.
And yes, my fantasy computer is definitely not the only open source project, there's several out there, and probably all of them are more stable than mine. Go check them out.
I know it's no longer considered hip these days, but why not support CoffeeScript?
It's easy to compile to JS on the client-side, so support should be much simpler than Lua or MoonScript. You could steal the trick TIC-80 uses to support MoonScript and say that starting a cassette with the string "use CoffeeScript" marks it as a CS file. Then it's "just" a matter of an if(String.startsWith("use CoffeeScript\n"))-check followed by an intermediate string-to-string compilation step, right?
Apart from https://github.com/usefulthink/coffeescript-from-hell/blob/m..., it takes the worst approach to spaces as syntax, because it doesn't enforce consistency, so with many devs you can end up with a file with two, four spaces, tabs all compiling but easily breaking. It has features their own syntax checker recommend not using, like defining objects without curly braces (which I think shouldn't even be a feature, but it was once so backwards compatibility)
Coffee Script tries to be beautiful without straying too far from Javascript and it ends up being an easily broken mess. I would then recommend either typescript or purescript.
A lot of the cool features others mentioned seem like they would be overkill on a small codebase.
I started working on a bit similar project some years ago (I unfortunately abandonded it...) but I got one thing right: the ability to highlight the erroneous line. See http://write-a-game.herokuapp.com/ and try to call a non-existent function.
https://github.com/raimohanska/write-a-game/blob/8d2111e2372...
And JS is a great choice.
Something similar, in Lua: https://liko-12.github.io/
Others have noted that the use of JS is somewhat of a turn off, but even as a big Lua fan myself, it doesn't really bother me, I already have one (probably more than one) Lua fantasy console that covers my wishes. However, the author's comment here did mention adding MoonScript support, which would be something I would be very interested in.
For people complaining about JS vs Lua : go have a look at Amulet. This is not a fantasy console but also has an online editor and is perfectly suited for retro games. Just have a look at "Defender of the Weeping Quasar" in the example section : http://www.amulet.xyz/editor.html
It only looks a bit ~dusty due to the sepia pallet, should be good to have other choices like a neon hue, and even free custom selection. But hats off here, this is a great resource !
This is so much fun, I did this last year, although initially it only ran inside Unreal Engine. Later on I did a "native" port to Linux. It can run CP/M 2.x and Wordstar (https://i.imgur.com/rIY1he8.png), it had a telnet+VT100+zmodem client for accessing BBS's (https://i.imgur.com/VszSPkB.png), and I even added a graphics mode later on (https://i.imgur.com/t3kreQM.png).
I'm working on a 68000 based one now as well. It's a really great learning experience.
When I get the time I’d love to replicate this in Go (since I’m trying to learn Go at the moment). Nice work!
Lua is a semantically cleaner alternative but it has relatively less mindshare and hence less third-party support.
That's not even remotely true. JS is only a common denominator for running code in a browser, but the lowest common denominator is still C/C++ and Java, even with native applications vs. Electron.
You keep using that word. I do not think it means what you think it means.
Javascript has no 8-bit types, nor does it have memory limits that 8-bit machines had. Pixelated graphics are cool and all, but it does not place you in the same league with people who made games fit in 128 bytes of ram and 2K of ROM, sorry!