spoutn1k / mcmap

Pixel-art map visualizer for Minecraft. Maps are drawn from an isometric perspective.
GNU General Public License v3.0
312 stars 45 forks source link

Assert failure when generating tiled output #99

Open jhardin-impsec opened 1 year ago

jhardin-impsec commented 1 year ago

Attempting to generate a tiled map in 3.0.1 64-bit crashes with this assertion failure:

/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_vector.h:1123: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = png_text_struct; _Alloc = std::allocator<png_text_struct>; reference = png_text_struct&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.
Aborted

...near the end of the process. Output subdirs and mapinfo.json file are created, but only 0/0.png is created, and it is empty.

Build:

jhardin@davinci ~/develop/mcmap/build $ cmake ..
-- The CXX compiler identification is GNU 12.3.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /usr/lib/libz.so (found version "1.2.13")  
-- Found PNG: /usr/lib/libpng.so (found version "1.6.40") 
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 
-- Found Git: /usr/bin/git (found version "2.41.0") 
-- Successfully downloaded https://github.com/nlohmann/json/releases/download/v3.9.1/json.hpp
-- Configuring done (4.5s)
-- Generating done (0.0s)
-- Build files have been written to: /home/jhardin/develop/mcmap/build

About:

Architecture: 64 bits
Compiler: GNU 12.3.1
Source version: 1c21ac9
Threading: OpenMP
fmt version: 9.1.0
libpng version: 1.6.40
spdlog version: 1.11.0
zlib version: 1.2.13

Processing same game save file as a single image completes successfully.

spoutn1k commented 1 year ago

Could you rerun with the -vv option and share the output ?

jhardin-impsec commented 1 year ago

mcmap_logs.zip Sorry, I was running the GUI the first time around.

$ ./mcmap -vv -tile 64 /home/jhardin/.minecraft/saves/SharedWorldTest
[2023-08-15 07:36:59.615] [mcmap_cli] [debug] Parsing /home/jhardin/.minecraft/saves/SharedWorldTest/level.dat
[2023-08-15 07:36:59.618] [mcmap_cli] [debug] World spans from -640.-704.-64 ~> 911.623.319 (North-West)
[2023-08-15 07:36:59.622] [mcmap_cli] [debug] Rendering SharedWorldTest with -640.-704.-64 ~> 911.623.319 (North-West)
[2023-08-15 07:36:59.622] [mcmap_cli] [debug] Memory capacity: 64 fragments - 4 fragments scheduled
[2023-08-15 07:36:59.623] [mcmap_cli] [debug] Rendering -640.-704.-64 ~> 383.319.319 (North-West)
[2023-08-15 07:36:59.623] [mcmap_cli] [debug] Rendering 384.320.-64 ~> 911.623.319 (North-West)
[2023-08-15 07:36:59.624] [mcmap_cli] [debug] Rendering 384.-704.-64 ~> 911.319.319 (North-West)
[2023-08-15 07:36:59.624] [mcmap_cli] [debug] Rendering -640.320.-64 ~> 383.623.319 (North-West)
[2023-08-15 07:36:59.647] [mcmap_cli] [trace] Chunk parsing failed for chunk -40 20 in /home/jhardin/.minecraft/saves/SharedWorldTest/region/r.-2.0.m
[mcmap_logs.zip](https://github.com/spoutn1k/mcmap/files/12345339/mcmap_logs.zip)
ca
[2023-08-15 07:36:59.647] [mcmap_cli] [trace] Chunk loading failed for -40 20
[2023-08-15 07:36:59.647] [mcmap_cli] [trace] Chunk parsing failed for chunk -40 21 in /home/jhardin/.minecraft/saves/SharedWorldTest/region/r.-2.0.mca
[2023-08-15 07:36:59.647] [mcmap_cli] [trace] Chunk loading failed for -40 21
[2023-08-15 07:36:59.647] [mcmap_cli] [trace] Chunk parsing failed for chunk -40 22 in /home/jhardin/.minecraft/saves/SharedWorldTest/region/r.-2.0.mca
[2023-08-15 07:36:59.647] [mcmap_cli] [trace] Chunk loading failed for -40 22
...

...etc., for all chunks. It ends with:

[2023-08-15 07:37:17.467] [mcmap_cli] [trace] Chunk loading failed for 23 -32
[2023-08-15 07:37:17.778] [mcmap_cli] [debug] Rendered in 18155ms
[2023-08-15 07:37:17.778] [mcmap_cli] [debug] Canvas canvas (5760x4031 for -640.-704.-64 ~> 911.623.319 (North-West))
 - Byte canvas (1664x1983 for 384.320.-64 ~> 911.623.319 (North-West)), offset 2048.2048
 - Byte canvas (2656x2479 for -640.320.-64 ~> 383.623.319 (North-West)), offset 0.1024
 - Byte canvas (3104x2703 for 384.-704.-64 ~> 911.319.319 (North-West)), offset 2656.1024
 - Byte canvas (4096x3199 for -640.-704.-64 ~> 383.319.319 (North-West)), offset 608.0
[2023-08-15 07:37:17.779] [mcmap_cli] [trace] [PNGWriter] image 64x64, 32bpp, writing to /home/jhardin/develop/mcmap/build/bin/output/0/0.png
/usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/bits/stl_vector.h:1123: std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = png_text_struct; _Alloc = std::allocator<png_text_struct>; reference = png_text_struct&; size_type = long unsigned int]: Assertion '__n < this->size()' failed.

