Jump to content




Mimic - ComputerCraft Web Emulator (HTML5)



196 replies to this topic

#1 1lann

  • Members
  • 516 posts
  • LocationSeattle

Posted 25 February 2014 - 07:48 AM

Mimic Web Emulator

Version 1.0


Hi

So full release of Mimic, GravityScore's and my web emulator written in JavaScript using HTML5 :D

Use it here!

Features
  • Full ComputerCraft emulator in your web browser
  • CC 1.63 support
  • Mobile (iOS and Android) support
  • Edit files easily in browser using Ace (stripped out version of Sublime Text in JS)
  • Persistent filesystem
  • Save screenshots
  • Download files
  • Startup scripts! Demo your own CC programs to others through just one click! Let Mimic load your program from Pastebin and run it automatically
  • Auto save while editing files
  • Pasting support
  • Control T, S, and R, as well as corresponding buttons
  • Fullscreen mode
  • Hierarchical, collapsable file sidebar
Things that Don't Work
  • Startup scripts can't use the shell API yet
  • Screenshots seem to capture past images of the terminal
  • Files sometimes destroy empty lines at the end of them
  • Files download multiple times when clicking the download button
  • The drop down menu moves behind the computer depending on the screen size
  • http.post doesn't work at all
  • Redstone API isn't implemented
  • No storage size limit
  • Haven't tested on Android yet, only iOS :)
  • Oh I broke pasting just then...
Screenshots

Posted Image

Spoiler

Spoiler

Spoiler


Link

Here!

Edited by 1lann, 07 June 2014 - 09:11 PM.


#2 gamax92

  • Members
  • 157 posts

Posted 25 February 2014 - 10:03 AM

I think the concept is a great idea. A web emulator prevents the problems caused by having to install software, since some environments don't allow you to. It's also a quick way to go test something in CC and for me, runs faster than real CC.

I'll just put a list of problems, please don't feel overwhelmed, its just things I've ran into before with my own emulator.
The ones with a * are kinda just "It doesn't matter if you fix this or not."
Spoiler

Edited by gamax92, 25 February 2014 - 10:05 AM.


#3 awsmazinggenius

  • Members
  • 930 posts
  • LocationCanada

Posted 25 February 2014 - 10:07 AM

I like the concept of an in-browser CC emulator. Maybe, just maybe, it will work with iPad Air + Chrome App.

Note that I would have the first post if my WiFi signal wasn't cut off by me microwaving something :/

EDIT: Lua instead of LuaJ?

Edited by awsmazinggenius, 25 February 2014 - 10:07 AM.


#4 Alice

  • Members
  • 429 posts
  • LocationBehind you.

Posted 25 February 2014 - 10:20 AM

lua.vm.js by Kripken? Just a guess c:

#5 gamax92

  • Members
  • 157 posts

Posted 25 February 2014 - 10:42 AM

Lua instead of LuaJ, because This is JavaScript, and LuaJ is for Java.

#6 LDShadowLord

  • Members
  • 115 posts

Posted 25 February 2014 - 10:45 AM

My only complaint is that when I type on it (I use a UK keyboard...because i'm from the UK...) it defaults to the US keyboard so instead of typing Shift+2 for " I have to type Shift+# for ". Which is kinda irritating, any way to put in localisation? Or detect what keyboard is being used or something? Other than than, great job :)

#7 1lann

  • Members
  • 516 posts
  • LocationSeattle

Posted 25 February 2014 - 11:12 AM

View Postgamax92, on 25 February 2014 - 10:03 AM, said:

- snip -
Thanks a ton for posting all of those problems :), strange though that the debug API is there, I didn't think it was existent since it was unavailable to the JS ( C ) API since it was not implemented by the developer of the Lua engine I'm using. Perhaps I could use that from lua to do "too long without yielding" (Like the way you did it in CCLite?), I'll figure it out sometime. Thanks.

View PostLDShadowLord, on 25 February 2014 - 10:45 AM, said:

