numpy-izing minetestmapper

Dartmouth
Member
 
Posts: 121
Joined: Sat Dec 06, 2014 14:39
IRC: pilino1234

Re: numpy-izing minetestmapper

by Dartmouth » Sun Feb 15, 2015 16:57

Using VanessaE's colors.txt file, you have to remove the two comments lines starting with "# Random" and "# From", otherwise it will throw errors when trying to call int() on those strings.

Otherwise this script is really good, except that python3 does not work, there is at least one python2 print statement on line 1036 ;)
 

User avatar
mrob27
Member
 
Posts: 21
Joined: Sun Sep 27, 2015 13:32
GitHub: mrob27

Re: numpy-izing minetestmapper

by mrob27 » Mon Sep 28, 2015 19:49

@thetoon suggested back on 28th March 2014 (on page 2 of this thread) that Python 2.7 works and they had no need to change colors.txt; and spillz suggested on 29th April 2014 that it "Should work with both python 2 and 3."

But since then things seem to have changed, or maybe this never got tested with SQL databases.

Anyway, I have Python 2.7. To get it to work, I had to make one small change. Find "return BytesIO(r[0])" and change it to "return BytesIO(bytes(r[0]))".

I also removed the back-quotes from the SQL queries (like "SELECT `pos` FROM `blocks`") because I couldn't find anything online to explain why there should be back-quotes in an SQL query within Python. (EDIT: I searched again and found this: using the back-quotes protects against problems if a future version of SQL defines "pos" or "blocks" as a built-in reserved keyword. However, they are not ANSI-SQL compliant. I choose compliance and remove the back-quotes.)

Finally, I added about 80 or 90 lines to my colors.txt which still needs some tweaking (e.g. sandstone is still wrong but I made it better).

Example output (in a spoiler because it is big)
+ Spoiler


Yes the terrain is old, because I'm stuck with 0.4.11 on a Mac that is stuck with MacOS 10.6.

- Robert Munafo
 

User avatar
poikilos
Member
 
Posts: 32
Joined: Thu Feb 18, 2016 13:45
GitHub: poikilos
In-game: poikilos

Re: numpy-izing minetestmapper

by poikilos » Sat Mar 26, 2016 00:28

You forgot to add 16 (or 15 if inclusive rect) to the boundaries. The code should read:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
    pngminx = minx*16
    pngmaxx = maxx*16+16
    pngminz = minz*16
    pngmaxz = maxz*16+16
    pngregion=[pngminx, pngmaxx, pngminz, pngmaxz]


Using the current code (without +16), [pngregion[1]-pngregion[0], pngregion[4]-pngregion[3]] is a size that 16 fewer blocks than the actual result image.
(I noticed because my WIP livemap http://github.com/poikilos/minetest-chunkymap analyzes the stdout of minetestmapper-numpy.py).
 

User avatar
burli
Member
 
Posts: 1313
Joined: Fri Apr 10, 2015 13:18

Re: numpy-izing minetestmapper

by burli » Sun Apr 10, 2016 07:52

I want to add more colors, but there are two types of them

80c 183 183 222 # CONTENT_GLASS
default:glass 183 183 222

If I understand the code the second type is ignored. So I need the identifier numbers for the nodes. Where do I get them?
 

Previous

Return to Minetest-Related

Who is online

Users browsing this forum: No registered users and 5 guests

cron