Comparison:

$ ./mcmap -vv /home/jhardin/.minecraft/saves/SharedWorldTest
[2023-08-15 07:37:28.280] [mcmap_cli] [debug] Parsing /home/jhardin/.minecraft/saves/SharedWorldTest/level.dat
[2023-08-15 07:37:28.283] [mcmap_cli] [debug] World spans from -640.-704.-64 ~> 911.623.319 (North-West)
[2023-08-15 07:37:28.287] [mcmap_cli] [debug] Rendering SharedWorldTest with -640.-704.-64 ~> 911.623.319 (North-West)
[2023-08-15 07:37:28.287] [mcmap_cli] [debug] Memory capacity: 64 fragments - 4 fragments scheduled
[2023-08-15 07:37:28.288] [mcmap_cli] [debug] Rendering -640.-704.-64 ~> 383.319.319 (North-West)
[2023-08-15 07:37:28.289] [mcmap_cli] [debug] Rendering 384.-704.-64 ~> 911.319.319 (North-West)
[2023-08-15 07:37:28.289] [mcmap_cli] [debug] Rendering 384.320.-64 ~> 911.623.319 (North-West)
[2023-08-15 07:37:28.289] [mcmap_cli] [debug] Rendering -640.320.-64 ~> 383.623.319 (North-West)
[2023-08-15 07:37:28.310] [mcmap_cli] [trace] Chunk parsing failed for chunk -40 20 in /home/jhardin/.minecraft/saves/SharedWorldTest/region/r.-2.0.mca
[2023-08-15 07:37:28.310] [mcmap_cli] [trace] Chunk loading failed for -40 20
[2023-08-15 07:37:28.311] [mcmap_cli] [trace] Chunk parsing failed for chunk -40 21 in /home/jhardin/.minecraft/saves/SharedWorldTest/region/r.-2.0.mca
[2023-08-15 07:37:28.311] [mcmap_cli] [trace] Chunk loading failed for -40 21
[2023-08-15 07:37:28.311] [mcmap_cli] [trace] Chunk parsing failed for chunk -40 22 in /home/jhardin/.minecraft/saves/SharedWorldTest/region/r.-2.0.mca
[2023-08-15 07:37:28.311] [mcmap_cli] [trace] Chunk loading failed for -40 22
...
[2023-08-15 07:37:47.162] [mcmap_cli] [debug] Rendered in 18874ms
[2023-08-15 07:37:47.162] [mcmap_cli] [debug] Canvas canvas (5760x4031 for -640.-704.-64 ~> 911.623.319 (North-West))
 - Byte canvas (1664x1983 for 384.320.-64 ~> 911.623.319 (North-West)), offset 2048.2048
 - Byte canvas (2656x2479 for -640.320.-64 ~> 383.623.319 (North-West)), offset 0.1024
 - Byte canvas (3104x2703 for 384.-704.-64 ~> 911.319.319 (North-West)), offset 2656.1024
 - Byte canvas (4096x3199 for -640.-704.-64 ~> 383.319.319 (North-West)), offset 608.0
[2023-08-15 07:37:47.162] [mcmap_cli] [trace] [PNGWriter] image 5770x4041, 32bpp, writing to output.png
[2023-08-15 07:37:50.216] [mcmap_cli] [debug] Drawn PNG in 3054ms

...and it generated an image successfully.

This is a 1.20.1 save file. I'll try an older one...

Tiled does not crash on a map last touched in 2017, but it still generates tons of chunk loading errors and cannot render. It ends with:

[2023-08-15 07:46:46.641] [mcmap_cli] [trace] Chunk loading failed for 155 87
[2023-08-15 07:46:46.660] [mcmap_cli] [debug] Rendered in 5072ms
[2023-08-15 07:46:46.660] [mcmap_cli] [debug] Canvas canvas (0x0 for 2147483647.2147483647.32767 ~> -2147483648.-2147483648.-32768 (North-West))
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
 - Void canvas, offset 0.0
[2023-08-15 07:46:46.660] [mcmap_cli] [error] Canvas is empty !
[2023-08-15 07:46:46.660] [mcmap_cli] [error] Error rendering terrain.

Logs attached.

spoutn1k commented 1 year ago

Thank you for all of this. Before I continue, which version is this running in ?

jhardin-impsec commented 1 year ago

Of Linux? Gentoo, up-to-date.

Of mcmap? 3.0.1 Source version: 1c21ac9, downloaded yesterday.