[Mod] ComputerTest

Post Reply
User avatar
Neuromancer
Member
Posts: 797
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

[Mod] ComputerTest

by Neuromancer » Post

The point of this mod is to bring something similar to http://www.computercraft.info/ ComputerCraft Mod to Minetest. Especially Turtles.
The cool thing is that ComputerCraft uses lua to program the Turtles. There are already thousands of shared Computer Craft community programs written in lua that make these turtles do things.

In fact there is already a website that lets us create this lua code, along with the entire TurtleAPI using blockly here:
http://blockly-lua.appspot.com/static/a ... index.html

So all that really needs to be done is to create a turtle node that can read lua files, and execute them.

GitHub: https://github.com/Neuromancer56/ComputerTest/

If you want to help out please feel free to ask to become a member of the team!
Last edited by Neuromancer on Tue Mar 11, 2014 00:25, edited 1 time in total.

User avatar
Neuromancer
Member
Posts: 797
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

by Neuromancer » Post

I got the github set up here: https://github.com/Neuromancer56/ComputerTest/

It contains the basics. It has a turtle node, and a folder called apps with a sample program. I'm looking for help on the trickiest part. Once we get past that, the rest should be straightforward. What I want to happen is this. If the player places a turtle in the world, and punches it (or maybe right clicks it) that should activate the turtle. What that means is that any .lua file in the apps folder under the mod becomes a command. In this case there is a sample file already there called test.lua. So now I want if the user types /test (or something like that) then test.lua is executed. Does anyone know how to do that?

First I guess we need to find out what files are in the apps folder, loop through them, and then do a minetest.register_chatcommand for each filename. Ideas on how to do this?
Last edited by Neuromancer on Sat Jan 25, 2014 14:17, edited 1 time in total.

User avatar
twoelk
Member
Posts: 1417
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

by twoelk » Post

doesn't the WorldEditor do something similar with the WE files?

Nore
Developer
Posts: 501
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

by Nore » Post

I had made a mod like that, but not finished it: https://github.com/Novatux/turtle. However, in that one the turtle in programmed in Forth, and there are a few commands still missing, but globally it works... feel free to use it.
Last edited by Nore on Sat Jan 25, 2014 16:00, edited 1 time in total.

User avatar
Neuromancer
Member
Posts: 797
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

by Neuromancer » Post

Nore wrote:I had made a mod like that, but not finished it: https://github.com/Novatux/turtle. However, in that one the turtle in programmed in Forth, and there are a few commands still missing, but globally it works... feel free to use it.
Thanks much! It looks like there is quite a bit to this mod. I've placed a turtle and right clicked it, and a dialog comes up with 16 slots, and a box where I can type stuff. I thought I could type test, or turtle.refuel(), but nothing happened. Can you give the basics on how to use the turtle? There's also a square (and I can put objects like coal in here) and a green rectangle. Not sure what they are for.

How do I fuel the turtle? Stick coal in the first slot and type something?
I think I found the commands that the turtle can execute in turtle.lua get_turtle_funcs. It looks like I call them by doing turtle. forward() etc. But I'm not sure how to fuel the turtle, or get him to run programs.
Last edited by Neuromancer on Sun Jan 26, 2014 22:28, edited 1 time in total.

User avatar
Neuromancer
Member
Posts: 797
Joined: Tue Jun 12, 2012 22:28
GitHub: Neuromancer56

by Neuromancer » Post

I found this post that showed and explained how the turtle mod is supposed to work:
viewtopic.php?id=6291

The problem is that the open and save buttons are now gone:

Image

Is this due to maybe this mod not working with Minetest 4.7 and above? (also the code box is gone too.)
Last edited by Neuromancer on Wed Jan 29, 2014 02:40, edited 1 time in total.

User avatar
tima_gt
Member
Posts: 22
Joined: Mon Jun 10, 2013 13:19

by tima_gt » Post

i created textures for standart pc and turtle
Download: http://ubuntuone.com/6Nl8JUPRrdNUvatdksc098

User avatar
domtron vox
Member
Posts: 111
Joined: Thu Feb 20, 2014 21:07
GitHub: DomtronVox
IRC: Domtron
In-game: Domtron

by domtron vox » Post

