Client for kids programming

Post Reply
hilaire
New member
Posts: 7
Joined: Wed Nov 30, 2016 09:43
GitHub: hilaire
Location: Geneva
Contact:

Client for kids programming

by hilaire » Post

Hi,

This is my first post to Minetest forum, so I hope I am posting at the right place. Correct me if I am wrong.

I will briefly present myself for the context. I teach math and ICT in junior high in Geneva. In my free time, I wrote DrGeo, a free interactive geometry and programming environment. As a teacher I am always interested to teach programming. I did some programming teaching with Python, Squeak, Scratch and DrGeo with Pharo language. A couple of years ago I used Minetest in a school project.

I am interested to explore the concept of a Minetest client whose interface is mainly user programming. The idea is no to build a mod, but to manipulate the avatar by programming, like a turtle. WorldEdit is the closest match I found.

Ideally the user will manipulate its avatar only by programming. For example to build a square tower 100 blocs in height, one will code something like:

Code: Select all

100 timesRepeat: [
    avatar goUp
    4 timeRepeat: [
        10 timesRepeat: [avatar dropBrick; moveForward].
        avatar turnLeft] ]
Were any attempts in this direction done in the past?

Thanks

Hilaire

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Client for kids programming

by Krock » Post

Hello and welcome to Minetest.

Here are a few mods that might be interesting to you:

basic_robot - Lua
miners_robots - graphical
turtle - Forth or custom assembly
turtleminer - graphical (WIP?)
simple_robots (fork) (based on simple_robots (forum)) - graphical (maybe?)

digtron - complicated, maybe programming?
mesecons - not building, but programming Lua controllers (Lua) and FPGAs for logic circuits

Shameless advertisement for the Mod Search Engine

In theory it is possible to expose and/or translate a custom language to Lua to manipulate stuff in-game, but I don't know of any mod that implements such a feature. Code based on user input also needs to be secure and breakable in execution (while true do end, for example).
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

hilaire
New member
Posts: 7
Joined: Wed Nov 30, 2016 09:43
GitHub: hilaire
Location: Geneva
Contact:

Re: Client for kids programming

by hilaire » Post

Hi,

Thanks for the pointers to the mods. I did not realize their capabilities, it is impressive.

My initial naive thought was a dedicated Pharo based client communicating directly with the Minetest server. It will be used in place of the traditional Minetest cllient. Well a guest should connect to the traditional Minetest client for visual feedback, though.

This client will authenticate with the avatar credentials, then send to the server the commands resulting from the user programming. Debugging, step by step execution, error handling will be handled by this client.
In my understanding, it will not require Lua nor a dedicated mod.
No idea it is doable, though

Btw, is there a http api, or is it just udp level?

Thanks

User avatar
jp
Banned
Posts: 947
Joined: Wed Dec 18, 2013 09:03
GitHub: kilbith
Location: France

Re: Client for kids programming

by jp » Post

At Kidscode (commercial fork of Minetest) we have developed an advanced programmable robot for kids.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Client for kids programming

by Sokomine » Post

hilarie wrote: My initial naive thought was a dedicated Pharo based client communicating directly with the Minetest server. It will be used in place of the traditional Minetest cllient. Well a guest should connect to the traditional Minetest client for visual feedback, though.
Why not take a traditional turtle bot and let it look like a player's avatar? I think that would be way easier.

There's at least one player who modified his client's code so that his avatar flew over a server where contact with the admin was lost and the map could only be saved this way. So it's mostly doable - just a lot of effort and probably very prone to errors (avatar dying, beeing teleported by someone, disagreement of client and server about where the client currently is, ..). And if the children would try to connect to any regular server with such a client, they'd very soon get banned.
hilarie wrote: This client will authenticate with the avatar credentials, then send to the server the commands resulting from the user programming. Debugging, step by step execution, error handling will be handled by this client.
In my understanding, it will not require Lua nor a dedicated mod.
No idea it is doable, though
There's no need to fear lua :-) It's just another programming language. The avatar ought to be controlled by a lua mod on the server's side. How you control that mod and issue commands for it - that's your decision. Directly ingame might be easiest in most cases (I think most turtle bots work that way), but you can also use that mod as an API for your own client and let whatever interface you choose to program talk to the lua mod.
hilarie wrote: Btw, is there a http api, or is it just udp level?
The api is a lua mod. If there's any other protocol to talk (like i.e. IRC or HTTP), then it's usually through a lua mod as well.

