{"id":46,"date":"2025-02-16T21:49:34","date_gmt":"2025-02-16T21:49:34","guid":{"rendered":"https:\/\/thatuglydude.com\/?p=46"},"modified":"2025-02-16T21:49:34","modified_gmt":"2025-02-16T21:49:34","slug":"emerald-world-2","status":"publish","type":"post","link":"https:\/\/thatuglydude.com\/index.php\/2025\/02\/16\/emerald-world-2\/","title":{"rendered":"Emerald World #2"},"content":{"rendered":"\n<p>Thanks to the quick and useful responses on <a href=\"https:\/\/www.celestialheavens.com\/forum\/topic\/18769\" data-type=\"link\" data-id=\"https:\/\/www.celestialheavens.com\/forum\/topic\/18769\">the Celestal Heavens forum<\/a>, I could extract the height map of the Emerald Island to recreate it in Godot.<\/p>\n\n\n\n<p>In order to do it:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>I installed Might and Magic 7 vanilla and then the GrayFace&#8217;s patch.<\/li>\n\n\n\n<li>Afterwards, I downloaded <a href=\"https:\/\/grayface.github.io\/mm\/ext\/\" data-type=\"link\" data-id=\"https:\/\/grayface.github.io\/mm\/ext\/\">the MM7Extension<\/a> and pasted it into the game installation directory.<\/li>\n\n\n\n<li>Start a new game, Ctrl+F1 to bring up the debug menu. The debug menu accepts Lua scripts. The following suffices to dump the height map data to a CSV format:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>map_file = io.open(\"emerald_height_map.txt\", \"w\")\nfor k in Map.HeightMap do\n  for j in Map.HeightMap&#091;k] do\n    map_file:write(Map.HeightMap&#091;k]&#091;j], \",\")\n  end\n  map_file:write(\"\\n\")\nend\nmap_file.close()<\/code><\/pre>\n\n\n\n<p>The height map, when copied into LibreCalc with value based colors gave the following, ok-ish looking result:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default wp-duotone-unset-1\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"778\" src=\"https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_height_map-1-1024x778.png\" alt=\"\" class=\"wp-image-48\" srcset=\"https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_height_map-1-1024x778.png 1024w, https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_height_map-1-300x228.png 300w, https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_height_map-1-768x584.png 768w, https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_height_map-1.png 1255w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ol start=\"4\" class=\"wp-block-list\">\n<li>I could then use Python to convert the CSV file to an image:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>from PIL import Image\nimport numpy\nmy_data = numpy.genfromtxt(\"emerald_height_map.txt\", delimiter=',')\nim = Image.fromarray(my_data)\nim2 = im.convert(\"L\")\nim2.save(\"emerald.png\")<\/code><\/pre>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\">\n<li>Since <a href=\"https:\/\/docs.godotengine.org\/en\/stable\/classes\/class_heightmapshape3d.html#heightmapshape3d\" data-type=\"link\" data-id=\"https:\/\/docs.godotengine.org\/en\/stable\/classes\/class_heightmapshape3d.html#heightmapshape3d\">Godot height maps&#8217;<\/a> seem to prefer <a href=\"https:\/\/openexr.com\/en\/latest\/\" data-type=\"link\" data-id=\"https:\/\/openexr.com\/en\/latest\/\">OpenEXR <\/a>format, I used Gimp to open the PNG file, and simply export as EXR.<\/li>\n\n\n\n<li>I then followed <a href=\"https:\/\/www.youtube.com\/watch?v=fEG_cnRQ1HI\" data-type=\"link\" data-id=\"https:\/\/www.youtube.com\/watch?v=fEG_cnRQ1HI\">a concise tutorial<\/a>, starting from the half, to get a collision map, and a mesh for the island.<\/li>\n<\/ol>\n\n\n\n<p>The final result, imperfect but showing the map loaded into Godot, looks like this:<\/p>\n\n\n\n<ol start=\"5\" class=\"wp-block-list\"><\/ol>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Emerald World #2: Height map\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/OGZZ0qyX_HM?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><figcaption class=\"wp-element-caption\">Brief overlook from the starting location, as in the original.<\/figcaption><\/figure>\n\n\n\n<p>Compared to the following original, you can recognize the major features of the island, although its height is not ideal, textures are wrong and it&#8217;s more &#8220;spiky&#8221;.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large wp-duotone-unset-2\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"574\" src=\"https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_ori_overlook-1024x574.png\" alt=\"\" class=\"wp-image-47\" srcset=\"https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_ori_overlook-1024x574.png 1024w, https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_ori_overlook-300x168.png 300w, https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_ori_overlook-768x431.png 768w, https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_ori_overlook-1536x861.png 1536w, https:\/\/thatuglydude.com\/wp-content\/uploads\/2025\/02\/emerald_ori_overlook.png 1812w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thanks to the quick and useful responses on the Celestal Heavens forum, I could extract the height map of the Emerald Island to recreate it in Godot. In order to do it: The height map, when copied into LibreCalc with value based colors gave the following, ok-ish looking result: The final result, imperfect but showing [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,4,5],"tags":[],"class_list":["post-46","post","type-post","status-publish","format-standard","hentry","category-gamedev","category-godot","category-mightandmagic"],"_links":{"self":[{"href":"https:\/\/thatuglydude.com\/index.php\/wp-json\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thatuglydude.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thatuglydude.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thatuglydude.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thatuglydude.com\/index.php\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":1,"href":"https:\/\/thatuglydude.com\/index.php\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"predecessor-version":[{"id":50,"href":"https:\/\/thatuglydude.com\/index.php\/wp-json\/wp\/v2\/posts\/46\/revisions\/50"}],"wp:attachment":[{"href":"https:\/\/thatuglydude.com\/index.php\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thatuglydude.com\/index.php\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thatuglydude.com\/index.php\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}