Minetestmapper rewritten into C++

User avatar
Sergey
Member
 
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: Minetestmapper rewritten into C++

by Sergey » Mon Jan 16, 2017 21:10

taikedz wrote:you did "mkdir dir1; cd dir1"

There is no colors.txt in that dir1. An executable "that uses files in the current/local directory" uses the current dir in which you run the command, not the data from the dir in which it resides.

I know what current directory is. And I didn't confuse anything.

taikedz wrote:You want to execute
Code: Select all
minetestmapper --colors $PATH_TO_COLOURS_TXT <and the rest of your stuff>

I just want not to deal with colors.txt at all if I don't want to paint my map in some special way.
minetestmapper should use its own default settings.
 

User avatar
sfan5
Moderator
 
Posts: 3782
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

Re: Minetestmapper rewritten into C++

by sfan5 » Wed Jan 18, 2017 15:40

Sergey wrote:
sfan5 wrote:How did you install minetestmapper and which version did you install?


I installed minetestmapper from AUR [https://aur.archlinux.org/packages/minetestmapper-git/] this standard way.

Unfortunately the AUR package installs minetestmapper incorrectly, please install it manually from source in the meantime.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Sergey
Member
 
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: Minetestmapper rewritten into C++

by Sergey » Tue Jan 31, 2017 19:48

sfan5 wrote:
Sergey wrote:
sfan5 wrote:How did you install minetestmapper and which version did you install?


I installed minetestmapper from AUR [https://aur.archlinux.org/packages/minetestmapper-git/] this standard way.

Unfortunately the AUR package installs minetestmapper incorrectly, please install it manually from source in the meantime.

AUR package was corrected. Now it draws map without necessary colors.txt.

But it wasn't an upgrade. I had to uninstall program, clear package cache, and then install program again.
 

User avatar
Sergey
Member
 
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: Minetestmapper rewritten into C++

by Sergey » Tue Jan 31, 2017 19:54

Now there are new problems with generating maps of newly generated worlds.

If I create new world (name: s1, mapgen: valleys), start (play) it, turn around without making any steps, exit it, and then launch in terminal minetestmapper, then I get that situation:

Code: Select all
$ minetestmapper --geometry -5000:-5000+10000+10000 --draworigin  -i ~/.minetest/worlds/s1/ -o s1.1.png
terminate called after throwing an instance of 'std::out_of_range'
  what():  sizecheck y
Аварийный останов (стек памяти сброшен на диск)
 

User avatar
sfan5
Moderator
 
Posts: 3782
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

Re: Minetestmapper rewritten into C++

by sfan5 » Thu Feb 02, 2017 21:56

I can't reproduce this problem, however it should go away if you compile minetestmapper in Release mode.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
Sergey
Member
 
Posts: 784
Joined: Wed Jan 11, 2017 13:28
Location: Russia

Re: Minetestmapper rewritten into C++

by Sergey » Fri Mar 17, 2017 21:48

I have reasonable questions about minetestmapper.

Does minetestmapper take into account floatlands?
What kind of maps minetestmapper generates in case of view from above?
Will view from above cover what is on the ground?
How to dintigiush projection of floatlands from what is on the ground?
 

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

Re: Minetestmapper rewritten into C++

by twoelk » Sat Mar 18, 2017 14:15

Sergey wrote:I have reasonable questions about minetestmapper.

Does minetestmapper take into account floatlands?
What kind of maps minetestmapper generates in case of view from above?
Will view from above cover what is on the ground?
How to dintigiush projection of floatlands from what is on the ground?


quick answer:
1. yes
2. a view from above (as far above as air nodes have been generated)
3. yes
4. you cannot (at least not easily, you may want to try out hightmap options)

sollution:
you can tell the mapper where to begin mapping, left, right, front, back, up and down
README.rst wrote:
Code: Select all
min-y:
    Don't draw nodes below this y value, e.g. ``--min-y -25``

max-y:
    Don't draw nodes above this y value, e.g. ``--max-y 75``
 

User avatar
krokoschlange
Member
 
Posts: 57
Joined: Sat Jul 02, 2016 08:33
Location: get_author_pos() ~= get_viewer_pos()
GitHub: krokoschlange
In-game: krokoschlange

Re: Minetestmapper rewritten into C++

by krokoschlange » Thu Aug 10, 2017 14:40

Code: Select all
CMakeFiles/minetestmapper.dir/Image.cpp.o: In Funktion `Image::save(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Image.cpp:(.text+0x9af): Nicht definierter Verweis auf `gdImagePng'
collect2: error: ld returned 1 exit status
CMakeFiles/minetestmapper.dir/build.make:279: die Regel für Ziel „minetestmapper“ scheiterte
make[2]: *** [minetestmapper] Fehler 1
CMakeFiles/Makefile2:67: die Regel für Ziel „CMakeFiles/minetestmapper.dir/all“ scheiterte
make[1]: *** [CMakeFiles/minetestmapper.dir/all] Fehler 2
Makefile:149: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2


It seems to be similar to this one:
sfan5 wrote:
stormchaser3000 wrote:i got a compile error with the version in the top post (i might try sfan5's fork) and i got this
Code: Select all
        CMakeFiles/minetest_mapper.dir/TileGenerator.cpp.o: In function `TileGenerator::writeImage(std::string const&)':
        TileGenerator.cpp:(.text+0x22e9): undefined reference to `gdImagePng'
        collect2: error: ld returned 1 exit status
        make[2]: *** [minetest_mapper] Error 1
        make[1]: *** [CMakeFiles/minetest_mapper.dir/all] Error 2
        make: *** [all] Error 2



Make sure you have a libgd version with png support installed.

What I did:
    Build libpng
    run ./config in the libgd folder: It said it would use libpng for png support
    build libgd
    build minetestmapper
What did I do wrong?
 

User avatar
sfan5
Moderator
 
Posts: 3782
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

Re: Minetestmapper rewritten into C++

by sfan5 » Fri Aug 11, 2017 13:18

If you have built libgd on your own you either need to make sure to install it system-wide or point minetestmapper to the correct path using -DLIBGD_INCLUDE_DIR= or -DLIBGD_LIBRARY=.
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
krokoschlange
Member
 
Posts: 57
Joined: Sat Jul 02, 2016 08:33
Location: get_author_pos() ~= get_viewer_pos()
GitHub: krokoschlange
In-game: krokoschlange

Re: Minetestmapper rewritten into C++

by krokoschlange » Fri Aug 11, 2017 15:24

sfan5 wrote:If you have built libgd on your own you either need to make sure to install it system-wide or point minetestmapper to the correct path using -DLIBGD_INCLUDE_DIR= or -DLIBGD_LIBRARY=.

Still the same error :(
I built libgd 2.2.4 with libpng 1.6.31, these should be the newest versions ... and ofc latest mtmapper
 

User avatar
BirgitLachner
Member
 
Posts: 386
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: Minetestmapper rewritten into C++

by BirgitLachner » Sun Nov 05, 2017 15:04

What about this error?

Code: Select all
terminate called after throwing an instance of 'ZlibDecompressor::DecompressError


Is it a problem with png?
My husband (Linux-Pro) thinks that usually at Debian the png-support should be "installed".

Thanks ... Birgit
 

User avatar
sfan5
Moderator
 
Posts: 3782
Joined: Wed Aug 24, 2011 09:44
Location: Germany
GitHub: sfan5
IRC: sfan5

Re: Minetestmapper rewritten into C++

by sfan5 » Mon Nov 06, 2017 22:10

Nope unrelated to PNG, that error usually points towards invalid data inside the map.sqlite
Mods: Mesecons | WorldEdit | Nuke & Minetest builds for Windows (32-bit & 64-bit)
 

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

Re: Minetestmapper rewritten into C++

by twoelk » Tue Nov 07, 2017 17:18

isn't the same error thrown when the mapper tries to load and unzip another mapblock and can't because it runs into memory issues? Try mapping a smaller area, if it still happens I was wrong :-P

or if you got lots of time, by some sort of clever mapping bisecting you can pinpoint the corrupt area
 

User avatar
BirgitLachner
Member
 
Posts: 386
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: Minetestmapper rewritten into C++

by BirgitLachner » Tue Nov 07, 2017 18:46

I can try it, but the error was not inside the area I wanted to map. I teleported myself to this place but there was nothing special there and I think that haven't been there before. I even used the command "/deleteblocks here" to rebuild the area. But the problem was the same.

Can I "repair" the database. Is there a command?

Birgit
 

User avatar
BirgitLachner
Member
 
Posts: 386
Joined: Thu May 05, 2016 10:18
In-game: Bibs

Re: Minetestmapper rewritten into C++

by BirgitLachner » Fri Nov 10, 2017 18:10

I found the --geometry option and tried a smaller area but I got the same error.
 

wziard
Member
 
Posts: 115
Joined: Mon Oct 29, 2018 19:12

Re: Minetestmapper rewritten into C++

by wziard » Thu Nov 15, 2018 13:28

Hi all,

I created a fork of minetestmapper and added some functions I needed myself. I did a pull request on minetest/minetestmapper, but I closed it again, as I think I need to rework the code a bit.

The added functionality could be useful though, so I'll post a link here for anyone who wants to try:

https://github.com/wziard/minetestmapper

Quick example, generate a fully functioning slippy map in one command:

Code: Select all
minetestmapper -i input/ -o map.jpg --tilesize 1024x1024 --leaflet --buildpyramid --noemptyimage


This will generate (a lot of) tiles named '<zoom>_<x>_<-y>_map.jpg' and a html file named 'map.jpg.html'
copy all these to some folder on your webserver (or local machine of course) and add the leaflet.css and leaflet.js from the Leaflet/ subdir. Tadaa! working map.

The added flags are:

--tilesize WxH
tiled output. for if your map is too big to output in one go. Much faster than running minetestmapper in a loop with the --geometry option.

--leaflet
output tiles in a leaflet compatible format, and also output some ready-to use html just upload the tiles
and the html to your website to have a working slippy map.

--buildpyramid
when doing tiled output, will also generate downscaled tiles for leaflet so zooming out is faster.

known bugs/todo
-when one of the map dimensions is smaller than the tilesize, it crashes
-some variable names are re-used in an illogical manner.
Despite these minor bugs it works rather well at my site (sorry, private server used by my children, so I won't put a link here.)

I also already know how to fix those, but as I'm rather busy it'll be next week before I get around to doing it.

plan: (but no idea yet if feasible)
Make special sign nodes (maybe with some code in the sign) show up as markers on the map, so you can name stuff.
 

User avatar
Linuxdirk
Member
 
Posts: 1852
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk
 

wziard
Member
 
Posts: 115
Joined: Mon Oct 29, 2018 19:12

Re: Minetestmapper rewritten into C++

by wziard » Thu Nov 15, 2018 14:51

Linuxdirk wrote:I wonder if we’ll ever get a decent isometric view from all four sides.

Not with this utility. MinetestMapper has no idea how to actually render stuff and just uses a list of colors for each block. That would need to be an addon to the Minetest Client, which *does* know how to render stuff.

It would not be very hard to let MinetestMapper create 'side views' though, where you'd specify some cut-line. Could be an interesting addition to my fork :-)
 

wziard
Member
 
Posts: 115
Joined: Mon Oct 29, 2018 19:12

Re: Minetestmapper rewritten into C++

by wziard » Sun Nov 18, 2018 20:39

Another addition to my fork at:
https://github.com/wziard/minetestmapper

This time I added a --marker option

--marker <nodename> will make minetestmapper output the locations off the requested node (on stdout) in the rendered area. (So only if it is within the rectangle specified with --geometry). I plan to use this to add placenames to my slippy map defined by signs put down in the world.

example: I have a minetest world with a signs_road:red_street_sign placed with the text "Paris". If I then generate my map with
Code: Select all
./minetestmapper -i MyWorld -o worldmap.png --marker signs_road:red_street_sign
it will output the following info on stdout:
Code: Select all
Marker signs_road:red_street_sign 256 10 1
"infotext":""Paris""
"display_text":"Paris"
"formspec":"size[6,3]field[0.5,0.7;5.5,1;display_text;Text;${display_text}]button_exit[2,2;2,1;ok;Write]"
EndMarker


I can then easily parse this info to put a marker named "Paris" on my online map.

As soon as I have the javascript side of the map working I'll try to put up a demo map somewhere.

P.S. @Sfan5 e.a. I won't do a pull request for this (yet) as I need to clean up the code a bit to keep the standard as high as the rest of the app. Also, I guess you'd think this would be outside the scope of the utility.
I must say, my utmost compliments to the author(s) of this program. Very clear code. Easy to build on.
 

wziard
Member
 
Posts: 115
Joined: Mon Oct 29, 2018 19:12

Re: Minetestmapper rewritten into C++

by wziard » Thu Nov 22, 2018 09:05

Linuxdirk wrote:I wonder if we’ll ever get a decent isometric view from all four sides.


Experimental hacked minetestmapper, I just bruteforce it by drawing colored hexagons for all nodes from back to front :-) :

Be sure to watch the full zoom version.

Image
edit: whoops, I see I misaligned the blocks when manually stitching, I shoudl have aligned the upper-right, but I aligned lower-left by accident. Oh well, you get the idea.

Limitations:
- single color blocks
- only from one side atm
- produces tiles which you need to stitch together manually
- slooooooooow.

plans:
not really any plans with this specific code. To make a workable isometric viewer/exporter I'd need to start again (nicking the database code from minetestmapper maybe).
 

wziard
Member
 
Posts: 115
Joined: Mon Oct 29, 2018 19:12

Re: Minetestmapper rewritten into C++

by wziard » Sat Jan 12, 2019 13:09

I experimented some more with the isometric output hacked into my fork of minetestmapper and this is the current output:

Image

Looks quite nice, but I really should get to work and write a utility which is geared towards isometric from the start because this is so slooooow :-)

But if you don't mind slow, the results are quite nice imho.

To make the height differences a bit more visible I somewhat shade the blocks by height, making height blocks more whiteish and lower blocks more dark.
 

User avatar
Linuxdirk
Member
 
Posts: 1852
Joined: Wed Sep 17, 2014 11:21
Location: Germany
In-game: Linuxdirk

Re: Minetestmapper rewritten into C++

by Linuxdirk » Sat Jan 12, 2019 21:07

Ah shit! That looks great, man! Good job. The last version is beautiful.

This outplays the “official” mapper by eons :) I hope this somehow makes it into an official release.
Last edited by Linuxdirk on Sat Jan 12, 2019 22:38, edited 1 time in total.
 

User avatar
solars
Member
 
Posts: 607
Joined: Sat Jul 20, 2013 15:16

Re: Minetestmapper rewritten into C++

by solars » Sat Jan 12, 2019 22:12

I want test it!

I build https://github.com/wziard/minetestmapper/tree/iso.
What parameter must I use to get an ISO map?
My big Minetest map Karsthafen: English thread / German thread / Youtube
 

wziard
Member
 
Posts: 115
Joined: Mon Oct 29, 2018 19:12

Re: Minetestmapper rewritten into C++

by wziard » Sun Jan 13, 2019 09:25

Oh , documentation, I need to write some. :-) I'll update the docs later

int he meantime this is what I use:
Code: Select all
minetestmapper -i world/ -o isomap.png --tilesize 128x128 --isometric --drawalpha --noemptyimage --min-y -32 --scale 4


You can use --geometry to limit the area to an interesting part, because it will be very slow. You absolutely need the --tilesize (or --geomety) or the images will be huge :-).

This will result in both normal and isometric tiles. You can use the mergeiso utility (in the mergeiso subfolder) to stitch the isometric tiles into flattened tiles which fit together.

and then the 'buildpyramid' utility to create a zoom pyramid for a leaflet.js slippy map.

Oh, and you need the 'own' branch. I still need to tidy it for the iso branch.
 

User avatar
solars
Member
 
Posts: 607
Joined: Sat Jul 20, 2013 15:16

Re: Minetestmapper rewritten into C++

by solars » Sun Jan 13, 2019 17:20

I love it!

Image
iso.jpg
(176.29 KiB) Not downloaded yet


1000 thanks wziard!

P.S.: The parameter "--scale 4" dosn't work: "option '--scale' is ambiguous; possibilities: '--scalecolor' '--scales'".
But I don't need it. I can scale the images with GIMP. :)
My big Minetest map Karsthafen: English thread / German thread / Youtube
 

PreviousNext

Return to Minetest-related projects



Who is online

Users browsing this forum: No registered users and 1 guest