My only complaint is that when I type on it (I use a UK keyboard...because i'm from the UK...) it defaults to the US keyboard so instead of typing Shift+2 for " I have to type Shift+# for ". Which is kinda irritating, any way to put in localisation? Or detect what keyboard is being used or something? Other than than, great job :)
We actually handle conversion of JS event key codes into CC, so we could add a UK keyboard mapping, and add a locale switcher in the UI for people using a UK keyboard.

Also it does run on Android (Tested on Chrome on a Nexus 5, but you can't use keyboard inputs), so I'm sure it can run on Chrome on an iOS device, though I don't have one to test on.

Also for those wondering, the Lua engine I'm using is this: https://github.com/l...-com/lua5.1.js/

Edited by 1lann, 25 February 2014 - 11:13 AM.


#8 6677

  • Members
  • 197 posts
  • LocationCambridgeshire, England

Posted 25 February 2014 - 04:01 PM

View Post1lann, on 25 February 2014 - 11:12 AM, said:


Also it does run on Android (Tested on Chrome on a Nexus 5, but you can't use keyboard inputs), so I'm sure it can run on Chrome on an iOS device, though I don't have one to test on.
Chrome on iOS is simply a wrapper around iOS safari. Apple disallowed 3rd party render engines somewhat inexplicably.

On the plus side, I decided to see what happens when you use internet explorer 11 on windows 8.1 simply because you said IE was unsupported. It seemed to work and then internet explorer intercepted my pressing of the backspace key as a cue to go back to my homepage.
I normally use chrome, but I personally find that IE10 and 11 dont deserve the poor rep IE has gained over the years, chrome is still better but they are at least serviceable browsers now.

#9 amtra5

  • Members
  • 166 posts
  • LocationMelbourne, Australia

Posted 26 February 2014 - 05:42 AM

Damn, beat me to it :P

Good work though.

Also, this could be the very first truly cross platform emulator...

#10 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 26 February 2014 - 05:53 AM

How does this differ from GravityScore's standalone(ish) version?

https://github.com/GravityScore/Mimic

GravityScore's has pretty much everything implemented, why the change?

Anyway, it's really nice to be able use it in browser, although I'd recommend releasing a standalone version (you could just make a Java WebKit viewer).

Also, for me the text in white is a little blurry, but error messages are fine.
Posted Image
Using OS X 10.9, Chrome 33

#11 awsmazinggenius

  • Members
  • 930 posts
  • LocationCanada

Posted 26 February 2014 - 05:59 AM

View Postgamax92, on 25 February 2014 - 10:42 AM, said:

Lua instead of LuaJ, because This is JavaScript, and LuaJ is for Java.
I realize that, but LuaJ is kinda what CC uses, so I thought me might as well use that (link with CC.jar to get it, or though some other way.)

#12 1lann

  • Members
  • 516 posts
  • LocationSeattle

Posted 26 February 2014 - 07:45 AM

View Postoeed, on 26 February 2014 - 05:53 AM, said:

How does this differ from GravityScore's standalone(ish) version?
https://github.com/GravityScore/Mimic
GravityScore's has pretty much everything implemented, why the change?

Anyway, it's really nice to be able use it in browser, although I'd recommend releasing a standalone version (you could just make a Java WebKit viewer).
Also, for me the text in white is a little blurry, but error messages are fine.

GravityScore's used Node-Webkit, a standalone implementation of Node.js and Chrome (basically). Gravs used Node.js libraries, including one that allowed him to run Java from it, which is how he did his emulator, through Java. Whereas mine can run straight in the browser with JavaScript. They're 2 completely different approaches in fact. I have to re-write the entire mod from scratch, whereas Gravs doesn't. Also it's blurry because I cannot disable anti-aliasing of fonts for canvases. The color red is actually in fact anti-aliased, its just that it's so close to the color black you don't notice it. I set the font size to a size that reduces the anti-aliasing effect as much as possible. Grav's version did not have this problem, as he used images instead of a font to display on the canvas, which can have anti-aliasing disabled when drawing.

Also Node-Webkit is a standalone website (Chrome renderer) viewer. So I can just use that as a standalone version.

View Postawsmazinggenius, on 26 February 2014 - 05:59 AM, said:

I realize that, but LuaJ is kinda what CC uses, so I thought me might as well use that (link with CC.jar to get it, or though some other way.)
You can't run a full programming language that runs in a VM, within a scripting language... I'm actually re-writing the entire mod from scratch. The point being with pure JS, is that it requires no libraries/additional things installed, and can be ran on mobile devices.

Edited by 1lann, 26 February 2014 - 07:46 AM.


#13 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 26 February 2014 - 07:48 AM

Just to clarify, my JS emulator started a separate Java process and communicated with it through std in/out.

#14 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 26 February 2014 - 08:19 AM

View Post1lann, on 26 February 2014 - 07:45 AM, said:

View Postoeed, on 26 February 2014 - 05:53 AM, said:

How does this differ from GravityScore's standalone(ish) version?
https://github.com/GravityScore/Mimic
GravityScore's has pretty much everything implemented, why the change?

Anyway, it's really nice to be able use it in browser, although I'd recommend releasing a standalone version (you could just make a Java WebKit viewer).
Also, for me the text in white is a little blurry, but error messages are fine.

GravityScore's used Node-Webkit, a standalone implementation of Node.js and Chrome (basically). Gravs used Node.js libraries, including one that allowed him to run Java from it, which is how he did his emulator, through Java. Whereas mine can run straight in the browser with JavaScript. They're 2 completely different approaches in fact. I have to re-write the entire mod from scratch, whereas Gravs doesn't. Also it's blurry because I cannot disable anti-aliasing of fonts for canvases. The color red is actually in fact anti-aliased, its just that it's so close to the color black you don't notice it. I set the font size to a size that reduces the anti-aliasing effect as much as possible. Grav's version did not have this problem, as he used images instead of a font to display on the canvas, which can have anti-aliasing disabled when drawing.

Also Node-Webkit is a standalone website (Chrome renderer) viewer. So I can just use that as a standalone version.

View Postawsmazinggenius, on 26 February 2014 - 05:59 AM, said:

I realize that, but LuaJ is kinda what CC uses, so I thought me might as well use that (link with CC.jar to get it, or though some other way.)
You can't run a full programming language that runs in a VM, within a scripting language... I'm actually re-writing the entire mod from scratch. The point being with pure JS, is that it requires no libraries/additional things installed, and can be ran on mobile devices.

Oh, I see. So apart from the name they're basically completely different.

#15 1lann

  • Members
  • 516 posts
  • LocationSeattle

Posted 26 February 2014 - 10:48 AM

View Postoeed, on 26 February 2014 - 08:19 AM, said:

Oh, I see. So apart from the name they're basically completely different.
Yep, in like every way. Gravs used a ComputerCraft.jar file and his own rendering system, whereas I made a different rendering system and had to re-write all of the core functions in ComputerCraft. I originally named mine WebCC, but Gravs just wanted to keep the name Mimic on a product, so we renamed it to that. His version (http://github.com/GravityScore/Mimic) is no longer being developed.

Edited by 1lann, 26 February 2014 - 10:48 AM.


#16 Ir7_o

  • New Members
  • 1 posts

Posted 27 February 2014 - 12:51 PM

Very cool but a major risk of cross site scripting?

#17 Shazz

  • Members
  • 175 posts

Posted 27 February 2014 - 10:58 PM

View PostIr7_o, on 27 February 2014 - 12:51 PM, said:

Very cool but a major risk of cross site scripting?

All the code is executed within a Lua VM. As long as the 'native' APIs (term, fs, etc.) are coded properly then it's fine. Also, there is really nothing damaging that you can achieve with cross site scripting in this case.

#18 1lann

  • Members
  • 516 posts
  • LocationSeattle

Posted 27 February 2014 - 11:32 PM

View PostIr7_o, on 27 February 2014 - 12:51 PM, said:

Very cool but a major risk of cross site scripting?
All the code is running on your computer... Nothing is submitted to the server, it's all static. The only thing you can achieve with "cross-site scripting" in this case is hacking your own computer...

#19 MostwantedRBX

  • Members
  • 29 posts
  • LocationWell. I suppose between here and there.

Posted 19 March 2014 - 10:48 PM

Works very well, even without the other APIs. One thing that annoys me: There is no cursor movement functionality, but that isn't needed really in a Lua prompt. However, I think it'd be a great if you added the up arrow on the keyboard to access previously submitted code, just an idea. I think you are on the right track, though. Great job!

#20 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 19 March 2014 - 11:01 PM

I am extremely excited by this. I'll be checking up on your progress :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users