Minetestmapper rewritten into C++

User avatar
VanessaE
Moderator
Posts: 4513
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

Glad I could help :-)
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
Rancon
Member
Posts: 240
Joined: Tue Jan 01, 2013 14:59
Location: Gladstone, Missouri

by Rancon » Post

how do I use this?
Do I use it as an exe file?
Any tips on blender, gimp, or codea?

User avatar
VanessaE
Moderator
Posts: 4513
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

On Linux, it's a command-line program that works substantially the same as the python version that comes with Minetest. On Windows, no clue. :-)
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
Iqualfragile
Member
Posts: 160
Joined: Tue Sep 18, 2012 22:11

by Iqualfragile » Post

yeah, when you are on windows just forget it, you wont need it anyways
Gr8 b8, m8. I rel8, str8 appreci8, and congratul8. I r8 this b8 an 8/8. Plz no h8, I'm str8 ir8. Cr8 more, can't w8. We should convers8, I won't ber8, my number is 8888888, ask for N8. No calls l8 or out of st8. If on a d8, ask K8 to loc8. Even with a full pl8, I always have time to communic8 so don't hesit8.

User avatar
Dan Duncombe
Member
Posts: 904
Joined: Thu May 09, 2013 21:11
Location: In the unknown depths of Earth

by Dan Duncombe » Post

How do I use the Windows exe? Where do I put it, etc.
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.

Jordach
Member
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

by Jordach » Post

Dan Duncombe wrote:How do I use the Windows exe? Where do I put it, etc.
RabbiBob wrote:
Jordach wrote:Can we have some arguments please?

Here is the contents:

Code: Select all

minetest_mapper.exe -i C:\Documents and Settings\Jordan\Desktop\Minetest 0.4.2\worlds\city\ -o output_file.png
And the world SHOULD work. But it does not generate any .png anywhere.
Try one of two things:

Add " around the path

Code: Select all

minetest_mapper.exe -i "C:\Documents and Settings\Jordan\Desktop\Minetest 0.4.2\worlds\city" -o output_file.png
or
  • Create a util directory at C:\Documents and Settings\Jordan\Desktop\Minetest 0.4.2\
  • Put minetest_mapper.exe and color.txt in C:\Documents and Settings\Jordan\Desktop\Minetest 0.4.2\util\
  • Create map.bat and put the following in it:
    • minetest_mapper.exe -i ../worlds/city/ -o output.png
  • Save it and run the bat file
The latter way gives you a quick double click way of running the mapper.
viewtopic.php?f=10&t=19056 Solar Plains Dev Server

User avatar
Exilyth
Member
Posts: 73
Joined: Sun Jul 28, 2013 18:46
Location: Earth

by Exilyth » Post

Nice - I can even make out my cactus farm on the map (after playing arund with the parameters, ofc) ;)

A command line argument "--centeronplayer playername" would be useful, which would center the map on the named player.
I'm running 0.4.13 stable with [technic][carts][farming_plus][biome_lib][unified_inventory] and a few other mods.

User avatar
Rancon
Member
Posts: 240
Joined: Tue Jan 01, 2013 14:59
Location: Gladstone, Missouri

by Rancon » Post

Hey, um.. I'm not sure if it's okay to bring back an old topic, but when I run it, it turns and right back off after about a frame, or tick, or whatever you want to call it. May I have some help? I use Windows 8
Any tips on blender, gimp, or codea?

User avatar
Dan Duncombe
Member
Posts: 904
Joined: Thu May 09, 2013 21:11
Location: In the unknown depths of Earth

by Dan Duncombe » Post

Rancon wrote:Hey, um.. I'm not sure if it's okay to bring back an old topic, but when I run it, it turns and right back off after about a frame, or tick, or whatever you want to call it. May I have some help? I use Windows 8
I have Windows 7, but I will try to help. Firstly, put minetest_mapper.exe and colors.txt in the minetest/worlds folder. Then, press shift and right-click any empty space in the worlds folder. Click 'open command window here'. When it opens type

Code: Select all

minetest_mapper
Then type:

Code: Select all

minetest_mapper -i "Worldname_Here" -o A_Mapname_Here.png
This will then generate a map in the worldsfolder.
Some Mods: Castles Prefab Camouflage
My Games: Nostalgia Realtest Revamped
Servers: See above games.

User avatar
GreenGerm
Member
Posts: 22
Joined: Sun Jul 07, 2013 15:10

by GreenGerm » Post

Rancon wrote:Hey, um.. I'm not sure if it's okay to bring back an old topic, but when I run it, it turns and right back off after about a frame, or tick, or whatever you want to call it. May I have some help? I use Windows 8
same happens here. I'm windows 8 as .well
I'm not GreenGerm from Minecraft and Roblox. I'm XXGreenGermXX on Roblox and DJ_IbMasterX on Minecraft.

Jordach
Member
Posts: 4523
Joined: Mon Oct 03, 2011 17:58
GitHub: Jordach
IRC: Jordach
In-game: Jordach
Location: Blender Scene

by Jordach » Post

GreenGerm wrote:
Rancon wrote:Hey, um.. I'm not sure if it's okay to bring back an old topic, but when I run it, it turns and right back off after about a frame, or tick, or whatever you want to call it. May I have some help? I use Windows 8
same happens here. I'm windows 8 as .well
It closes instantly because the program isn't doing anything special. That's why if the mapper is fed a world directory, it will produce a overhead image.
viewtopic.php?f=10&t=19056 Solar Plains Dev Server

User avatar
miner65536
Member
Posts: 46
Joined: Tue Aug 20, 2013 22:16

by miner65536 » Post

Hi,
Is there a way to get the mapper to output a fixed sized tile even if there is no content there, IE to respect the geometry option & not auto-crop to the available world content?

User avatar
LazyJ
Member
Posts: 603
Joined: Wed Sep 12, 2012 12:29
Location: Podunk, Nowhere, USA

by LazyJ » Post

Old thread but still a good program... and it needs some updating and improvement TLC.

For several months I have been using this program along with the python version to generate maps of our server. I have to resort to the python version because of a bug in the cpp version when using the geometry option. When positive x and/or positive z coords are entered into the geometry option, the cpp minetestmapper generates white space from 0,0 to the specified positive coord and then it renders the area image.

Below are two sample images. The goal is to produce a 100x100 area image starting at x50,z50 and extending to x150,z150.

First the cpp minetestmapper version:

Code: Select all

--geometry 50:50+100+100
Image

Note the excess white space and the area image starting 14 farther in than specified (x64,z64)



Now the python mintestmapper version:

Code: Select all

sector_xmin = 50 / 16
sector_xmax = 150 / 16
sector_zmin = 50 / 16
sector_zmax = 150 / 16
Image

This is the image that should be rendered.


The python version of minetestmapper works but is incredibly slow and conusmes excessively large amounts of ram. I have an i7 computer with 16gb of ram running Fluxbox with all other "user" programs shut off and, on some map renders, the python version consumes all 16gb plus 6 to 8gb of swap file all to produce a miniscual 35mb file.

Yeah, that's 35 "megabytes" - a mere fraction of the 16gb of ram.

And while the python version is gobbling up all of my ram and most of my swap file, it is only using 1 of the 8 available cpu cores.

All of this plus over two hours of processing time just to produce a 35mb file!?

The cpp version of minetestmapper is so much faster, much less memory intensive and does the job wonderfully... except for the bug in the geometry.

Are there any cpp code gurus out there that can fix this bug, please?

User avatar
VanessaE
Moderator
Posts: 4513
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