Neuromancer wrote:First I guess we need to find out what files are in the apps folder, loop through them, and then do a minetest.register_chatcommand for each filename. Ideas on how to do this?
Just figured this out in my ranksNKits mod.

Code: Select all

local dir = minetest.get_modpath(minetest.get_current_modname()).."/apps/"
local filenames

--code based off of https://github.com/cornernote/minetest-towntest/blob/master/towntest_chest/init.lua
--its probably linux/mac
if os.getenv('HOME') and kits_dir then
    os.execute('ls "'..dir..'" | grep .lua > "'..dir..'/.apps"')
    local file, err = io.open(dir..'/.apps', 'rb')
    if not err then
         filenames = file:lines()
    end
    os.execute('rm "'..dir..'/.apps"')

--its probably windows
else 
    filenames = io.popon('dir "'..dir..'"'):lines()
end

if not filenames then
    error(Some error message)

else

    for filename in filenames do
        --do what you need to do        
    end
end
Your welcome.

EDIT: Added a check for when the folder is missing.
Last edited by domtron vox on Sun Mar 30, 2014 02:33, edited 1 time in total.

User avatar
I~=Spam
New member
Posts: 9
Joined: Fri Apr 18, 2014 16:17

by I~=Spam » Post

To make this server friendly, each computer will need a "sandbox" I recomend you google them for more info but basically it isolates the computer and prevents them from having access to functions that they shouldn't. (like all of the minetest.* functions). Here's a post I just made. I think that it is relevant here.
I~=Spam wrote:Hello all! First post! :-)

I am not sure what you are talking about but I have a working lua sandboxed environment in which you can specify what you want to included in the environment and you can also specify specific functions in tables that you want omitted (like string.dump). It even can't take up all of the processing power of the server because I have set a debug hook which, after running a specified number of lua expressions (not lines) it while call the debug hook which temporarily pauses the computer.

Although there is a catch. Sadly it doesn't run in luajit 2.0 or lua5.1. It only works in lua5.2 (might work in luajit1.0 using a third party addon) because in lua5.2 the c stack was changed to allow yielding across c boundaries. Even telling luajit not to compile using jit.off(function) sadly doesn't work. Using lua lanes might work but a new problem comes up (i haven't confirmed this though). All functions that are not in the base library must be re-required. And it is impossible to require the essential "minetest.*" table. Furthermore it is virtually impossible to require other mods that may want to mod comptuercraft.

In other words, I am out of ideas for how to make a lua comptuer mod written in lua due to the fact minetest uses luajit. :-(

I think that this may be possible to do if someone were willing to write some of the mod in c. Although the problem is I am not even sure where the c moder would start. All I would need to get this mod to work is the ability to run a function be able to pause execution of that program periodically (and return to the main program) after a specified number of expressions of lua code.
Last edited by I~=Spam on Fri Apr 18, 2014 17:01, edited 1 time in total.

User avatar
I~=Spam
New member
Posts: 9
Joined: Fri Apr 18, 2014 16:17

Re: [Mod] ComputerTest

by I~=Spam » Post

Progress! In theory I can do this using coroutines despite the problems I mentioned before. The downside though is that it is pretty hackish and abuses the stack somewhat and for this reason I am not sure how many computers will be able to be run at a time. I will post when I have something more presentable if this is possible.

User avatar
tima_gt
Member
Posts: 22
Joined: Mon Jun 10, 2013 13:19

Re: [Mod] ComputerTest

by tima_gt » Post

I~=Spam wrote:Progress! In theory I can do this using coroutines despite the problems I mentioned before. The downside though is that it is pretty hackish and abuses the stack somewhat and for this reason I am not sure how many computers will be able to be run at a time. I will post when I have something more presentable if this is possible.
Okay, what works, what not?

User avatar
tima_gt
Member
Posts: 22
Joined: Mon Jun 10, 2013 13:19

Re: [Mod] ComputerTest

by tima_gt » Post

Help with GUI
I can't understand GUI creating official instructions and i need help with this or find easy tutorial.

Image

Can anyone create or help with creating, and how to change position and more?
thanks in advance, tima_gt.

User avatar
I~=Spam
New member
Posts: 9
Joined: Fri Apr 18, 2014 16:17

Re: [Mod] ComputerTest

by I~=Spam » Post

I have pretty much dropped this idea because formspecs are very limited. Don't get me wrong I think that mods aren't run clietside but this decreases the number of mod ideas that are possible to make (in comparison to minecraft) by unimaginable amounts. Doing it this way even adds sequrity to the clients but (as far as I know) it is impossible to create a computercraft equivalent to minetest.

In a nutshell, (according to my current understanding) there cannot be any mod-made custom drawing logic, thus, no computercraft.

Too bad because if it weren't for this I actually would create mods for minetest. (and I would have made computertest by now.)

User avatar
ninnghazad
Member
Posts: 36
Joined: Fri Sep 26, 2014 12:33
GitHub: ninnghazad
IRC: ninnghazad
In-game: ninnghazad

Re: [Mod] ComputerTest

by ninnghazad » Post

Heho,
electrodude512 and me have something in the workings, and so far the working is good. displays are realized using composite textures, not formspecs. input-however still uses formspecs until proper methods are available in minetest itself. it is not ready for public use, however it is in a state that proves that a mod like computercraft is absolutely possible. there still is the input problem and a mt-bug with textures, but there already are drones (turtles) and the first test-quarries have run. forceloading also is an issue, but well, its 0.4 - so we by no means have exhausted the possibilities.
https://github.com/ninnghazad/dronetest

User avatar
BirgitLachner
Member
Posts: 391
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: [Mod] ComputerTest

by BirgitLachner » Post

Hello ...
anyone out there!?!

Is there still someone working on this idea? A big problem is in my opinion, that there are so many nearly similiar projects and the guys who started them all should work together ... okay, that's not a simple problem.

I started a new thread viewtopic.php?f=47&t=15665 and was asking for help to realize a Mod like ComputerCraft because this is one thing that are many teacher waiting for before switching to Minetest instead of Minecraft.

In my opinion a Mod to let young users start with programming inside Minetest should offer the following steps, like they are realized in ComputerCraftEDU (http://computercraftedu.com/):
1.) Customize you turtle to have a relationship to your turtle. Change the color and fit it out with some funny accessories.
2.) Have a remote control, connect it with your turtle and move the turtle around by clicking on some buttons that stands for the basic actions of the turtle like movement (forward, backward, up, down, left, right), turn around (90° right or left), take a block (only? in front of the turtle), put a block.
3.) Have a visual editor with blocks that give the syntax like in scratch. It is fantastic that there is already a blockly-like editor for Lua (http://blockly-lua.appspot.com/static/a ... index.html). In this stage the kids should learn the basic possibilities of programming, using if-statements and loops and they can use it to build 3D buildings with their turtle. For more advanced users the possibilities of the turtle should be updated (new texture?) to have sensors and thus more possibilities to use these sensors to build/take blocks depending on the environment.
4.) Next step will be a text-editor. At first the kids can program in the visual-editor and see the code that stands behind that. May be a computer-terminal should be connected to the turtle and an other update of the turtle to have this connection. Cool looking turtles will help to spur the children to improve their programming abilities.
For some programs it would be easier to change little things or copy parts of the code in the text-editor and so hopefully they will move to do more text-coding.

Well ... hopefully nice ideas, but who will do this?
I'm willing to help, but I only have basic knowledge how to build Mods (simple blocks and craftitems). I can draw textures and give some ideas how to improve the appearance of the turtle.
I know some teachers that will create maps to learn programming with the turtle for Minetest because they already did that in Minecraft. And because of the idea of Microsoft only to offer the new Minecraft Education Version for Windows 10 they will switch to Minetest as soon there is an appropriate replacement for ComputerCraft.

Would it be difficult to realize the ideas?
As far as I understand Minetest ...
nr. 1.) should not too difficult to realize. That is like changing the skin of a user and wearing armour. And that is not the most important for the Mod.
nr. 2.) would not be to difficult too, hopefully. Drawing a craftitem and have a formspec (with nice background) for the buttons. The actions would not be too difficult (hopefully) as they are only internal commands to move the block around.
nr. 3.) ... okay ... that will be more difficult ... I don't have any idea how to realize it.
nr. 4.) may be not so difficult as I think that is a bit like programming with digilines. There are already text-editors!

Okay guys ... now give me the punch!!!
Last edited by BirgitLachner on Tue Oct 11, 2016 06:49, edited 1 time in total.

User avatar
BirgitLachner
Member
Posts: 391
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: [Mod] ComputerTest

by BirgitLachner » Post

Some videos to show informations about ComputercraftEDU:

Trailer: https://youtu.be/5KwAr2gqgXg?t=18s

Playlist with tutorials:
https://www.youtube.com/watch?v=ptH99K2 ... LWnjBH-SPE

User avatar
I~=Spam
New member
Posts: 9
Joined: Fri Apr 18, 2014 16:17

Re: [Mod] ComputerTest

by I~=Spam » Post

I am currently in school so I don't have a lot of time for something like this but I think that it is possible but I am interested in trying and helping. :) (Well, some of the bullet points are possible.) Unless things have changed, you cannot get feedback as you type into a formspec. So there has to be a submit button for every time you type input into the program. So that means editing files and running turtles will be a bit different. The turtles may not have a command line interface because of that. But for school kids that is not necessarily a bad thing. There could be a list of files that are in turtle's memory in a menu. There could be a big multiline formspec for the lua code. There could be several buttons like run, stop, and save.

About the gui editor I don't exactly think we could get it running inside of minetest because it is written in javascript and it would be a lot of work or not even possible to create in computercraft. BUT we might be able to make the api compatible with computercraft so the web app will be able to create code that can be used to program the turtles in this mod and just copy and paste the lua code. It would be really cool if the computer that is being the minetest server could also run a http server and could have you save the lua script that the student writes directly onto the turtle and then all they have to do is just click run. (Maybe possible?)

User avatar
BirgitLachner
Member
Posts: 391
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: [Mod] ComputerTest

by BirgitLachner » Post

What about starting with a remote control? Is this too difficult?

https://youtu.be/JX_JmVp2Vt8?t=12s

Should we start with a new project? I don't want to start it at github as I'm only in the background :-/
I can create some little textures for a beginner turtle

User avatar
I~=Spam
New member
Posts: 9
Joined: Fri Apr 18, 2014 16:17

Re: [Mod] ComputerTest

by I~=Spam » Post

I think that is possible (but maybe not the turtle vision part that depends on how the minetest core lua game is written.) I will look into it later but right now I have to sleep. It is 2am in my timezone. lol

User avatar
BirgitLachner
Member
Posts: 391
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: [Mod] ComputerTest

by BirgitLachner » Post

Okay ... just a try ... as github newbie I maybe had a bad start:

https://github.com/BiLachner/TurtleMiner

Anyone is welcome to participate ... just tell my your github name.

User avatar
cd2
Member
Posts: 562
Joined: Mon Jun 01, 2015 06:30
GitHub: cdqwertz
In-game: cd cd2
Location: Linux
Contact:

Re: [Mod] ComputerTest

by cd2 » Post

BirgitLachner wrote:What about starting with a remote control? Is this too difficult?

https://youtu.be/JX_JmVp2Vt8?t=12s

Should we start with a new project? I don't want to start it at github as I'm only in the background :-/
I can create some little textures for a beginner turtle
I am also working on a computer mod for minetest: https://github.com/cdqwertz/computers
I think it would be possible to add a turtle/robot.

infchem
New member
Posts: 1
Joined: Tue Oct 11, 2016 19:44

Re: [Mod] ComputerTest

by infchem » Post

BirgitLachner wrote:Okay ... just a try ... as github newbie I maybe had a bad start:

https://github.com/BiLachner/TurtleMiner

Anyone is welcome to participate ... just tell my your github name.
Hi Birgit...please add me....infchem :)

User avatar
BirgitLachner
Member
Posts: 391
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: [Mod] ComputerTest

by BirgitLachner » Post

Cool ... a first Co-Worker ;-) ... I'll start the project from the scratch as I made some faults ... wait a short moment. And I'll start Thread for the Mod today after starting the project correctly.

hajo
Member
Posts: 606
Joined: Thu Oct 13, 2016 10:45
Location: DE
Contact:

Re: [Mod] ComputerTest

by hajo » Post

cd2 wrote:I am also working on a computer mod for minetest: https://github.com/cdqwertz/computers.
The computer from this mod appears to work like a terminal,
with some simple commands, eg. clear screen, list files ...

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests