[Mod] TurtleMiner ... programmable turtles in Minetest

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

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by hajo » Post

endev15 wrote:the syntax is move("forward")
I tried that - no crash now, but still error (and the turtle doesn't move):

Code: Select all

ACTION[Server]: [string "move("forward")"]:1: attempt to call global 'move' (a nil value)

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by octacian » Post

Yes, there will be an in game programming guide in the future. For now, refer to the GitHub wiki. However, the wiki has nothing about the turtle's Lua functions, as they are no where near completed.

Turtles will have the ability to use tools in the future. They cannot see without light, however, they can still detect blocks right in front of them, but not further away. In the future they will be able to get other environment variables like the light level, and possibly time of day. With an upgrade, they will be able to listen to the chat, and other events. They can fly as high as the world is. If you look at my turtle, you notice it looks a bit like a rocket at the bottom. Yes, they can crawl through 1x1 tunnels. In the future, they will be able to open and close doors. When the turtles get paired with digicompute, they will be able to for sure. I'm not sure about before that, though. All the data is stored in the blocks metadeta. There should be no need to implement a limit, right away anyways, all data would be plain text, or inventory information, stored separately.

Right now, this mod is no where near done. I would not even consider it stable right now, but rather in alpha.

EDIT: oh, and the editor branch, it's even worse. Most things did not work at all. I only committed it in case BirgitLacher was able to look at it before me, and needed an example.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by octacian » Post

JulienPavageau wrote: I have never program a mod for mintetest or over game and i don't know lua but i have tried (and succes ;-) to make a record/play/stop buttom to make a sequence of few instructions and to simulate a repeat loop. I thinks it s could be a first step for initiat children with code. You can see my script on Github (it's my first time and i hope i use it correctly) and i make a first video: https://www.youtube.com/watch?v=3kbbj4HP7lE
hmmmm nice job with the sequencing buttons! However, there are a few issues. When in multiplayer, since you used single local variables to store the turtle's action, different people using the sequencer at the same time will likely break the mod. Instead of each person's turtle moving as expected, it might move as someone else had recorded.

It'd be great to get this type of thing merged into the mod, but the above needs to be fixed first. At the same time, don't worry about in depth translation, at some point in the near future I'll attempt to make the mod work with kaeza's inttlib (I think that's what it's called?).

Edit: Oh, and it wouldn't be able to place a block from mesecons. I'd recommend instead placing red wool or something like that. Or hardened clay, if/when my PR (Pull Request) to MTG (Minetest Game) is completed. I can fix that at merge though. Oh, and what does the ant button do? Sorry, didn't watch the entire video... Maybe I will.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

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

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by BirgitLachner » Post

For the ant button see ... https://en.wikipedia.org/wiki/Langton%27s_ant

I did not see that there is a branch with the editor! I'll have a look at it.


I fully agree with endev15's ideas for the development of the turtles. First step will be to complete the correct usage with the remote control. At least ...
- name the turtle
? remove the turtle and put it anywhere else without the need to rename it again
- use turtle with open remote control (some turtles with limited number of buttons)
- use turtle with collapsed remote control and buttons (HUD-Picture with the controls)
- have an inventory to collect the diged blocks
- use the blocks in the inventory to put the blocks
? open the remote control without clicking on the turtle, because the control and the turtle are connected
- have a recorder to record and play sequences

May be ...
- upgrade the turtle by using some components to have more and more buttons and the inventory
- the turtle needs fuel/food to work


Concerning the Programming Guide ... I started a page at the github wiki but I'm more familiar with MediaWiki and therefore started something in the Minetest wiki http://wiki.minetest.net/Mods/TurtleMiner
I would prefer to offer a world where the programming newbie can learn how to use the turtle by walking through a course with excercises. I already have some ideas.

JulienPavageau
New member
Posts: 9
Joined: Sun Nov 06, 2016 16:15
GitHub: JulienPavageau

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by JulienPavageau » Post

endev15 wrote:... When in multiplayer, since you used single local variables to store the turtle's action, different people using the sequencer at the same time will likely break the mod. Instead of each person's turtle moving as expected, it might move as someone else had recorded.
Ok, I had just tested in singleplayer.
endev15 wrote:It'd be great to get this type of thing merged into the mod, but the above needs to be fixed first.
Ok, I thinks it's better you make change when you want.
endev15 wrote:Edit: Oh, and it wouldn't be able to place a block from mesecons. I'd recommend instead placing red wool or something like that. Or hardened clay, if/when my PR (Pull Request) to MTG (Minetest Game) is completed. I can fix that at merge though.
I have just choose this block to be use with a "mod" that can export to a 3d printer. You can see it at this adress (only in french) :
http://minetest.lespetitsdebrouillardspc.org/
or in this video :
https://www.youtube.com/watch?v=b__pAyIJIe0

