turtle graphics
turtle graphics
hello all,
this mod adds turtle graphics to minetest. it allows you to spawn generated structures using
luavoxemanipulators. it includes a tool with a simple forth like language for experimenting, but
it is also possible to generate structures in lua. here are some pictures of what it can do:
https://github.com/obneq/turtle
to get the tool use /giveme turtle:tool
right click spawns, left click lets you edit programs, materials and find help.
the forth prompt uses a simple forth like language. here is a sample program to make a
circle:
: c 90 0 do [ U G G G G G G G G G D G ] 4 A Z R loop ; c
this program defines the word 'c' in the part between ':' and ';' and then calls 'c'. the capital letters and '[...]' are the primitives of the turtle systems, things like ':' and 'do...loop' are primitives of forth.
the part between the brackets lifts up the pen, moves forward, lowers pen and thus places one node. this is done 90 times while rotating the turtle around its Z axis. remember it is facing up initially.
you can then use the new word 'c' in other words. here is the spiral example:
: s 90 0 do [ c ] 5 A X R G loop ; s
idk if it is ok like this or if it would be less confusing to use pitch, yaw and roll for the turtle. pls try and give feedback.
if you like to generate turtle programs in lua remember they consist of both the program and a list of materials in one table. the program is just one long string consisting of turtle primitives.
i hope to integrate this into mapgen somehow, to allow for generated decorations in biomes,
dungeons and the like.
this will only work with a git build of minetest. license of code is WTFPL
this mod adds turtle graphics to minetest. it allows you to spawn generated structures using
luavoxemanipulators. it includes a tool with a simple forth like language for experimenting, but
it is also possible to generate structures in lua. here are some pictures of what it can do:
https://github.com/obneq/turtle
to get the tool use /giveme turtle:tool
right click spawns, left click lets you edit programs, materials and find help.
the forth prompt uses a simple forth like language. here is a sample program to make a
circle:
: c 90 0 do [ U G G G G G G G G G D G ] 4 A Z R loop ; c
this program defines the word 'c' in the part between ':' and ';' and then calls 'c'. the capital letters and '[...]' are the primitives of the turtle systems, things like ':' and 'do...loop' are primitives of forth.
the part between the brackets lifts up the pen, moves forward, lowers pen and thus places one node. this is done 90 times while rotating the turtle around its Z axis. remember it is facing up initially.
you can then use the new word 'c' in other words. here is the spiral example:
: s 90 0 do [ c ] 5 A X R G loop ; s
idk if it is ok like this or if it would be less confusing to use pitch, yaw and roll for the turtle. pls try and give feedback.
if you like to generate turtle programs in lua remember they consist of both the program and a list of materials in one table. the program is just one long string consisting of turtle primitives.
i hope to integrate this into mapgen somehow, to allow for generated decorations in biomes,
dungeons and the like.
this will only work with a git build of minetest. license of code is WTFPL
The images look good!
I myself didn't manage to create something. I just copied the sentence " : 90 0 ... loop ; c ". I probably should take more time to try to understand it. I saw a help which helped me a bit.
Some question with my first impression:
- I see you using a c for circle and a s for spiral. Are those standard or just names you gave them (so for example a d can also mean circle).
- Does the 90 stand for 90 degrees? and the 4 for 4 times?
- Why so much G's
So is it necessary to understand 'forth' to make it work?
Technically: When using creative inventory, moving through the pages switches from creative inventory to the turtle inventory and there moving through the pages moves back to creative etc. Plus escaping from the inventory/turtle is not possible anymore. Maybe it's because I use a 10 days old version of 0.4.7.
Summary: Looks like a fun mod to me, but I would like to have more 'dummies' explanation how to feed it or a link to a site where I could learn it.
Edit: Typo's.
I myself didn't manage to create something. I just copied the sentence " : 90 0 ... loop ; c ". I probably should take more time to try to understand it. I saw a help which helped me a bit.
Some question with my first impression:
- I see you using a c for circle and a s for spiral. Are those standard or just names you gave them (so for example a d can also mean circle).
- Does the 90 stand for 90 degrees? and the 4 for 4 times?
- Why so much G's
So is it necessary to understand 'forth' to make it work?
Technically: When using creative inventory, moving through the pages switches from creative inventory to the turtle inventory and there moving through the pages moves back to creative etc. Plus escaping from the inventory/turtle is not possible anymore. Maybe it's because I use a 10 days old version of 0.4.7.
Summary: Looks like a fun mod to me, but I would like to have more 'dummies' explanation how to feed it or a link to a site where I could learn it.
Edit: Typo's.
Last edited by Topywo on Thu Aug 22, 2013 13:18, edited 1 time in total.
-
- Member
- Posts: 122
- Joined: Wed Apr 10, 2013 16:46
hey, thanks for trying. i know that forth is not the most friendly looking thing, but i chose to use it because of what it allows to do while still being relatively simple to implement. now for your questions:Topywo wrote: Some question with my first impression:
- I see you using a c for circle and a s for spiral. Are those standard or just names you gave them (so for example a d can also mean circle).
- Does the 90 stand for 90 degrees? and the 4 for 4 times?
- Why so much G's
- with ':' and ';' new words are defined, in the example above its called 'c' but it could be anything there, like so ': circle 90 0 do ... and so on ;' so, the first thing after a : is an arbitrary name.
- in this example 90 stands for how many times the loop is executed. '90 0 do ... loop' mean to repeat something for 90 times.
- the 4 in the example is the angle to rotate around the axis for everytime the loop is run. stuff like '4 A Z R' basically means 'rotate 4 degrees around z axis' Remember that this means the turtles z axis, not minetests!
- each of the many 'G's stands for one step the turtle moves forward. if the pen is down (the 'U' and 'D' commands control the pen) it places a node of either red wool (default) or whatever is in the first inventory slot in the turtle tool formspec.
so, some more examples:
a pole of wool: 'G G G G G G' this examples uses no forth, only turtle commands.
a right angle: 'G G G G G G G 90 A Z R G G G G G G G'
a pentagram: ': seg G G G G G G G G G G G ; : penta 90 A Z R seg 144 A Y R seg R seg R seg R seg ; penta' this looks better with longer seg(ments), so make many Gs...
a forth loop: ': XIIGs 12 0 do G loop ; XIIGs' gives a pole of wool 12 nodes high
arguments: ': Gs 0 do G loop ; 12 Gs' the word Gs now takes one argument, which is the number of how many times it should loop. after you have defined this word you can use it like so '20 Gs' or try '4000 Gs'
one big circle: ': big 360 0 do G 1 A Z R loop ; big' so we make a pole of 360 nodes, but rotate one degree each step, and we end up where we started.
hope these examples help.
unfortunately it seems some forth is necessary to use the tool... but if you like you can use lua to generate turtle programs.
kahrl has done some formspec focus fixes lately, which is great, but yes, the inv for the tool is not perfect yet.Topywo wrote:Technically: When using creative inventory, moving through the pages switches from creative inventory to the turtle inventory and there moving through the pages moves back to creative etc. Plus escaping from the inventory/turtle is not possible anymore. Maybe it's because I use a 10 days old version of 0.4.7.
ps, you dont need forth to use it, you can use lua if you like. i did the candyland stuff using lua, here is the code and an example how to use it:
Spoiler
Code: Select all
local candycane = function ()
axiom = "Z11ARX24ARD"
seg = "1M[Z90ARGG]2M[Z-90ARGG]"
for i = 1, 1200 do
add("[X"..(i%90*4).."AR"..seg.."]")
if i%20==0 then
if i>700 then
add "Z8ARG"
else
add "G"
end
end
end
return axiom
end
ldef = {
prog = candycane(),
materials = { "wool:red", "wool:white" }
}
minetest.register_tool("turtle:spawn", {
description = "turtle lua spawner",
inventory_image = "default_stick.png",
on_use = function(itemstack, user, pointed_thing)
local pos = pointed_thing.above
if not pos then return end
turtle.spawn(pos, lddef)
end,
})
here is a game that generates some biomes using turtle. put it into games/ folder according to how you have installed minetest, select it and start a new world using mapgen v7.
stay tuned
repo here:
https://github.com/obneq/minetest_j
Last edited by jin_xi on Fri Aug 30, 2013 23:13, edited 1 time in total.
- darthvader
- Member
- Posts: 119
- Joined: Sun Sep 08, 2013 14:35
- Location: Death Star
(ok, this ain't a spoiler, really, i just wanna shorten what jin_xi said about some stuff of forth turtle blah blah)
huh? whah? i dinna understand...
Spoiler
jin_xi wrote: hey, thanks for trying. i know that forth is not the most friendly looking thing, but i chose to use it because of what it allows to do while still being relatively simple to implement. now for your questions:
- with ':' and ';' new words are defined, in the example above its called 'c' but it could be anything there, like so ': circle 90 0 do ... and so on ;' so, the first thing after a : is an arbitrary name.
- in this example 90 stands for how many times the loop is executed. '90 0 do ... loop' mean to repeat something for 90 times.
- the 4 in the example is the angle to rotate around the axis for everytime the loop is run. stuff like '4 A Z R' basically means 'rotate 4 degrees around z axis' Remember that this means the turtles z axis, not minetests!
- each of the many 'G's stands for one step the turtle moves forward. if the pen is down (the 'U' and 'D' commands control the pen) it places a node of either red wool (default) or whatever is in the first inventory slot in the turtle tool formspec.
so, some more examples:
a pole of wool: 'G G G G G G' this examples uses no forth, only turtle commands.
a right angle: 'G G G G G G G 90 A Z R G G G G G G G'
a pentagram: ': seg G G G G G G G G G G G ; : penta 90 A Z R seg 144 A Y R seg R seg R seg R seg ; penta' this looks better with longer seg(ments), so make many Gs...
a forth loop: ': XIIGs 12 0 do G loop ; XIIGs' gives a pole of wool 12 nodes high
arguments: ': Gs 0 do G loop ; 12 Gs' the word Gs now takes one argument, which is the number of how many times it should loop. after you have defined this word you can use it like so '20 Gs' or try '4000 Gs'
one big circle: ': big 360 0 do G 1 A Z R loop ; big' so we make a pole of 360 nodes, but rotate one degree each step, and we end up where we started.
hope these examples help.
unfortunately it seems some forth is necessary to use the tool... but if you like you can use lua to generate turtle programs.
I wanna fly!!!
I wanna have feathery wings of silver, blue, and white!!!
I wanna soar high and touch the sky!!!
I wanna fly!!!
I wanna have feathery wings of silver, blue, and white!!!
I wanna soar high and touch the sky!!!
I wanna fly!!!
- darthvader
- Member
- Posts: 119
- Joined: Sun Sep 08, 2013 14:35
- Location: Death Star
You need to either download a version of the latest development build from one of the people that are nice enough to make and post them in the forums or you need to download the files from github and compile your own copy in order to use this mod.darthvader wrote:I don't understand.jin_xi wrote:this will only work with a git build of minetest.
Re: turtle graphics
anyone got a copy of this mod?
-
- Member
- Posts: 4276
- Joined: Sun Sep 09, 2012 17:31
- GitHub: Sokomine
- IRC: Sokomine
- In-game: Sokomine
Re: turtle graphics
I've found what looks like an old copy of it. I don't know how recent it is. The author still seems to be present on github - perhaps you can contact him.
- Attachments
-
- turtle-master.zip
- (4.58 KiB) Downloaded 181 times
A list of my mods can be found here.
Who is online
Users browsing this forum: No registered users and 16 guests