Perhaps you ought to take a look at the raspberryjammod. If you get it to work, that mod might already do all you asked for.
A list of my mods can be found here.

hilaire
New member
Posts: 7
Joined: Wed Nov 30, 2016 09:43
GitHub: hilaire
Location: Geneva
Contact:

Re: Client for kids programming

by hilaire » Post

Sokomine wrote: Why not take a traditional turtle bot and let it look like a player's avatar? I think that would be way easier.
Yes, that's an option. The programming environment may be limited, though.
Sokomine wrote:There's no need to fear lua :-) It's just another programming language. The avatar ought to be controlled by a lua mod on the server's side. How you control that mod and issue commands for it - that's your decision. Directly ingame might be easiest in most cases (I think most turtle bots work that way), but you can also use that mod as an API for your own client and let whatever interface you choose to program talk to the lua mod.
I need time to digest this.
Lua is fine but I am inclined to think this layer may not be necessary.
Sokomine wrote:
hilarie wrote: Btw, is there a http api, or is it just udp level?
The api is a lua mod. If there's any other protocol to talk (like i.e. IRC or HTTP), then it's usually through a lua mod as well.
Hum, let me rephrase my initial question.
Are not both server and client written in C++. How do the client communicate with the server if not through UDP. I guess this communication part is written in C++ too. Is it just bare bone UDP[1] or does it use a higher level protocol as HTTP for client-server communication?

[1] https://dev.minetest.net/Network_Protocol

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: Client for kids programming

by Sokomine » Post

hilarie wrote: Yes, that's an option. The programming environment may be limited, though.
Depends what you've got in mind. If your intention is to create an AI that behaves like a (young, not too socialiced) player...even that has been done in lua (see AliveAI).
hilarie wrote: Are not both server and client written in C++. How do the client communicate with the server if not through UDP. I guess this communication part is written in C++ too. Is it just bare bone UDP[1] or does it use a higher level protocol as HTTP for client-server communication?
I'm no expert on MT's network protocol. AFAIK it's mostly UDP. When connecting to a server, media data (textures and models) are sent to the client if the client hasn't already cached them. This media transfer can use HTTP. During gameplay, the client sends commands to the server about what the player did, and the server sends mapblocks, player position data, formspecs and the like. And all that's of little relevance to your stated goal of teaching children to program because making sense of that kind of information would be more in the line with learning to control a game client with AI. That's...very...far from the visual programming intended for children for which programming is something new.

The Lua api is very powerful. You can use it to establish your own network protocol and client.
A list of my mods can be found here.

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

Re: Client for kids programming

by rubenwardy » Post

hilarie wrote: Is it just bare bone UDP[1] or does it use a higher level protocol as HTTP for client-server communication?
Minetest uses a custom protocol over UDP to do networking. This protocol has a higher level and a level level to it. The lower level deals with channels and reliability, the higher level deals with comands like "set this node" or "move to this position".
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

hilaire
New member
Posts: 7
Joined: Wed Nov 30, 2016 09:43
GitHub: hilaire
Location: Geneva
Contact:

Re: Client for kids programming

by hilaire » Post

rubenwardy wrote: Minetest uses a custom protocol over UDP to do networking. This protocol has a higher level and a level level to it. The lower level deals with channels and reliability, the higher level deals with comands like "set this node" or "move to this position".
Thanks for the updates.
I guess this is the relevant doc https://dev.minetest.net/Network_Protocol?
The higher level protocol is likely the place to look at. I will start with authentication then.
Sokomine wrote: player position data, formspecs and the like. And all that's of little relevance to your stated goal of teaching children to program because making sense of that kind of information would be more in the line with learning to control a game client with AI. That's...very...far from the visual programming intended for children for which programming is something new.
I am not looking at kid programming a client nor at visual programming for kid, but textual programming for kid. With an appropriate DSL kid will code the avatar to move, dig, build. It will be done within the Pharo live programming environment where you can easily step, debug, etc. Like it is done for interactive geometry programming with DrGeo but code will be simpler as for example:

Code: Select all

../..
100 timesRepeat: [
    avatar goUp
    4 timesRepeat: [
        10 timesRepeat: [avatar dropBrick; moveForward].
        avatar turnLeft] ]
The trickier code to write is likely the communication part with the server, I am not much used to that. The DSL part should be easier.
I am still exploring the feasibility, though.

hilaire
New member
Posts: 7
Joined: Wed Nov 30, 2016 09:43
GitHub: hilaire
Location: Geneva
Contact:

Re: Client for kids programming

by hilaire » Post

rubenwardy wrote: Minetest uses a custom protocol over UDP to do networking. This protocol has a higher level and a level level to it. The lower level deals with channels and reliability, the higher level deals with comands like "set this node" or "move to this position".
Hi,

I try to figure out the content of the inital datagram to send to my server (a localhost instance).
So far, reading the code bellow (by the way the link in the wiki should be changed from src/client.cpp to src/client/client.cpp):

Code: Select all

void Client::sendInit(const std::string &playerName)
{
	NetworkPacket pkt(TOSERVER_INIT, 1 + 2 + 2 + (1 + playerName.size()));

	// we don't support network compression yet
	u16 supp_comp_modes = NETPROTO_COMPRESSION_NONE;

	pkt << (u8) SER_FMT_VER_HIGHEST_READ << (u16) supp_comp_modes;
	pkt << (u16) CLIENT_PROTOCOL_VERSION_MIN << (u16) CLIENT_PROTOCOL_VERSION_MAX;
	pkt << playerName;

	Send(&pkt);
}
I send to the server the following datagram, built has:

- 1 byte: 2 "TOSERVER_INIT"
- 1 byte: 28 "SER_FMT_VER_HIGHEST_READ"
- 2 bytes: 0 "NETPROTO_COMPRESSION_NONE"
- 2 bytes: 37 "CLIENT_PROTOCOL_VERSION_MIN"
- 2 bytes: 38 "LATEST_PROTOCOL_VERSION"
- a byte sequence null terminated "Player name"

The server does not respond back. Am I missing something in this datagram?

Thanks

hilaire
New member
Posts: 7
Joined: Wed Nov 30, 2016 09:43
GitHub: hilaire
Location: Geneva
Contact:

Re: Client for kids programming

by hilaire » Post

Any tips, even minimal, could be useful.
hilaire wrote:I send to the server the following datagram, built has:

- 1 byte: 2 "TOSERVER_INIT"
- 1 byte: 28 "SER_FMT_VER_HIGHEST_READ"
- 2 bytes: 0 "NETPROTO_COMPRESSION_NONE"
- 2 bytes: 37 "CLIENT_PROTOCOL_VERSION_MIN"
- 2 bytes: 38 "LATEST_PROTOCOL_VERSION"
- a byte sequence null terminated "Player name"

The server does not respond back. Am I missing something in this datagram?

Thanks

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: Client for kids programming

by Krock » Post

The connection must be initialized first to make sure it's really the correct protocol:
https://github.com/minetest/minetest/bl ... txt#L8-L23
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
texmex
Member
Posts: 1753
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: Client for kids programming

by texmex » Post

Sounds like you’re looking for this: https://github.com/miney-py/mineysocket

