Page 1 of 3

Google Blockly (better than Scratch) for easy visual mod development

Posted: Thu Nov 14, 2013 01:18
by Neuromancer
A while back, I threw out the idea of using scratch to program mods, that wouldn't have worked out because scratch is a specific purpose language. Then I found blockly. It uses the visual programming of scratch, but lets you output/generate ANY language (in our case it could be lua). But what is also really cool is that it lets you create custom blocks that could be specific to Minetest modding. Thus there could be blocks to define nodes, nodeboxes or any other common aspect of Minetest modding.

Why is this cool? Because it would allow anyone to create Mods for minetest, even kids and non-developers.

Posted: Thu Nov 14, 2013 01:58
by Inocudom
I found the link to Google Blocky's website. Look below:
http://code.google.com/p/blockly/?redir=1

Posted: Thu Nov 14, 2013 03:07
by hoodedice
Inocudom wrote:I found the link to Google Blocky's website. Look below:
http://code.google.com/p/blockly/?redir=1
I checked it out too. It's cool.

Code: Select all

Please do not attempt to maintain the Linux kernel using Blockly. 

-Google.
While it is cool, creating the modding API in Blockly will take a LOT of time. The app comes with Java and Python in-built, which means that someone will have to add lua support. Which is a lot.

Code: Select all

 Blockly is not an executable that can be double-clicked and played with.

Posted: Thu Nov 14, 2013 08:50
by rubenwardy
I cant see any way to actually make a project or use it.

It is also very unpolished.

Therefore, not better than scratch.

Posted: Thu Nov 14, 2013 17:09
by Inocudom

Code: Select all

Please do not attempt to maintain the Linux kernel using Blockly. 

-Google.

Code: Select all

 Blockly is not an executable that can be double-clicked and played with.
Those words. I sense great hatred in those words.

Posted: Fri Nov 15, 2013 01:07
by Neuromancer
I agree that it will take a lot of time to implement every aspect of lua, but we could start with just the basics that are used most commonly for Minetest Mods. I think you meant it currently has javascript implemented in it. I'm hopefully going to be using it to implement c#, so maybe I will learn a bit and that can help us do lua.

Posted: Fri Nov 15, 2013 01:13
by Neuromancer
rubenwardy wrote:I cant see any way to actually make a project or use it.

It is also very unpolished.

Therefore, not better than scratch.
It would be impossible to use scratch to generate luascript. It would just be a fair amount of work to do it in blockly. Blockly isn't better than scratch in general. But it is better for doing things like generating lua for Minetest mods. It is a code generator.

It has been used to do home automation projects see Domoticz.
http://www.openremote.org/display/forum ... ing+editor

It's all about creating custom blocks:
https://code.google.com/p/blockly/wiki/CustomBlocks
https://code.google.com/p/blockly/wiki/DefiningBlocks

Posted: Fri Nov 15, 2013 02:23
by BrandonReese
Seems harder than just writing code to me...

Posted: Fri Nov 15, 2013 03:26
by Inocudom
If there are ways to get Google Blocky to work with Lua, then it could be useful. Of course, the modding api is a very important point to consider.

Would the authors of Google Blocky even allow for it to be used on open source projects?

Posted: Fri Nov 15, 2013 14:25
by hoodedice
It is, indeed like Brandon said, much more harder to implement than just writing the code.

I'm not a programmer (yet), however, I've downloaded that thing (Plus, used subversion for the first time) and I've checked it out and believe me when I say this: It ain't beautiful nor is it easy to implement any language in it. It's a major PITA (Not the one that says Plugging in the Answers).

For starts, Blockly has no syntax. People just connect blocks and a code is generated. The blocks must add the syntax themselves. Next, even adding the syntax isn't a day's work. There is something called an order of operation or something, which requires a knowledge of Lua in entirety. And then defining this is again, not pretty. Like the devs have themselves told, it isn't an executable that can be double clicked and played with. It's more like playing Minetest with a binary input method XD

A scratch like method for making mods is very possible, however I feel that Blockly, though Open Source isn't the framework we need. As Ruben said, it is VERY unpolished.

@Inocudom: It wasn't hating on it, Blockly is fun. But not so fun to create it. Plus Blockly is open source so of course we can change it to our needs and use it for whatever.

EDIT: Scratch too is open source.

EDIT 2: Rest assured, I'm seeing if there is an easier way to implement this. By easier, I mean a way in which I have to learn a minimum of programming lingos (Since I don't know any) to get the thing we want. So, I'm currently lookig if love2d can do the task (Yes, I'll try to start it from nothing) since love2d is in lua and lua is what we need anyway.

Posted: Sat Nov 16, 2013 00:09
by Neuromancer
I did find someone using blockly to generate Lua (ironically for Minecraft)
https://groups.google.com/forum/#!topic ... D13auzJ5m4

"I've working on a Blockly fork that supports generating Lua code to control ComputerCraft turtles in Minecraft. Testers, contributors, advisors, and evangelists are needed:"

http://blockly-lua.appspot.com/static/a ... index.html
https://github.com/espertus/blockly-lua
http://www.computercraft.info/forums2/i ... ockly-lua/


It looks pretty full featured already. Maybe she'll let us use it...

Posted: Sat Nov 16, 2013 02:28
by Blockly
Neuromancer wrote:I did find someone using blockly to generate Lua (ironically for Minecraft)
It looks pretty full featured already. Maybe she'll let us use it...
Let you? I'd be delighted. In any case, it's open source. Go for it, and let me know if you have any questions (or fixes).

Posted: Sat Nov 16, 2013 02:45
by Neuromancer
Blockly wrote:
Neuromancer wrote:I did find someone using blockly to generate Lua (ironically for Minecraft)
It looks pretty full featured already. Maybe she'll let us use it...
Let you? I'd be delighted. In any case, it's open source. Go for it, and let me know if you have any questions (or fixes).
Whoa, you're not just the person who wrote the lua generator for blockly, you're the inventor/primary developer of Blockly?!

Posted: Sat Nov 16, 2013 03:27
by general3214
Neuromancer wrote:
Blockly wrote:
Neuromancer wrote:I did find someone using blockly to generate Lua (ironically for Minecraft)
It looks pretty full featured already. Maybe she'll let us use it...
Let you? I'd be delighted. In any case, it's open source. Go for it, and let me know if you have any questions (or fixes).
Whoa, you're not just the person who wrote the lua generator for blockly, you're the inventor/primary developer of Blockly?!
I think you're confused, Neuromancer; if you go to Blockly's profile, you'll see that her (real) name is Ellen Spertus.

Posted: Sat Nov 16, 2013 04:02
by hoodedice
Well, that's a nice sequence of plot twists! XD

Hello Ellen and welcome to the minetest forums. It's always nice to see Minecraft people supporting Minetest :)

Posted: Sat Nov 16, 2013 04:09
by general3214
hoodedice wrote:Well, that's a nice sequence of plot twists! XD

Hello Ellen and welcome to the minetest forums. It's always nice to see Minecraft people supporting Minetest :)
How many Minecrafters have you met so far?
Spoiler
It's weird how discussions can get off topic in Minetest Forums; the staff at Minecraft Forum is strict.

Posted: Sat Nov 16, 2013 04:37
by hoodedice
Quite a few, but I don't get their names from the top of my head... :/

I don't know JavaScript. As such, though Espertus' code is really nice and sorta complete, and all that needs to be added is the API, I can't. Someone else will have to do this :(

Posted: Sat Nov 16, 2013 05:47
by Blockly
Neil Fraser (https://neil.fraser.name/) is the inventor of Blockly, although I've been able to work on it and created the Lua fork.

FWIW, I didn't know JavaScript when I started working on Blockly. It's not hard to add new blocks by imitating existing ones, after which you start picking it up. There's also a "support group" (https://groups.google.com/forum/#!forum/blockly), which Neuro Mancer has already joined.

Posted: Sat Nov 16, 2013 07:07
by general3214
XD Neil Fraser has goofy smile.

Posted: Sat Nov 16, 2013 14:01
by Inocudom
I am liking this turn of events. In time, the results could be positive.

Posted: Sat Nov 16, 2013 14:23
by Neuromancer
Inocudom wrote:I am liking this turn of events. In time, the results could be positive.
My motivation for adding Blockly to Minetest is fairly small in scope. My kids love Minetest, and I want to teach them how to program. However, if you think about it, Minetest and Blockly are free. While many schools aren't going to shell out money for all kinds of Minecraft licences, I could see them installing Minetest and Blockly on every computer. Suddenly you have millions of kids all over the world writing Minetest Mods. That has got to be good for Minetest. Now these kids grow up. And they already understand all the basics of Minetest modding. What are they going to do? Start writing lua and maybe even c++. That has got to be great for Minetest! And for the world in general, all of these new software developers thanks to Minetest and Blockly. Minetest for making programming fun, Blockly for making programming accessible to kids and beginners.

Posted: Sat Nov 16, 2013 14:41
by Neuromancer
I think a good place to start would be to implement minetest.register_node in Blockly.
minetest.register_node("bushes:BushLeaves"..Num, {
description = "Bush Leaves "..Num,
drawtype = "allfaces_optional",
tiles = {"bushes_leaves_"..Num..".png"},
inventory_image = "bushes_leaves_"..Num..".png",
paramtype = "light",
groups = { -- MM: Should we add leafdecay?
snappy=3,
flammable=2,
attached_node=1
},
sounds = default.node_sound_leaves_defaults(),
})

It would be nice to have dropdowns for all the possible parameter values like drawtype and groups.

Posted: Sat Nov 16, 2013 14:46
by LorenzoVulcan
Image

Posted: Sat Nov 16, 2013 17:03
by Neuromancer
That's kind of the point. Everyone starts out a noob. Blockly helps you bridge the gap from being a noob to an expert. Otherwise all you will ever have are a few experts and a boatload of people who can't bridge the gap.

Posted: Sat Nov 16, 2013 17:35
by LorenzoVulcan
Neuromancer wrote: That's kind of the point. Everyone starts out a noob. Blockly helps you bridge the gap from being a noob to an expert. Otherwise all you will ever have are a few experts and a boatload of people who can't bridge the gap.
I think this GUI just breaks out all concept of programming.When you program you must have the scheme of every class in your head,an programming LUA mods for minetest is a nice training to learn this concept.Using Blockly to code mods for minetest will just make every user of this forum a noob.

And the gap can be bridged asking help to expert users or reading tutorial and APIs.