One thing I’ve been working on for a little while now is revamping CC: Tweaked documentation situation. As part of that, I had the fantastic idea of “could we run CC: Tweaked in the browser?”, allowing people to run code samples with a click of a button.
Now, at the time, I wasn’t aware of EveryOS’s fantastic Mimic fork, and so I did the only thing logical and went on a long yak shaving expedition. The result of this is copy-cat, a ComputerCraft emulator which runs in your browser.
As it’s original aim was to be used for documentation, it aims to be as accurate and up-to-date as possible. In order to achieve this, copy-cat is built from a modified version of CC: Tweaked’s source code - both the Lua VM and Java APIs behave exactly the same1.
While this is all well and good, that’s not all copy-cat can do. There’s all sorts of other fancy features, including:
- Built-in editor, with access to all of Monaco’s goodness.
- Download the computer’s file contents as a zip file. And then drag-and-drop that zip back into the file browser to open it again!
- Take screenshots and record gifs of the terminal.
- Access to all of ComputerCraft’s settings. You can enable and disable Lua 5.1 support to your heart’s content.
While we try to keep as close as we can, there are some elements which are impossible to emulate due to the restricted environment of a browser.
For instance, the http API has been almost entirely recreated, and some functionality (such as setting specific headers or requesting some sites) is not impossible. As with any emulator, there will be subtle differences in how input events (key presses, mouse clicks, etc…) are handled, so do not rely on our behaviour.↩︎