User avatar
rnd
Member
Posts: 220
Joined: Sun Dec 28, 2014 12:24
GitHub: ac-minetest
IRC: ac_minetest
In-game: rnd

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by rnd » Post

Perhaps my basic_robot mod viewtopic.php?f=9&t=15850 could be of help too - you can write simple lua programs and each player's robot runs independently of other robots

It has all the functionality of moving around, digging, placing blocks and can sense blocks in all directions. It can make very simple programs or very complex too. Example of simple program to navigate robot around and turn if it hits the wall

Code: Select all

if read_node.forward()~="air" then
    turn.right()
else
    move.forward()
end
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

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

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by hajo » Post

rnd wrote:Perhaps my basic_robot mod could be of help too
A working 'bot - that's a nice surprise. Thanks !

User avatar
Desour
Member
Posts: 1473
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by Desour » Post

hajo wrote:
rnd wrote:Perhaps my basic_robot mod could be of help too
A working 'bot - that's a nice surprise. Thanks !
simple_robots mod works fine, too
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

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

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by hajo » Post

rnd wrote:Perhaps my basic_robot mod could be of help too
DS-minetest wrote:simple_robots mod works fine, too
I have had a look at them - working, but the userinterface is quite cumbersome.

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by octacian » Post

hajo wrote:
rnd wrote:Perhaps my basic_robot mod could be of help too
DS-minetest wrote:simple_robots mod works fine, too
I have had a look at them - working, but the userinterface is quite cumbersome.
I agree.

And FYI, dev on my end is entirely postponed for about a week. Will be back to it November 20th.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
Desour
Member
Posts: 1473
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: Desour
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by Desour » Post

hajo wrote:the userinterface is quite cumbersome.
minetest has no good interface for writing large texts, luacontroller for example is cumbersome, too
and it works fine, i dont think, the userinterface of the simple_robot mod is cumbersome
he/him; Codeberg; GitHub; ContentDB; public personal TODO list; "DS" is preferred (but often too short)

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

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by hajo » Post

DS-minetest wrote:
hajo wrote:the userinterface is quite cumbersome.
minetest has no good interface for writing large texts,
i dont think, the userinterface of the simple_robot mod is cumbersome
simple_robot has a fixed number of 64 instruction-lines.
Instructions work like "action, if error goto line number x".
No labels for lines, no procedures/functions/gosub/return.
Also no variables, calculations, text and no output.

There is no way to insert/copy/move lines,
and no save/load to file or copy/paste.
Also, picking up a robot, and placing him again clears the program.

It might work, but I call that "cumbersome".
Maybe there are better words, like "uncomfortable", "unpleasant", "horrible" ...

I agree that text editing with formspecs is less-then-perfect,
but at least it provides copy&paste.
Also, for basic_robot, I suggested a library-system using books and "include",
so large text can be broken down.

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

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by hajo » Post

rnd wrote:Perhaps my basic_robot mod could be of help too - you can write simple lua programs
..
Example of simple program to navigate robot around and turn if it hits the wall

Code: Select all

if read_node.forward()~="air" then
    turn.right()
else
    move.forward()
end
BirgitLachner wrote:At least ...
- name the turtle
? remove the turtle and put it anywhere else without the need to rename it again
- use turtle with open remote control ..
- have an inventory to collect the diged blocks
- use the blocks in the inventory to put the blocks ..
- have a recorder to record and play sequences
Please have a look at rnd's basic_robot.

He did a lot of work on it during the last days,
it now has an inventory and a remote-control,
and can access/write to books.

Maybe with your feedback you can get the features
that are still missing from the turtles, from basic_robot.

And the simple, cubic look makes it easier to modify its outlook...

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by octacian » Post

hajo wrote:He did a lot of work on it during the last days,
it now has an inventory and a remote-control,
and can access/write to books.

Maybe with your feedback you can get the features
that are still missing from the turtles, from basic_robot.

And the simple, cubic look makes it easier to modify its outlook...
Turtles will soon have the ability to read and write to discs, as well as interact with an inventory. I will, however, take a look at basic_robot to get an idea as to how it works, and maybe Birgit will too.

I agree that the basic turtle should be simple, but, even with a complex one like Birgit's, it could still be easy to modify. However, modifying the turtles will not happen until we get meta nodedef (or something else like it).

Meta node def is where the properties of each block can be changed via meta (e.g. texture). I talked to celeron55 about this a while ago, but his branch had apparently been abandoned for the time and was inefficient anyways. Will talk again, however.
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

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

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by hajo » Post

endev15 wrote:
hajo wrote:Maybe with your feedback you can get the features
that are still missing from the turtles, from basic_robot.
I will, however, take a look at basic_robot to get an idea as to how it works,
and maybe Birgit will too.
I have been playing quite a lot with basic_robot, and wrote a page
like "Robot-manual & introduction-to-programming" on the wiki.

It has several example-programs, with comments and notes.
The programs start short, with really basic stuff,
then slowly introduce more and more features.

So I would like to get some feedback about that page, and basic_robot too.

For example, the bots just get the name of the user,
and changing the texture would only affect the local bots,
and all of them the same way.
Maybe team-colors, as a first step to customization ?

Also, how about storing 'private' data ?
As singleplayer, and using my own computer every time,
there is no issue storing code/pictures/screenshots etc.

But how about multiuser, and getting a different computer for every session ?
How about storing on usb-sticks/network/dropbox etc. ?

User avatar
octacian
Member
Posts: 597
Joined: Mon Dec 21, 2015 22:18
GitHub: octacian
IRC: octacian
In-game: octacian
Location: Canada

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by octacian » Post

Version 0.1 release is here! Just to recap all the latest discussion and commits, here's what the mod can do already and what can be expected in v0.2.

No recipes have been introduced yet, but turtles can always be found in the creative inventory. There are currently several turtles, but all have the same functionality and are currently available just for aesthetic preference.

After placing down a turtle, right click it to show the naming formspec. Though kind of buggy, it's stable because it won't crash Minetest. The bugs, however, probably won't ever be fixed considering what they are: when the name is left blank, the turtle has a entirely blank name; when the formspec is closed without naming, when you right click again, the normal formspec is shown and the turtle is named "Unnamed Turtle." It will be fixed if somebody wants it, but for now, it's fine.

The normal formspec is quite simple, even though it has tons of buttons (12 to be exact, guess that isn't that bad). Using the buttons, you (the player) can turn the turtle right or left, move it up or down, move it forward or backward, dig a node in front or under, and place dirt in front or under. Obviously the "Exit" button exits the formspec. A more confusing one though, is at the top right. It just has 3 sets of numbers. Well, those aren't just random numbers, they're the position at which the turtle is. It might be a bit confusing at first though, as the position doesn't update automatically when the turtle is moved. If you want to update the position after moving the turtle, click the button (hey, it's not a button for no reason).

Now, if you're wondering how in the world you can remember all of the above (I'm kinda being sarcastic, it's pretty easy after 2 minutes), don't worry. Instead of forcing you to do that, I've taken an extra 5 minutes so that whenever you hover over a button (except exit, duh), a tooltip appears explaining in plain English and not picture language.

Something worth noting about digging blocks, is that a turtle cannot break blocks with the unbreakable group set to "1". Though it can currently break protected blocks, a patch is in progress.

Version 0.2?
Well, version 0.2 probably won't have nearly as many new features as v0.1, considering that it was the first. Version 0.2 will mostly improve upon current features and expand with new ones. A few planned features include an inventory for storing blocks and placing blocks from, functional remote control, and a text-based editor.

This means that blocks dug with the turtle will end up in its own inventory, but a block cannot be placed if it is not already in the inventory. With the inventory, will come the ability to select which block to place, instead of just being limited to dirt.

Remote controls were originally required to access a turtle, but in this first release, I have entirely removed them for the time. The amount of work and complexity required to make a functional remote, made it seem unrealistic to do for the first release. However, when they are completed, remote controllers will come in two different varieties: single and multiple. Controllers of the single variety will be able to bind only to one turtle, while those of the multiple variety to multiple. Right-clicking a turtle will bind to it, and print a message in chat. Then, left-clicking with the remote will trigger the normal formspec.

The concept of an inventory is honestly quite simple, so doesn't need much explanation. The main formspec will be tabbed, much like the default creative inventory, with several tabs including inventory, text editor, and main. On the main formspec, I button will be added that will show a dropdown-like menu, with a search bar at the top. The menu will contain a list of blocks in the inventory, as well as how many are available.

The text-based editor is an equally simple and maybe even simpler idea. It is a simple textarea where you can code in Lua to control the turtle. Normal Lua syntax will be accepted, with support for functions, variables, loops, and everything else Lua. Code will run under a sandbox, and will not have access to any physical filesystem, though it will be able to write to SD Cards and the likes. An example of the API that will be used for moving a turtle to make a stairway follows:

Code: Select all

for i=1,10 do
    turtle.place("front", "default:stone")
    turtle.move("up")
    turtle.move("forward")
end
Anyways, that's about it for now. There's lots more to come!
MicroExpansion, Working Computers, All Projects - Check out my YouTube channel! (octacian)
I'm currently inactive in the Minetest community! So if I don't respond, that's why.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by rubenwardy » Post

This may come sooner than you expect... https://github.com/minetest-edu/turtleminer
(although my design differs a little)
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

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

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by BirgitLachner » Post

Hi ... I'm still alive :-) ... I follow the action that happens at github.

It's nice to see, that more and more people are interested in this mod. I'm still correcting tests. The third of four is finished at the moment. The last one will take one up to two weeks. Then I'll may be have some time to do something with the mod.
Then I'll hope to change the formspec for the remote control that should be different for the different animal turtles. Even if the remote control is removed at the moment.

JulienPavageau
New member
Posts: 9
Joined: Sun Nov 06, 2016 16:15
GitHub: JulienPavageau

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by JulienPavageau » Post

I would like to test the editor (see especially if I could start adapting blockly) but I can not seem to access it. Should I install anything other than the archive I find here https://github.com/minetest-edu/turtleminer ?

I would also like to add to my small fork a textarea with the script. I would like to be able to send what is recorded with the record button to be able to modify it by hand and in addition to add repeat loop like "3(DF)" to do "Dig front --> move Forward --> Dig front --> move Forward --> Dig front --> move Forward".
Image
This idea is inspired by this very good exercise of the french brebast contest :
http://castor-informatique.fr/questions ... easy%22%7D
But I don't know how to have a write access and also a read access to the contents (script_jp) of this textarea. Can anyone help me ?

JulienPavageau
New member
Posts: 9
Joined: Sun Nov 06, 2016 16:15
GitHub: JulienPavageau

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by JulienPavageau » Post

I answer myself ;-). It is a solution probably perfectible but it's work with reloading the formspec at each clic on a button.
The basic script is now also ok, you can test at https://github.com/JulienPavageau/TurtleMiner.
For exemple you can make a staircase with 5(3(PA)PH) (P is for the french verb Pondre = lay, A is for Avance = moving forward and H is for Haut = up) or make a "spirolatère" like in this image with : 4(3aD8aD5aD10aD5aD) (a is a shortcut for PA).
Image

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by rubenwardy » Post

My fork allows you to run scripts (although only statements so far) https://github.com/minetest-edu/turtleminer

I've been busy lately so haven't worked on it recently
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

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

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by hajo » Post

rubenwardy wrote:My fork allows you to run scripts (although only statements so far) https://github.com/minetest-edu/turtleminer
I tried that, and made a short tutorial of it,
but I could only get the turtles to work with the remote.

User avatar
rubenwardy
Moderator
Posts: 6978
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by rubenwardy » Post

you also need to install this mod for the scripting: https://github.com/rubenwardy/editor
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

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

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by hajo » Post

rubenwardy wrote:you also need to install this mod for the scripting
Done, and I added a chapter to my TurtleMiner-Tutor.

That editor is really nice, but it seems to miss buttons to delete & rename files.
Also: no help / list of commands, no comments, build/place seems not to work...

Why did you remove the remote-control in the current version ?
It is really handy for moving a turtle before starting a program.
Also, there is room for another button - I suggest "Run",
as in "run the program currently selected in the editor".

I could also see a 'user-defined remote', say 3x4 buttons with simple text-labels,
and a bunch of programs 'button1', 'button2', etc. in the editor.
Last edited by hajo on Fri Dec 16, 2016 11:39, edited 1 time in total.

JulienPavageau
New member
Posts: 9
Joined: Sun Nov 06, 2016 16:15
GitHub: JulienPavageau

Re: [Mod] TurtleMiner ... programmable turtles in Minetest

by JulienPavageau » Post

Using a worldedit's form, it's now possible to choose the node that the turtle uses to build :
https://github.com/JulienPavageau/TurtleMiner

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests