I want to get a CC emulator that runs within a linux terminal, and can be accessed via SSH client.
This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Does anyone know of a CC emu which runs in linux terminal?
Started by LDDestroier, 09 January 2015 - 10:01 PMPosted 09 January 2015 - 11:01 PM
I have a cool Poweredge 2950 (and a Windows PC) running Ubuntu, and I want to have it run CraftOS. But the problem is, that every CC emulator runs in the graphical environment and not in the shell.
I want to get a CC emulator that runs within a linux terminal, and can be accessed via SSH client.
I want to get a CC emulator that runs within a linux terminal, and can be accessed via SSH client.
Posted 10 January 2015 - 09:18 AM
Dare I ask why it needs to be accessible via SSH? I just run CCEmuRedux off my USB stick and it works fine.
It might be feasible to port CCLite (or another pure-lua emulator) to use the terminal instead. I wrote a Lua Interop library, which can handle most terminal elements. However, there is no way to get terminal size/cursor position with escape codes, and no way to handle mouse events.
Another suggestion is X11 Forwarding, with something like Xming, but I really don't understand the SSH requirement.
It might be feasible to port CCLite (or another pure-lua emulator) to use the terminal instead. I wrote a Lua Interop library, which can handle most terminal elements. However, there is no way to get terminal size/cursor position with escape codes, and no way to handle mouse events.
Another suggestion is X11 Forwarding, with something like Xming, but I really don't understand the SSH requirement.
Posted 11 January 2015 - 10:45 AM
It really would be just a case of rewriting https://github.com/g.../src/render.lua in CCLite to use ncurses. Actually, I might do it…
EDIT: Or not, fount a curses library for lua trough: https://github.com/luaposix/luaposix
EDIT: Or not, fount a curses library for lua trough: https://github.com/luaposix/luaposix
Edited on 11 January 2015 - 10:07 AM
Posted 04 February 2015 - 05:56 AM
CC Emulator that would run in a linux terminal would be brilliant, I would love to have CraftOS technically running on my Raspberry Pi with a TFT screen. Even adding a small portable battery would open up a lot of possibilitys.
Posted 20 February 2015 - 07:47 AM
I think the easiest way to do this would be to just implement a ssh-like protocol on CC, then running CCEmuRedux or similar headless.
Posted 21 February 2015 - 06:55 PM
not reallyI think the easiest way to do this would be to just implement a ssh-like protocol on CC, then running CCEmuRedux or similar headless.
Edited on 21 February 2015 - 05:56 PM
Posted 21 February 2015 - 07:53 PM
why? i'd easily be able to make a ssh-like system using http(s)not reallyI think the easiest way to do this would be to just implement a ssh-like protocol on CC, then running CCEmuRedux or similar headless.
Posted 21 February 2015 - 08:14 PM
Okay, I suppose SSH wouldn't work, but maybe xterm. Still, if there isn't a terminal-based CC emulator, could someone try porting ccemuredux or cclite? I'm surprised there aren't any text-based CC emus already.
Posted 21 February 2015 - 08:20 PM
I could try porting Mimic…Okay, I suppose SSH wouldn't work, but maybe xterm. Still, if there isn't a terminal-based CC emulator, could someone try porting ccemuredux or cclite? I'm surprised there aren't any text-based CC emus already.
actually that might be easy
all there is to it is editing render.js
then putting it in a node/node-webkit instance
Edited on 21 February 2015 - 07:23 PM
Posted 21 February 2015 - 08:29 PM
well that was easy!
now to make it into a CLI interface
now to make it into a CLI interface
Posted 21 February 2015 - 09:48 PM
Oh goody! Ooo, is it possible to update the computercraft of Mimic from 1.5 to 1.6?
Posted 21 February 2015 - 10:31 PM
that'd be up to GS and 1lann, but it supports 1.63:Oh goody! Ooo, is it possible to update the computercraft of Mimic from 1.5 to 1.6?
Features
- Full ComputerCraft emulator in your web browser
- CC 1.63 support
- Mobile (iOS and Android) support
Posted 21 February 2015 - 10:36 PM
A while ago I wrote a terminal-based emulator: https://github.com/CoderPuppy/cc-emu
I just fixed it up (and added better instructions) when I saw this thread.
I just fixed it up (and added better instructions) when I saw this thread.
Posted 21 February 2015 - 10:40 PM
Progress update:
I've got it running in node-webkit, which means i can run node-webkit headless or port it to node
see you people tomorrow, i have to go now (GMT - usually 7am-8pmish on sat, if you want to know when you should check if im online)
ooh nice, will try it out later
I've got it running in node-webkit, which means i can run node-webkit headless or port it to node
see you people tomorrow, i have to go now (GMT - usually 7am-8pmish on sat, if you want to know when you should check if im online)
A while ago I wrote a terminal-based emulator: https://github.com/CoderPuppy/cc-emu
I just fixed it up (and added better instructions) when I saw this thread.
ooh nice, will try it out later
Posted 21 February 2015 - 11:04 PM
A while ago I wrote a terminal-based emulator: https://github.com/CoderPuppy/cc-emu
I just fixed it up (and added better instructions) when I saw this thread.
I was trying to use it, but I think I had a problem with lcurses, and it errors and lists a bunch of missing directories for Lua 5.2. Weird. I am using Lubuntu 14.04.
Posted 21 February 2015 - 11:21 PM
It is a bit finicky to setup. I think in *buntu you need to install luajit, lua-penlight, lua-curses and lua-posix. If that doesn't work then install luajit then manually compile luarocks with –lua-suffix=jit –with-lua=/usr and use luarocks to install everything else.
Example of using luarocks:
Example of using luarocks:
$ wget http://luarocks.org/releases/luarocks-2.2.0.tar.gz
$ tar zxpf luarocks-2.2.0.tar.gz
$ cd luarocks-2.2.0
$ ./configure --lua-suffix=jit --with-lua=/usr
$ sudo make bootstrap
$ sudo luarocks install penlight
$ sudo luarocks install lcurses
$ sudo luarocks install lposix
$ sudo luarocks install luabitop
Edited on 21 February 2015 - 10:25 PM
Posted 22 February 2015 - 05:11 AM
I get the following error, even after installing the requirements from apt-get:
evan@evan-Latitude-D620:~/cc-emu-master$ lua cli.lua
lua: cli.lua:9: module 'emu' not found:
no field package.preload['emu']
no file '/usr/local/share/lua/5.2/emu.lua'
no file '/usr/local/share/lua/5.2/emu/init.lua'
no file '/usr/local/lib/lua/5.2/emu.lua'
no file '/usr/local/lib/lua/5.2/emu/init.lua'
no file '/usr/share/lua/5.2/emu.lua'
no file '/usr/share/lua/5.2/emu/init.lua'
no file './emu.luaemu.lua'
no file '/usr/local/lib/lua/5.2/emu.so'
no file '/usr/lib/i386-linux-gnu/lua/5.2/emu.so'
no file '/usr/lib/lua/5.2/emu.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './emu.so'
stack traceback:
[C]: in function 'require'
cli.lua:9: in main chunk
[C]: in ?
Posted 22 February 2015 - 05:27 AM
I think you have to run it with luajit so like luajit cli.lua . (The dot at the end is important, it tells it what directory to use as root)
Edit: also your package.path is weird, it seems to have "?.lua?.lua" or something in it
Edit: also your package.path is weird, it seems to have "?.lua?.lua" or something in it
Edited on 22 February 2015 - 04:30 AM
Posted 22 February 2015 - 07:14 AM
When I get some sort of linux box running (virtualbox/vagrant doesn't seem to be working on my main computer, i might try my pi) I'll test it out!I think you have to run it with luajit so like luajit cli.lua . (The dot at the end is important, it tells it what directory to use as root)
Edit: also your package.path is weird, it seems to have "?.lua?.lua" or something in it
Posted 22 February 2015 - 07:25 AM
I tried it out, ./configure fails, lua.h not foundIt is a bit finicky to setup. I think in *buntu you need to install luajit, lua-penlight, lua-curses and lua-posix. If that doesn't work then install luajit then manually compile luarocks with –lua-suffix=jit –with-lua=/usr and use luarocks to install everything else.
Example of using luarocks:$ wget http://luarocks.org/releases/luarocks-2.2.0.tar.gz $ tar zxpf luarocks-2.2.0.tar.gz $ cd luarocks-2.2.0 $ ./configure --lua-suffix=jit --with-lua=/usr $ sudo make bootstrap $ sudo luarocks install penlight $ sudo luarocks install lcurses $ sudo luarocks install lposix $ sudo luarocks install luabitop
Also, with apt-get commands, lua cannot be found
If I run it with luajit instead of lua, it says that module luarocks.index cannot be found
If I install normal lua5.2, it says module emu not found…
My package.path has ./?.lua in it…
If I remove your editing of package.path, it comes up with the luarocks error again
… even when I apt-get install luarocks
Edited on 22 February 2015 - 06:35 AM
Posted 22 February 2015 - 08:22 AM
auofyuieguyageufyiufesufys…
… well that is hard….
I have to change every reference of $, window, BrowserFS, XMLHttpRequest etc to node.js equivalents.
I might have to remove everything and just include the lua stuff
if only node webkit supported stdout/in
… well that is hard….
I have to change every reference of $, window, BrowserFS, XMLHttpRequest etc to node.js equivalents.
I might have to remove everything and just include the lua stuff
if only node webkit supported stdout/in
//require("./scripts/lib/jquery.min.js");
$ = function(x) {return x;};
//require("./scripts/lib/bootstrap.min.js");
//require("./scripts/lib/ace/src-min-noconflict/ace.js")
//require("./scripts/lib/Blob.js");
//require("./scripts/lib/FileSaver.js")
require("./scripts/lib/CapsLock.compressed.js")
//require("./scripts/lib/purl.js")
require("URIjs")
Lua5_1 = require("./scripts/lib/lua5.1.5.min.js")
//require("./scripts/lib/browserfs.js")
require("fs")
require("./scripts/lib/xdRequest.js")
require("./scripts/code.js")
globals = require("./scripts/globals.js")
core = require("./scripts/core.js")
require("./scripts/computer.js")
require("./scripts/filesystem.js")
require("./scripts/render.js")
events = require("./scripts/event.js")
require("./scripts/apis/bit.js")
require("./scripts/apis/fs.js")
require("./scripts/apis/http.js")
require("./scripts/apis/os.js")
require("./scripts/apis/peripheral.js")
require("./scripts/apis/redstone.js")
require("./scripts/apis/term.js")
core.run();
current progress ^Edited on 22 February 2015 - 07:23 AM
Posted 22 February 2015 - 08:43 AM
Well… I've done a bit of a rewrite, but I need to implement most (except Date/Time and bit) apis with node.js
Posted 22 February 2015 - 09:07 AM
It's so exciting, as the load times get longer and longer, while the errors decrease
I think the lua stuff is actually being run :D/>
It gets to fs.list then errors because I haven't implemented the fs api
Also, I have an error which says 'thread' doesn't exist
actually that looks like an error in the Mimic code
corrected, now it's stopping at render.bsod, because I haven't implemented render :D/>
I think the lua stuff is actually being run :D/>
It gets to fs.list then errors because I haven't implemented the fs api
Also, I have an error which says 'thread' doesn't exist
actually that looks like an error in the Mimic code
corrected, now it's stopping at render.bsod, because I haven't implemented render :D/>
Edited on 22 February 2015 - 08:14 AM
Posted 22 February 2015 - 03:27 PM
Ok, sorry, I didn't test configure without lua installed, apparently –lua-suffix doesn't do anything (also it appears luajit doesn't include the necessary headers, so maybe that's the problem).I tried it out, ./configure fails, lua.h not foundIt is a bit finicky to setup. I think in *buntu you need to install luajit, lua-penlight, lua-curses and lua-posix. If that doesn't work then install luajit then manually compile luarocks with –lua-suffix=jit –with-lua=/usr and use luarocks to install everything else.
Example of using luarocks:$ wget http://luarocks.org/releases/luarocks-2.2.0.tar.gz $ tar zxpf luarocks-2.2.0.tar.gz $ cd luarocks-2.2.0 $ ./configure --lua-suffix=jit --with-lua=/usr $ sudo make bootstrap $ sudo luarocks install penlight $ sudo luarocks install lcurses $ sudo luarocks install lposix $ sudo luarocks install luabitop
Also, with apt-get commands, lua cannot be found
If I run it with luajit instead of lua, it says that module luarocks.index cannot be found
If I install normal lua5.2, it says module emu not found…
My package.path has ./?.lua in it…
If I remove your editing of package.path, it comes up with the luarocks error again
… even when I apt-get install luarocks
Updated example of using luarocks:
$ sudo apt-get install luajit libluajit-5.1-dev
$ wget http://luarocks.org/releases/luarocks-2.2.0.tar.gz
$ tar zxpf luarocks-2.2.0.tar.gz
$ cd luarocks-2.2.0
$ ./configure --with-lua=/usr --with-lua-include=/usr/include/luajit-2.0
$ sudo make bootstrap
$ sudo luarocks install penlight
$ sudo luarocks install lcurses
$ sudo luarocks install lposix
$ sudo luarocks install luabitop
Posted 22 February 2015 - 03:32 PM
Good, things are running well, I still haven't implemented most apis but most display stuff works:
that bios error is from lua !!
that bios error is from lua !!
Posted 22 February 2015 - 03:36 PM
What version of CC are you using? In 1.7 line 628 is "function()".
Posted 22 February 2015 - 04:08 PM
don't worry about that, that's just because I haven't implemented (almost) all apis, just testing colors and rendering at the momentWhat version of CC are you using? In 1.7 line 628 is "function()".
btw its based on mimic, so CC1.63
i have colors people!
Edited on 22 February 2015 - 03:10 PM
Posted 22 February 2015 - 05:14 PM
the coloring api i use doesn't support hex values, just a few named coloursYou can find the exact colors on the wiki in hex form.
Posted 22 February 2015 - 05:49 PM
comp500 very nice!
Posted 22 February 2015 - 06:15 PM
Why are you checking in colors.js instead of using npm?
Posted 22 February 2015 - 06:53 PM
i can't be bothered to make a .gitignore, will exclude it laterWhy are you checking in colors.js instead of using npm?
Posted 23 February 2015 - 05:12 PM
oh wait… you found my github repo :D/>Why are you checking in colors.js instead of using npm?
just so other people know, it's at https://github.com/comp500/Mimic
Posted 24 February 2015 - 03:10 AM
Sorry for doing the same thing as comp500, but I didn't see his work when I started this project. I, too, am porting Mimic to Node.js. I have computer emulation working at https://github.com/Sxw1212/NodeMimic. See the README for details.
Posted 24 February 2015 - 04:32 PM
Nice! Unfortunately I don't have much time due to school anyway, I'll check out your version!Sorry for doing the same thing as comp500, but I didn't see his work when I started this project. I, too, am porting Mimic to Node.js. I have computer emulation working at https://github.com/Sxw1212/NodeMimic. See the README for details.
I can help you add
If nano can capture ctrl, why can't we? Is it in the libraries you're using
http://stackoverflow...-readline-shell < key.ctrl
Edited on 24 February 2015 - 04:11 PM
Posted 24 February 2015 - 05:03 PM
Wow that's amazing!
Check out my pull request.
I did have to tweak install.js to get it to run on Windows, though
Some tips:
time goes at one day a second
shutdown isn't very clean, leaving you at a blank command prompt and not stopping node
on edit, escape works but when i try to save it gives me a range error byteoffset out of range
Check out my pull request.
I did have to tweak install.js to get it to run on Windows, though
dir = "A:/comp500/Programming/NodeMimic-master/NodeMimic-master/"
Some tips:
- only redraw the screen partially when needed
- worm doesn't seem to work
- on Windows, escape+T/R/S doesn't work
time goes at one day a second
shutdown isn't very clean, leaving you at a blank command prompt and not stopping node
on edit, escape works but when i try to save it gives me a range error byteoffset out of range
Edited on 24 February 2015 - 04:06 PM
Posted 25 February 2015 - 12:39 AM
*snip*
If nano can capture ctrl, why can't we? Is it in the libraries you're using
http://stackoverflow...-readline-shell < key.ctrl
We can capture ctrl, but only when another key is pressed, eg nano with Ctrl-X to save. Computercrafts edit just has you press ctrl to access a menu. If you know how to capture the raw ctrl, let me know please.
Wow that's amazing!
Check out my pull request.
I did have to tweak install.js to get it to run on Windows, thoughdir = "A:/comp500/Programming/NodeMimic-master/NodeMimic-master/"
Some tips:when I overflow the screen (e.g. programs then programs again) it crashes, saying it can't find render
- only redraw the screen partially when needed
- worm doesn't seem to work
- on Windows, escape+T/R/S doesn't work
time goes at one day a second
shutdown isn't very clean, leaving you at a blank command prompt and not stopping node
on edit, escape works but when i try to save it gives me a range error byteoffset out of range
I haven't implemented esc-t/r/s yet, I'll finish that soon.
As for worm, it's probably not working due to colors being needed.
I've fixed the scrolling, it was a bug from leftover code.
As for the time going at one day a second, that's a Mimic bug. I've opened a Mimic ticket and will upgrade the commit version that's hardcoded when a new stable version come out.
I'll see what I can hook into for the shutdown event.
Thanks for the pull request, I'll look at it in later tonight.
Edited on 24 February 2015 - 11:40 PM