[Mod] basic_robot [basic_robot]

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

rnd wrote:
hajo wrote:is there a way to query the current energylevel,
Each new running step robot has 1 energy. that is all.
So, when exactly does that happen, and how does the robot know/check ?
Does it matter if several statements are on the same line,
if they are inside a loop, or in a function ?

Looking at the result, as in

Code: Select all

ok=dig.up()
also doesn't help, because dig can fail for other reasons too,
e.g. protection.

BTW, I already suggested to make returncodes more detailed, e.g.

Code: Select all

return false,"not enough energy"
I also tried to get the bots to do some simple crafting,
e.g. with some wood in robots's inventory:

Code: Select all

say("Crafting101")
s="default:wood"
--pickup(8); place.forward(s); dig.forward(s)

ok=check_inventory.self(s)
if ok then  say(s.." ok") else say("no "..s) end

s="default:stick"
s="doors:door_wood"
ok=craft(s)
if ok then say(s.." ok") else say(s.." fail") end
self.remove()
So far, only very few recipes worked (e.g. "darkage:chalk", "default:snowblock").
Is there a list of working recipes ?

If there is a problem when an item can be crafted from different indigrents,
how about starting the search with the item in slot#1 of the inventory ?

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

hajo wrote:* ROBOTS-server - Server-portrait .. Suggestions/additions
* A map at the top of that page ..
Ideas .. Bank ... Info-Point ...
The map of the central area is now updated to 2017-03, along with some other infos.

Some suggestions:
* mod for HUD - displays text for current tool when scrolling thru hotbar with mousewheel
That would be useful when there are several similar-looking items on the hotbar,
less checking, and less do/undo/change tool/redo with the wrong tree/stone etc.

* For testing that farming/fertilizer-stuff on singleplayer,
it would be nice if that was published as a mod.
Maybe some other servers might be interested in such a mod...

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

Bug:

Code: Select all

self.label("working")
--self.remove()
gives an #RUN ERROR when run with id=0.

BTW, it would be nice if that errormessage would include the id of the robot that failed.
(e.g. in a factory-setting, it is hard to guess which of several robots just had a problem)

Also, the sandbox-check complains about strings in comments, e.g. "_G", "for", "while".

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

Just as a reminder - the robots-mod is quite active, but all the talking and discussion
has happened online on the ROBOTS-server, and not here on the forum.

Some suggestions:
* with the new technic-capabilities, it would be nice if the robots
could use/produce/convert the energycrystals from basic_machines.

* Option for take() and insert() to use a slot number instead of an item-spec.
* also new command "swap(slot1, slot2)
This could be used to re-arrange/sort the inventory.
(Also, a starting point to introduce the concept for 'sorting' when teaching programming)

* allow select() in the sandbox, to give access to the elements in ...
E.g. say() as opposed to print() only allows a single string,
so output of several items is awkward, e.g. say("a="..a.." b="..b).
With select(), users could write their own functions with a variable number of arguments.

* new command 'turtle-interpreter': "ti(code)". E.g.

Code: Select all

ti("fffrrrra")
would do 3x "move.forward()", 4x "move.right()", then "activate.forward()".

* Maybe interpret uppercase commands as 'repeat command until error",
so the solution to the robot-challenge on the server could be written as

Code: Select all

ti("FRla")
This would make coding for the remote-control much shorter and easier.

* Also, user-definable remote-control using this ti().
E.g. define_remote(spec) where spec is a table of strings
for button-text and turtle-command, like
{"TLEFT","<", "FWD","f", TRIGHT",">", ... "ACTION", "u1"}
with u1 calling a user-defined command.

* new command "res,err = deploy.forward(code,id)".
This would work like place() and put a spawner (from inventory) in front of the robot,
load it with the program from the string code, optionally 'suggest' an id,
and return the id that was assigned (and an error-message, if any).

* Maybe add a new variable/function "self.code()"
for giving the new robot the same code as the one doing the deploy().

This could be used to populate a gameboard with robots as gamepieces (with skins),
or for 'leapfrogging' robots building a long bridge.

* self.skin() needs to return a result that tells if the specified texture could be loaded.
If the server can write an error to the logfile, it should be able to tell the user too.

* Also, a method to get a list of textures on the server available as skins.
E.g. output that list to a book in the robot's library.

* same for self.playsound() - tell if soundfile could be found&played.

* User-definable, 'simple skins', e.g. just 8x8 with 16 colors (= icons)
would be nice enough, and might provide a starting point for kid's creativity.
E.g. using a robot with such a skin as a flag / coat-of-arms.

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

rnd's robots-server is currently offline, presumably for the summer-holidays.

Edit: the robots-server is online again, with a game of ROBOTS_SKYBLOCK.
hajo wrote:the robots-mod is quite active
The latest updates were mostly bugfixes,
but new functionality was added too:

current version, 2017-08-03:
* improved editor - makes coding easier on mobile devices
* animations for robots - mobs and player-skins
This also supports sitting, walking etc.

previous version, 2017-07-18:
* digging stone can be configured to require energy
(trees or coal can be used as fuel to generate energy)
* books with code can be encrypted now (to keep code secret)

* skins for robots (ie. you can make them look like a chest, cart, or a nyancat :)
* sounds for robots (restricted to files already on the server)

Old news from 2017-04:
* robots got technic-abilities: can grind, smelt, compress and generate energy now
(but processing gold, mese, diamonds etc. requires upgrades, much like BMs)
That means: the fully automatic, self-upgrading factory is just a matter of software now

Old news from 2017-03:
* new keyboard-buttons with big numbers

Old news from 2017-02:
* robots can craft now (better than the autocrafter from BM :)

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] basic_robot [basic_robot]

by ManElevation » Post

you can do alot with this mod :P
Image
My Public Mods! Discord: Rottweiler Games#3368

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] basic_robot [basic_robot]

by ManElevation » Post

Simple Robots tutorials
viewtopic.php?f=3&t=18345
My Public Mods! Discord: Rottweiler Games#3368

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] basic_robot [basic_robot]

by ManElevation » Post

like the new texture on snowywastes?
Image
My Public Mods! Discord: Rottweiler Games#3368

xisd
Member
Posts: 54
Joined: Sun Oct 02, 2016 22:38

Re: [Mod] basic_robot [basic_robot]

by xisd » Post

I started using this mod and it is great !
I have a few question to wich I didn't find answers on the wiki or forum or readme... :

- Why is the purpose of the limited number of operation ? Is it some kind of anticheat or more a safety for the server ?
- What are the operations concerned by this limitation ? only dig and generate_power or are there other actions ?
- About the energy thing, documentation and error log could be more specific. I had to look at the mod code to figure it out and I'm still not sure to understand the upgrade system, how does it work ?
(I gathered that it is related to technic mod but I do no use it)

- If I understood correctly, only stone as a dig cost. Will this evolve or is it wanted this way ? If more are planned, using a default value for node that are not in the digcost array could be a good thing.

- I get free book in the library, even withount any privs and in survival mod. Is it normal or should it be fixed?

- Is there a way to export/import book to a text file ?(to move code around from a server to another, or to import code written in an external editor)

- Is there some documentation about the limitation of the robot in survival mod ?
I would suggest improving error messages to allow trial and error learing and adding a quick description in the in game help : things like wich operation are limited, the fact that the robot cannot fly, that digging as a cost, how to get energy and upgrade, etc...

Sorry that is a lot of questions, but I'm sure they have quick answers
Maybe I can help with implementing some of the things mentionned too (default digcost, no free books, ... ) you tell me

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

Re: [Mod] basic_robot [basic_robot]

by rnd » Post

Nice that you like it:) Mainly robots mod is just convenient sandbox manager to run your lua programs ingame. Its not really intended for regular minetest players but more toward those who like programming. With it you can make your own mods as a regular player, "inside" the game while you playing.

You can try to play on ROBOTS SKYBLOCK server, it uses it. There is all sorts of stuff (you can play robots like technic, only "grinder/smelter" machines are not phyisical objects but builtin robot functions, so you "program your technic", there are mini games, puzzle construction).

1. limited number of operation has 2 purposes: 1st safety to server to prevent using stuff like for i=1,9999999 do ... end or infinite recursions and 2nd more challenge when creating stuff like tree harvesters of automated farmers.

2. i use this mod on my ROBOTS-SKYBLOCK server and there having a lot of stone is central to gameplay (lava+water stone generator), hence i added extra challenge. This way you need to set up some sort of energy production first ( maybe automate wood cutting first)

3. robots use books as universal storage device (you can safely store few 10 kbytes on book, it will just lag a lot if you try to read it as player or move between inventories). I could add check for book being present inside "library" but didnt feel it necessary at the time.

4. since if you play as admin you can do "anything", its easy to write a robot program that opens file and writes any data to it or whatever else you want.

5. im aware that i need to make help system better. For now its a lot of "code browse".
1EvCmxbzl5KDu6XAunE1K853Lq6VVOsT

xisd
Member
Posts: 54
Joined: Sun Oct 02, 2016 22:38

Re: [Mod] basic_robot [basic_robot]

by xisd » Post

Thank you for the quick answer !
I may drop by the ROBOT-SKYBLOCK server when I have a more steady access to the web, for now I only use a local server.
rnd wrote: Its not really intended for regular minetest players but more toward those who like programming.
I would like to use it as a way for regular minetest players to realize that they like programming :)

I ask all these question because of a project I've been working for a while : I am setting up a local server to run at a youth center or mediatheque, either as an open access server or as a regular (weekly or something) animated game time, or both (I hope).

So for that purpuse, I bundle together some mods in addition to the default minetest_game.

Server is in survival mode, without pvp.
The goal is to have a coherent set of features with "educationnal" possibilities but that doesn't break gameplay and progression.
Players have to dig and wander to get materials, to do what they want with it, etc., and they are free to totally miss out those features.

There are no learning imperative but the game includes things that encourages and rewards things that players are not a priori always familiar with, like collaborative work, english learning (I'm talking about french players), programming, etc, etc.

So robots are a perfect exemple of things I am looking for because, the way I see them, it is possible to play without them but learning how to use them is rewarded by having a lot of new possibilities. And Your mod as this challenging part that make it a real addition, even in survival mode, it

So with all that in mind :
rnd wrote: 1. limited number of operation has 2 purposes: 1st safety to server to prevent using stuff like for i=1,9999999 do ... end or infinite recursions
But to my understanding you still can do an infinit loop as long as you do not dig or generate power, or am I wrong?
rnd wrote: 2nd more challenge when creating stuff like tree harvesters of automated farmers.
Ok, I feared that for players new to programming, the challenge part would be an obstacle but I think I will keep it anyway.
rnd wrote: 2. i use this mod on my ROBOTS-SKYBLOCK server and there having a lot of stone is central to gameplay (lava+water stone generator), hence i added extra challenge. This way you need to set up some sort of energy production first ( maybe automate wood cutting first)
I like the idea, why not calculate energy coste based on thoughness of material ? This might be possible to by checking wich groups the node to dig
rnd wrote: I could add check for book being present inside "library" but didnt feel it necessary at the time.
I think this is actually the only aspect that feel like a bit of a cheat on survival mode. This would be really great if you could add this check.
rnd wrote:write a robot program that...
Now that you say it.. I should have thought of that :) !
rnd wrote:im aware that i need to make help system better. For now its a lot of "code browse".
Maybe I can help with that part, if you are ok with those things I can do it an make a pull request on github :

- Making error messages very specific so that if program fails, you know exacly why.
- Colorizing this help menu and making it shearchable
- Adding some kind of introduction to it, detailling some aspect of the basic behavior (limited number of action, cannot be above more than one empty (air) block, ...)
(Writting in english is not my strongest suit but as long as someone can do some rereading, that should be ok)

I can also add support for translation and make the french translation but it may be better to wait until the new minetest.get_translator is fully functionnal

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

xisd wrote:I would like to use it as a way for regular minetest players to realize that they like programming :)

local server to run at a youth center or mediatheque .. bundle together some mods
set of features with "educationnal" possibilities ..encourages and rewards collaborative work,
english learning .. programming, etc, etc.
There are some teachers on the forum, who want to use minetest in schools,
and also use robots to teach programming.

Building a robot in survival-mode is not easy (ie. it needs 6 mese),
so on the robots-server there is a shop that sells cheap robots,
to encourage using/programming robots.
rnd wrote:im aware that i need to make help system better.
That's why I started the wiki-page about robots (see link in sig).

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

rnd wrote:robots mod is just convenient sandbox manager .. not really intended for regular minetest players
but more toward those who like programming.

1. limited number of operation has 2 purposes:
1st safety to server to prevent using stuff like for i=1,9999999 do ... end or infinite recursions
2nd more challenge when creating stuff like tree harvesters of automated farmers.
When teaching programming, I think those features as currently implemented in the mod
are not the best way to handle these kind of problems, and kids don't need 'extra challenges'.

I would prefer extra error-messages, and maybe slowdown of the robot after a certain number of calls/loops.
on ROBOTS SKYBLOCK .. there are mini games, puzzle construction
BTW, there is a new version of the robot-mod, 2017-10-07a

Main features:
* robot_version()
* more symbols for keyboard.set() - numbers, uppercase+lowercase letters, graphics
* some more directions, to support all adjacent spaces (eg. left_up, left_down)
* boost(), to set speed of robot

* puzzle-commands, to better support programming games
** triggers & actions, eg. to detect when players reach positions
** generate/remove blocks - eg. to block/open passages
** access to inventories, game- and player-data - eg. to give rewards
** particles - eg. for visual effects

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] basic_robot [basic_robot]

by christoferlevich » Post

I am very excited about this mod and I started testing the math quiz bot. All works except the players can't tell it they have answered correctly or not - nor do they get a second question.

When I hit a math quiz bot as the admin who created it, I see the first problem, the response (correct or incorrect) - and then a next problem if correct - and so on.

As a player, all I see is the first question. The only way a player would know if they got a question right is if an item (reward) is in the chest!
everything can be a learning experience...

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

christoferlevich wrote:testing the math quiz bot .. players can't tell it they have answered correctly
As a player, all I see is the first question.
You need to set the spam-option:
> self.spam(0/1) (dis)enable message repeat to all

The default is to only show the first message of a robot to all players,
further messages are only shown to the owner of the robot.

Alternatives:
> self.label(text)
> self.display_text(text,linesize,size)

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] basic_robot [basic_robot]

by christoferlevich » Post

You have saved the day hajo!

thank you so much!
hajo wrote:
christoferlevich wrote:testing the math quiz bot .. players can't tell it they have answered correctly
As a player, all I see is the first question.
You need to set the spam-option:
> self.spam(0/1) (dis)enable message repeat to all

The default is to only show the first message of a robot to all players,
further messages are only shown to the owner of the robot.

Alternatives:
> self.label(text)
> self.display_text(text,linesize,size)
everything can be a learning experience...

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] basic_robot [basic_robot]

by christoferlevich » Post

So I wanted to come back and explain why I am so very excited about your mod as it will take my 'educational sub-game' to the next level. I am sure other educators will be using it soon as well! The random math quiz 2 is virtually perfect for using it as a means to provide students with currency and/or 'rewards' for in-game use.

One of the things I deal with because I play in a classroom with 20 plus students is begging for free stuff face to face. Its harder to say no to an excited 8 yrs old who needs that lamp from the 'homedecor' mod to finish their perfect house than it is someone texting on a server. lol. With these robots, I can quickly and easily set up a means to provide that without just giving them 'free stuff'.

I am looking forward to using these amazing little coded robots in many new ways!

These robots are just what I need to inspire them to start coding in the game as well - as LUA feels like a step up from the 'OSMO' Coding (an iPad app that teaches the very basic concepts of coding), and it is OPEN SOURCE!

Many teachers in my school 'think' the sub-game we are fashioning should be released commercially. I keep trying to explain the idea behind open source doesn't involve charging kids to play a fun 'educational' game. I hope the students I am teaching come away with a heart for open source as well. :) Bravo HAJO! and a billion thanks to MD!
everything can be a learning experience...

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

christoferlevich wrote:explain why I am so very excited about your mod
I wrote some bits of documentation, the mod itself is from rnd.
The random math quiz 2 .. to provide students with currency and/or 'rewards' for in-game use.
.. students begging for free stuff face to face. ..
With these robots, I can quickly and easily set up a means to provide that
Maybe you should set up some 'regular' shops too.
I am looking forward to using these amazing little coded robots in many new ways!
I have quite a few robot-programs on the wiki,
and rnd has a directory with example-programs in the mod,
as well as on the robots-server.
These robots are just what I need to inspire them to start coding in the game as well -
as LUA feels like a step up from the 'OSMO' Coding (an iPad app that teaches
the very basic concepts of coding), and it is OPEN SOURCE!