hilaire
New member
Posts: 7
Joined: Wed Nov 30, 2016 09:43
GitHub: hilaire
Location: Geneva
Contact:

Re: Client for kids programming

by hilaire » Post

@texmex, @Krock, tanks for the tips they look like valuable information I will use.

acs
New member
Posts: 4
Joined: Tue May 05, 2020 02:52
GitHub: acs
IRC: acs
In-game: ElasticExplorer

Re: Client for kids programming

by acs » Post

I am in a project in which the goal is to teach technology to kids (https://www.juntosdesdecasa.com/, Spanish). One of the workshops is about programming with Minecraft for kids, and for that, we are using Python and the Raspberry API created some years ago .

Luckly, Minetest has support for this API with the mod raspberryjammod pointed out by Sokomine. And this mod works in Minetest 5.1 (I have not tested it yet in 5.2).

With it, you can develop in Python and create things inside minetest in a pretty easy way. I am working in a project called McThings originally created for Minecraft, but that works out of then box with Minetest. Some Jupyter notebooks with samples. My goal is to have a framework for creating easily scenes inside Minetest based on already existing things. And the final goal is to teach kids programming with the motivation of doing it inside minetest/minecraft.

I hope it helps.

Miney
New member
Posts: 4
Joined: Sat Jan 02, 2021 11:47

Re: Client for kids programming

by Miney » Post

texmex wrote:
Sun Jan 19, 2020 00:03
Sounds like you’re looking for this: https://github.com/miney-py/mineysocket
Hi, i'm the developer of Miney ( https://miney.readthedocs.io/en/latest/ ) and the mineysocket mod.

Miney will be the exact thing you are looking for.

The reason you don't hear about miney in the forum is, that i don't see it as stable and complete, as i wish. So i don't promoted it, until i feel ready.
I'm currently prepairing the release of version 0.3, that will have many changes in the API and many new feature (can be previewed in the dev branch). That will be the first version, that could be near a stable version, but i don't pressure myself.
The goal is to provide a well documented, pythonic and easy accessible API to minetest for Python.

I've just created a discord channel to get in touch with me: https://discord.gg/jCzZ7qs6ZT

c56
Member
Posts: 307
Joined: Wed Apr 21, 2021 03:05
GitHub: tigercoding56
In-game: bm5 or bemo5 also sell_her_on55

Re: Client for kids programming

by c56 » Post

Miney wrote:
Mon Jan 11, 2021 19:27
texmex wrote:
Sun Jan 19, 2020 00:03
Sounds like you’re looking for this: https://github.com/miney-py/mineysocket
Hi, i'm the developer of Miney ( https://miney.readthedocs.io/en/latest/ ) and the mineysocket mod.

Miney will be the exact thing you are looking for.

The reason you don't hear about miney in the forum is, that i don't see it as stable and complete, as i wish. So i don't promoted it, until i feel ready.
I'm currently prepairing the release of version 0.3, that will have many changes in the API and many new feature (can be previewed in the dev branch). That will be the first version, that could be near a stable version, but i don't pressure myself.
The goal is to provide a well documented, pythonic and easy accessible API to minetest for Python.

I've just created a discord channel to get in touch with me: https://discord.gg/jCzZ7qs6ZT
sorry for being late to post but do you have information on how to install the mineysocket mod ?
this is a signature not a place to post messages also if i could change my username i would change it to sell_her_on55

User avatar
Miniontoby
Member
Posts: 616
Joined: Fri Mar 01, 2019 19:25
GitHub: Miniontoby
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

Re: Client for kids programming

by Miniontoby » Post

Ohhh like the Skript plugin/language for minecraft plugins...

If this still needs a good code to do this, pls let me know and i'll try to make it


But this would also look to be good: viewtopic.php?f=9&t=26455



Or as like Minecraft Pi?
Working on mtctl ---- Check my mod "Doorbell" -- Stay safe

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests