<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I found a short write-up on the API. It shows<br>
<br>
setBlocks(x1, y1, z1, x2, y2, z2, blockType, blockData) - set lots
of blocks all at the same time by providing 2 sets of co-ordinates
(x, y, z) and fill the gap between with a blockType<br>
<br>
If a similar function is available for get blocks, that would speed
up your code hugely. Every single command sent over TCP has
overhead associated with it, so attempting to read 128^3 times over
a network is going to take a while. The main advice I can give is
to do as much as possible per command. "Reasonable" lisp code will
be 1000000000000x times faster than network commands, so whatever
you can do "all at once" in lisp will save time, especially if you
have to wait for round trips, e.g. getting a block to determine how
to set another block and sending them sequentially like that.
Ideally, you'd get a bunch of blocks with as few commands as
possible, then set a bunch with as few as possible, or whatever, but
mainly try to avoid the network portion as much as possible.<br>
<br>
As for the data structure, lisp has multi-dimensional arrays:<br>
<br>
<a class="moz-txt-link-freetext" href="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html">http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_make-array.html</a><br>
<br>
(make-array '(128 128 128))<br>
<br>
with a variety of keywords to control how its created. That website
in general has everything on lisp.<br>
<br>
For a modern computer, such data is in no way too large (~2 million
* size of data...say 64 bits = 8 bytes so 16 MB total). BUT sending
2 million TCP commands is too many!<br>
<br>
<div class="moz-cite-prefix">On 06/10/2013 09:01 PM, grant centauri
wrote:<br>
</div>
<blockquote
cite="mid:CAPPMknC59mVHTSbBSRGOkOx100xb-4bdKDUWehyLCgrLoZx8Xw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>hello, i've been exploring the educational possibilities of
connecting a Lisp language to the Minecraft Pi Edition. I
started by writing a tutorial using Common Lisp <a
moz-do-not-send="true"
href="http://www.lincolnix.net/gcentauri/build-tower.html"
target="_blank">http://www.lincolnix.net/gcentauri/build-tower.html</a>
which uses a basic connection API I wrote. This is really my
first attempt at a coding project, and I'm scraping together
understanding of things from a variety of sources. <br>
<br>
</div>
the code i have now establishes a socket connection, and i have
written a "send-command" function with its own helper functions
to prepare the proper string for the Minecraft API. There are
only a few functions that receive data, so I decided to have
each one handle its reading of the input socket on its own.
this is very basic, and i'd actually like to write this in a
better way, if possible. i have only included one example
function here. i'd like the writing of this library to serve as
a tutorial as well, because it has helped me understand a lot
about some basic programming tasks. here's the code:<br>
<div>
<div><br>
<a moz-do-not-send="true"
href="https://gist.github.com/anonymous/5745976"
target="_blank">https://gist.github.com/anonymous/5745976</a><br>
<br>
my question is mainly about creating a data structure to
represent the whole 128x128x128 world, and then sending the
"get-block" command to the Minecraft server for every
coordinate, and retrieving all of the integers. is this
feasable?<br>
<br>
</div>
<div>I have been able to write a function to set a column of
blocks recursively (see the build-tower tutorial in CL)
which performs very quickly, even when sent from another
machine on the network. but the function i wrote (and must
have deleted?) to GET a column of block id numbers took a
few seconds to complete. i don't know enough about TCP
connections and how to send and receive data properly. i'm
also unsure of the best way to process this function, as
what i'd like to end up with is a "world" data structure
containing coordinate/block-id pairs. the idea is that then
you could write a function to perhaps turn all the "water"
blocks into "air", draining the oceans and rivers. i don't
know if this kind of function even makes sense to try with
the way the Minecraft API works. I'm unsure about the size
of the data, and if it is too big to efficiently operate on
in this way.<br>
<br>
</div>
<div>i'm sure i'll have more questions too. but i'm hoping to
document the process of learning about this so other
learners can benefit from my struggle.<br>
<br>
</div>
<div>thanks,<br>
</div>
<div>-grant</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">____________________
Racket Users list:
<a class="moz-txt-link-freetext" href="http://lists.racket-lang.org/users">http://lists.racket-lang.org/users</a>
</pre>
</blockquote>
<br>
</body>
</html>