I keep trying to explain the idea behind open source
Well, FOSS is not exactly new (Linux, BSD, Apache, Firefox, OpenOffice, MySQL, GIMP, Blender etc.),
so it is hard to imagine how anybody could have missed the idea by now.
Last edited by hajo on Wed Dec 06, 2017 13:31, edited 1 time in total.

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] basic_robot [basic_robot]

by christoferlevich » Post

The thought process in public ed in my district seems to be pay more for less and ignore free stuff... lol
everything can be a learning experience...

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] basic_robot [basic_robot]

by christoferlevich » Post

One more stupid question (Its stupid because I am certain the answer is obvious and I am just missing something) - but how do I make the bot talk only to the nearest player?
everything can be a learning experience...

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] basic_robot [basic_robot]

by christoferlevich » Post

Actually - I think I want to set up private messages between the person activating the robot and the robot, but I am not finding a way yet. Maybe I need to do something closed from separate from chat (like a terminal window?).
I'll keep trying different things...
everything can be a learning experience...

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

christoferlevich wrote:how do I make the bot talk only to the nearest player?
I want to set up private messages between the person .. and the robot
terminal window?
> self.display_text(text,linesize,size) displays text instead of robot face
this acts pretty much as a small terminal window

> write_text.direction(text,mode) writes text to target block as infotext
with this, you can write text on nearby signs

The keypads from basic-machines can be used for text-input.

Also, robots can show a dialog/formspec to a player (see the spawn-mathquiz).

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] basic_robot [basic_robot]

by christoferlevich » Post

I'd love to use the robot itself as a terminal... but I keep getting an error...
519:bad argument #1 to 'len' (string expected, got nil)

Is there an example script I can look at? I am seriously 'green' at all this.

Code: Select all

-- 
This simple program makes the robot 'talk', as in 'write text to the chat'.
  self.display_text(text,10,3)
say("Hello! I'm a robot.")
 say("A random number: " .. math.random() )
self.remove()   -- stop
I am trying this based on code I read in the shop bot.

Also, I can't 'find' spawn-mathquiz anywhere!
everything can be a learning experience...

User avatar
christoferlevich
Member
Posts: 325
Joined: Thu Dec 01, 2016 23:44
GitHub: ChristoferL
Location: Athol, Massachusetts

Re: [Mod] basic_robot [basic_robot]

by christoferlevich » Post

christoferlevich wrote:I'd love to use the robot itself as a terminal... but I keep getting an error...
519:bad argument #1 to 'len' (string expected, got nil)

Is there an example script I can look at? I am seriously 'green' at all this.

Code: Select all

if not s then s=1;text = ""; for i=0,255 do text=text..string.char(i) end; self.display_text(text,16,1) end
I am trying this based on code I read in the forum. Now I have to figure out how to define 'text' as the math problem?

Also, I can't 'find' spawn-mathquiz anywhere!
everything can be a learning experience...

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

Re: [Mod] basic_robot [basic_robot]

by hajo » Post

christoferlevich wrote:I keep getting an error... Is there an example script I can look at?
See the first few lines of the Furnace-Feeder, eg. :

Code: Select all

if not pn then pn="Furnace-Feeder"
  msg=self.name().."\n"..pn
  self.display_text(msg,8,1)

  i=0
end

i=i+1
self.label(i)

if i>10 then say(pn.." done"); self.remove() end
\n is a newline-char.

If this is my first robot, (and/or the id is set to 1),
it will get the name "hajo1", so the textdisplay will show
hajo1
Furnace-
Feeder
ie. spreading the program-name over 2 lines
because the linesize is 8 chars.

Don't make the linesize too big, or the textsize will get hard to read.
Unless you really need/want specialeffects, you better keep param3, size, at 1.
Also, I can't 'find' spawn-mathquiz anywhere!
You are right, Math_quiz1 + quiz2 are both chat-based.
I'll try to dig up the program for the spawn-quiz, from the old robots-server...
Last edited by hajo on Fri Dec 08, 2017 10:24, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 58 guests