←  General

ComputerCraft | Programmable Computers for Minecraft

»

Gamax92's CCLite ComputerCraft Emulato...

gamax92's Photo gamax92 23 Jan 2014

Yo dawg, I herd you like lua so I made you a ComputerCraft emulator in Love2D so you can Lua while you Lua

This is my fork of the CCLite emulator by Sorroko, and since Sorroko has gone off into a different goal than I have, I feel its okay to post a thread for this.
If you would like to go check out Sorroko's version of CCLite, his forum thread is here.

Description:
This is the CCLite ComputerCraft emulator. My goal is to get the emulator as close as possible to normal ComputerCraft.
It is not complete and thanks to LuaJ and Java, probably will never be complete. It is still quite useable however.
If you want to use the .love archives or source code, you will need the Love2D game framework version 0.9.2, avaliable here
If you want proper HTTPS support, try the instructions on this page.

Please report any issues you find here on my github's issues page!

Peripherals:
CCLite supports peripherals via the additional api, cclite.
cclite.peripheralAttach(side, type) -- Attaches peripheral of type, to side.
cclite.peripheralDetach(side) -- Detach a peripheral on side.

Some peripherals have additional callbacks, look at cclite.getMethods and cclite.call to use them.

Downloads:
Builds
Love2D
Source code

Warning, builds may be out of date, check builddate.txt

NOTE: If using the .love archives, unless you pass --fused to love, the builds and the .love won't share the same configuration and computer contents.

Regarding Mac Builds:
Spoiler

Features:
Quite faster than ComputerCraft in Minecraft
HTTP is potentially faster as well.
Supports "Too long without yield"
Adds an api called cclite. Usage documentation here
Virtual peripherals

Screenshots:
Spoiler

Things that won't ever work:
Lua and LuaJ will take invalid escape sequences and ignore them, LuaJIT will complain (5.2 feature). You shouldn't be having invalid escape sequences anyway though *cough* LuaIDE *cough*
Lua's tonumber locks the output from 0 to 4294967295 (2^32-1), LuaJ doesnt. I've done a patch that enables the output to go from -4294967295 to 4294967295
LuaJ will allow you to set the environment of builtin's, Lua won't.
Numpad. SDL cannot distinguish between numpad buttons with numlock off and numlock on. It seems I cannot get the numlock state from SDL either.
Edited by gamax92, 18 December 2015 - 08:44 PM.
Quote

H4X0RZ's Photo H4X0RZ 23 Jan 2014

Is there a way for creating new virtual peripherals?
Quote

gamax92's Photo gamax92 23 Jan 2014

The basics for the virtual peripheral is this:
function peripheral.base.dummy()
	local obj = {}
	obj.type = "dummy" -- same name as peripheral.(this thing)
	function obj.getMethods() return {} end
	function obj.ccliteGetMethods() return {} end
	function obj.call(sMethod, ...)
		local tArgs = {...}
		if sMethod == "blah" then
		   -- do stuff
		end
	end
	function obj.ccliteCall(sMethod, ...)
		local tArgs = {...}
		if sMethod == "blah" then
		   -- do stuff
		end
	end
	return obj
end
peripheral.types.dummy = "dummyblock" -- dummy is the same as obj.type, "dummyblock" is what peripheral.getType sees.

call is for peripheral.call and should be used for things you want to do normally in lua.

ccliteCall is for cclite.call and should be used to do things one would normally do in the minecraft world.
For example, diskDrive has "diskLoad" which configures the kind of "virtual disk" is in the fake drive.

When you've made one, just throw it in the peripheral folder inside the .love and it should be avaliable for you to use.
Edited by gamax92, 26 January 2014 - 01:22 PM.
Quote

Symmetryc's Photo Symmetryc 23 Jan 2014

Finally official :D
Edited by Symmetryc, 23 January 2014 - 08:20 PM.
Quote

Csstform's Photo Csstform 23 Jan 2014

Will this work with love2d for android?
Quote

gamax92's Photo gamax92 23 Jan 2014

Just pushed some changes to make it work on Android Love2D

One is to enable the keyboard, and the other is to get around two bugs in the port
Key input seems to be a bit unreliable, and where you should be getting both love.textinput and love.keypressed, you get one or the other.

Ctrl-T/S/R doesn't work because of said issues.

I can only test on BlueStacks btw, my phone is too old to run the apk.
Edited by gamax92, 23 January 2014 - 11:00 PM.
Quote

Csstform's Photo Csstform 26 Jan 2014

Download does not work.
Quote

gamax92's Photo gamax92 26 Jan 2014

All nine links in this thread work for me.
Downloaded latest build link, it ran.
Both screenshots show up

EDIT: Just did all above tests over a proxy as well, and cleared cache.
Edited by gamax92, 26 January 2014 - 02:42 PM.
Quote

Csstform's Photo Csstform 28 Jan 2014

Sorry, browser bug. Adifferent one worked. However, now I cannot figure out how to run the .love. The post you link to says to extract game files to ..., but what do I extract?
Quote

TechMasterGeneral's Photo TechMasterGeneral 30 Jan 2014

AWESOME!!! I've been looking for one of these for a long time...
And http support does work on mac
Quote

Alice's Photo Alice 30 Jan 2014

Csstform: I don't think you should extract the .love. Just click and drag it over love.exe.
Edited by Death, 30 January 2014 - 10:27 AM.
Quote

gamax92's Photo gamax92 30 Jan 2014

Thanks to AmandaC, we have an experimental 1.6 BETA version of CCLite.

Experimental 1.6 BETA

Also, LuaCrawler, I wasn't concerned if http worked on a mac, I was more concerned if https (notice the s?) worked on mac.
I don't have a mac so I can't test that luasec binary on the wiki page.
Edited by gamax92, 10 March 2014 - 08:28 PM.
Quote

Csstform's Photo Csstform 07 Feb 2014

View PostDeath, on 30 January 2014 - 10:26 AM, said:

Csstform: I don't think you should extract the .love. Just click and drag it over love.exe.
On an android?
Quote

Alice's Photo Alice 07 Feb 2014

Good point - sorry :D
Quote

Csstform's Photo Csstform 07 Feb 2014

/offtopic Death:Did you get my PM btw?

And I still don't understand how to use this on Android...
Quote

Alice's Photo Alice 07 Feb 2014

Yes I did - I'm just unable to test it currently, busy with another thing :D
Quote

gamax92's Photo gamax92 08 Feb 2014

View PostCsstform, on 28 January 2014 - 07:40 AM, said:

Sorry, browser bug. Adifferent one worked. However, now I cannot figure out how to run the .love. The post you link to says to extract game files to ..., but what do I extract?

That post I linked doesn't say to extract game files to ...
it says to "Extract your game to /sdcard/lovegame such that main.lua is located at /sdcard/lovegame/main.lua."
Just take the files in src and put them in /sdcard/lovegame or extract the .love to /sdcard/lovegame
Edited by gamax92, 08 February 2014 - 06:17 PM.
Quote

gamax92's Photo gamax92 23 Feb 2014

So, found enough interest to actually do work:

I've been working on an experiment to see if Multiple Computers could be achieved with the current status of the code.
Turns out, it was.
Posted Image
I'm using LoveFrames for the GUI, look for that here
If you want to try out this version, its in the frames branch of my github.
https://github.com/g...ite/tree/frames

Just put the contents of src into a zip and then change the extension to .love

Unfinished things:
A lot of the menu entries are just bogus. The only ones that work are:
File -> Exit
New -> Normal Computer
New -> Advanced Computer

LyqydOS is best OS
Edited by gamax92, 24 February 2014 - 09:44 AM.
Quote

TheOddByte's Photo TheOddByte 23 Feb 2014

Hmm.. Wouldn't it be possible to port this to iOS aswell with this?
Quote

Spexiono's Photo Spexiono 23 Feb 2014

View PostHellkid98, on 23 February 2014 - 05:35 PM, said:

Hmm.. Wouldn't it be possible to port this to iOS aswell with this?

It looks like HÖVE is a bit different to LÖVE and still in development so there may be bugs and compatibility issues, Should look into it though
Quote