And if someone would fix the bug where the C++ mapper will render horizontal white stripes when the world is too active (I presume it gets hung up trying read while the map is being written, and doesn't bother to wait or try the failed read again), I'd sure appreciate that. Having to shut down the server to ensure a clean map image is not fun.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

Ragnar
Member
Posts: 850
Joined: Thu Oct 25, 2012 15:19
Location: Estonia
Contact:

by Ragnar » Post

VanessaE wrote:And if someone would fix the bug where the C++ mapper will render horizontal white stripes when the world is too active (I presume it gets hung up trying read while the map is being written, and doesn't bother to wait or try the failed read again), I'd sure appreciate that. Having to shut down the server to ensure a clean map image is not fun.
can't you copy the map when the server is running then do that?
Are you saying that I put an abnormal brain into a seven and a half foot long, fifty-four inch wide GORILLA?

User avatar
VanessaE
Moderator
Posts: 4513
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

I could, yes, but to ensure that the copy isn't broken, it still requires shutting the server down, though for a shorter period of time.

The default python mapper doesn't exhibit this issue, but the slowness of that one is...unappealing.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
VanessaE
Moderator
Posts: 4513
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

Another update to my colors.txt today. Re-arranged a bit and brought many mods up-to-date, especially things that use moreblocks/stairsplus. Some stuff still needs some attention. Same download link as before.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
Sean884
New member
Posts: 2
Joined: Thu Oct 03, 2013 20:00

by Sean884 » Post

LazyJ wrote:For several months I have been using this program along with the python version to generate maps of our server. I have to resort to the python version because of a bug in the cpp version when using the geometry option. When positive x and/or positive z coords are entered into the geometry option, the cpp minetestmapper generates white space from 0,0 to the specified positive coord and then it renders the area image.

<snip>

Note the excess white space and the area image starting 14 farther in than specified (x64,z64)
There's really two issues here. The excess white space between 0,0 and your desired area needs just a small fix; see the patch below. The reason the area you requested started at 64,64 rather than 50,50 is that the C++ code rounds the boundaries to the nearest block of 16x16x16 nodes for better performance. Changing it to use the exact node boundaries without sacrificing speed would NOT be a small fix. :(

Here's the patch for the excess white space issue. If you're not familiar applying patches and recompiling, I'm sorry I'm not able to help you with that at this time; hopefully someone else can.

Code: Select all

diff -u a/TileGenerator.cpp b/TileGenerator.cpp
--- a/TileGenerator.cpp
+++ b/TileGenerator.cpp
@@ -9,6 +9,7 @@
 
 #include <cstdio>
 #include <cstdlib>
+#include <climits>
 #include <fstream>
 #include <gdfontmb.h>
 #include <iostream>
@@ -94,10 +95,10 @@ TileGenerator::TileGenerator():
        m_border(0),
        m_db(0),
        m_image(0),
-       m_xMin(0),
-       m_xMax(0),
-       m_zMin(0),
-       m_zMax(0),
+       m_xMin(INT_MAX),
+       m_xMax(INT_MIN),
+       m_zMin(INT_MAX),
+       m_zMax(INT_MIN),
        m_geomX(-50),
        m_geomY(-50),
        m_geomX2(50),

User avatar
Sean884
New member
Posts: 2
Joined: Thu Oct 03, 2013 20:00

by Sean884 » Post

VanessaE wrote:And if someone would fix the bug where the C++ mapper will render horizontal white stripes when the world is too active (I presume it gets hung up trying read while the map is being written, and doesn't bother to wait or try the failed read again), I'd sure appreciate that. Having to shut down the server to ensure a clean map image is not fun.
You're correct, the C++ mapper has no code to handle the database being busy, which it very likely will be when the server is running. Unfortunately, the server doesn't have that code either, so if you're running the mapper (even the python version!) and the server concurrently, users of the server also have a chance of seeing missing nodes or having updates (near-)silently fail. It's possible to fix both, but if this is the only use case for doing so, I'm not sure it's worth the time?

User avatar
LazyJ
Member
Posts: 603
Joined: Wed Sep 12, 2012 12:29
Location: Podunk, Nowhere, USA

by LazyJ » Post

Thanks, Sean, for the patch. It works! \0/

The 14 block offset still exists but is easily remedied by padding an extra 14 on either side of the geometry option.

So to follow up on my previous example:

If you want a map that starts from x50,z50 and goes to x100,z100 subtract 14 from the 50,50 and add 14 to the 100,100 to get

Code: Select all

--geometry 36:36+114+114

User avatar
LazyJ
Member
Posts: 603
Joined: Wed Sep 12, 2012 12:29
Location: Podunk, Nowhere, USA

by LazyJ » Post

Ok, another feature that would be nice (or perhaps it's a code line that can be tweaked as needed) is to specify a height or altitude to ignore things (kind of like how minetestmapper ignores the clouds).

We have players building arial platforms that are high enough not to cast shadows on the ground but are becoming broad enough that they are obscuring large sections of the map.

It would be nice for ground-level players that refer to the overview maps if there were a way to produce a set of maps without the arial platforms and then toggle the option on/off to generate maps with the arial platforms for the sky-builders.

Maybe something like:

Code: Select all

--ignore y:160

User avatar
Sokomine
Member
Posts: 4017
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

by Sokomine » Post

LazyJ wrote: It would be nice for ground-level players that refer to the overview maps if there were a way to produce a set of maps without the arial platforms and then toggle the option on/off to generate maps with the arial platforms for the sky-builders.
That would be very nice to have. All these sky-platforms make it difficult to navigate on the ground using the map.
A list of my mods can be found here.

User avatar
twoelk
Member
Posts: 1365
Joined: Fri Apr 19, 2013 16:19
GitHub: twoelk
IRC: twoelk
In-game: twoelk
Location: northern Germany

by twoelk » Post

This would be a cool feature indeed and usefull for many things. Slicing at a given hight would not only allow something like hight=30 to exclude platforms above that vallue but hight=-130 would give me a layout of all my tunnels at that level (and show me all caves as well of course)

User avatar
VanessaE
Moderator
Posts: 4513
Joined: Sun Apr 01, 2012 12:38
GitHub: VanessaE
IRC: VanessaE
In-game: VanessaE
Location: Western NC
Contact:

by VanessaE » Post

For some reason, I ran into problems again with the mapper producing "holes" in the land underneath unknown-to-the-mapper blocks, so I went to my backups, found a copy that works right, committed the last change (which I think was by ShadowNinja), and uploaded that fork here:

https://github.com/VanessaE/minetest-mapper-cpp

Hope others find it useful.
You might like some of my stuff: Plantlife ~ More Trees ~ Home Decor ~ Pipeworks ~ HDX Textures (64-512px)

User avatar
Saom3000
New member
Posts: 3
Joined: Thu Jan 16, 2014 16:28

by Saom3000 » Post

mireq wrote:I rewrote the minetestmapper.py tool to C++. It is at least 50 times faster than original.

Code: Select all

./minetest_mapper ...  6,96s user 0,16s system 99% cpu 7,181 total
python minetestmapper.py ... 531,58s user 1,66s system 99% cpu 8:55,13 total
Source code is on github (https://github.com/mireq/minetest-mapper-cpp).

Rquired dependencies are:
  • libgd
  • boost
  • sqlite3
Commandline arguments are that same as used in minetestmapper.py. Input directory (-i) must end with / (on Linux) or with \ (Windows)

Windows binary is available at: https://github.com/mireq/minetest-mapper-cpp/downloads
how to install help me plz

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest