Jump to content




Gamax92's CCLite ComputerCraft Emulator (Updated for CC1.75)


132 replies to this topic

#1 gamax92

  • Members
  • 157 posts

Posted 23 January 2014 - 05:35 PM

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.


#2 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 23 January 2014 - 07:08 PM

Is there a way for creating new virtual peripherals?

#3 gamax92

  • Members
  • 157 posts

Posted 23 January 2014 - 07:36 PM

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.


#4 Symmetryc

  • Members
  • 434 posts

Posted 23 January 2014 - 08:20 PM

Finally official :D

Edited by Symmetryc, 23 January 2014 - 08:20 PM.


#5 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 23 January 2014 - 09:26 PM

Will this work with love2d for android?

#6 gamax92

  • Members
  • 157 posts

Posted 23 January 2014 - 09:50 PM

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.


#7 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 26 January 2014 - 01:39 PM

Download does not work.

#8 gamax92

  • Members
  • 157 posts

Posted 26 January 2014 - 02:36 PM

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.


#9 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 28 January 2014 - 07:40 AM

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?

#10 TechMasterGeneral

  • Members
  • 149 posts
  • LocationUnited States

Posted 30 January 2014 - 09:59 AM

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

#11 Alice

  • Members
  • 429 posts
  • LocationBehind you.

Posted 30 January 2014 - 10:26 AM

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.


#12 gamax92

  • Members
  • 157 posts

Posted 30 January 2014 - 04:04 PM

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.


#13 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 07 February 2014 - 04:18 PM

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?

#14 Alice

  • Members
  • 429 posts
  • LocationBehind you.

Posted 07 February 2014 - 09:07 PM

Good point - sorry :D

#15 Csstform

  • Members
  • 410 posts
  • LocationU.S.A.

Posted 07 February 2014 - 09:18 PM

/offtopic Death:Did you get my PM btw?

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

#16 Alice

  • Members
  • 429 posts
  • LocationBehind you.

Posted 07 February 2014 - 09:23 PM

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

#17 gamax92

  • Members
  • 157 posts

Posted 08 February 2014 - 05:41 PM

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.


#18 gamax92

  • Members
  • 157 posts

Posted 23 February 2014 - 05:15 PM

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.


#19 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 23 February 2014 - 05:35 PM

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

#20 Spexiono

  • Members
  • 14 posts

Posted 23 February 2014 - 05:56 PM

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





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users