{"id":784,"date":"2018-04-03T08:46:30","date_gmt":"2018-04-03T16:46:30","guid":{"rendered":"http:\/\/www.adamantyr.com\/blog\/?p=784"},"modified":"2018-04-03T08:46:30","modified_gmt":"2018-04-03T16:46:30","slug":"slants-and-wraps","status":"publish","type":"post","link":"http:\/\/www.adamantyr.com\/index.php\/2018\/04\/03\/slants-and-wraps\/","title":{"rendered":"Slants and Wraps"},"content":{"rendered":"<p>It was a frustrating weekend filled with regressions and complex problems to solve&#8230;<\/p>\n<p>The travel module is by far the oldest code in the game. Iterations of it go back all the way to 2005. As a result, some things that DID work long ago weren&#8217;t working now.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-787\" src=\"http:\/\/test.adamantyr.com\/wp-content\/uploads\/2018\/04\/boat.png\" alt=\"\" width=\"272\" height=\"208\" \/>Boats, for example, were completely broken. At some point I completely removed my original code, so I had to re-write it from scratch.<\/p>\n<p>A big part of that was that I decided not to have your boat &#8220;carried&#8221; by moving water. The main issue is that it breaks the turn-based nature of the rest of the game, and it also requires checking for moving water tiles on an interrupt.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-788\" src=\"http:\/\/test.adamantyr.com\/wp-content\/uploads\/2018\/04\/light.png\" alt=\"\" width=\"272\" height=\"208\" \/>Light was another broken part, I found every single cave I went into was fully lit. I investigated and discovered I had never re-integrated light properly after changing the LOS algorithm. This lead to a two-day maddening exercise where a few simple code changes BROKE the LOS algorithm and I had to chase down why.<\/p>\n<p>But the worst thing this weekend was slants and wraps.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-786\" src=\"http:\/\/test.adamantyr.com\/wp-content\/uploads\/2018\/04\/slant.png\" alt=\"\" width=\"272\" height=\"208\" \/>I designed the map engine to allow me to project maps not only in squares or rectangles, but also as <span class=\"Y0NH2b CLPzrc\">rhomboid<\/span>s, a slanted rectangle. This means making sure that when both you and mobs move, they move with correction to the X axis in relation to the Y to account for the slant. It also affects placement of mobs in the map window. The short explanation here is, you NEED your\u00a0 Y differential because you need to calculate what actual window thresholds are per line. It took a lot of experimentation and code cycling to get this right.<\/p>\n<p>The other thing maps can do is wrap. Normal map mode just extends the last character on the edges to infinity; stepping off the map forces a reload to a new map. Wrapped mode means it projects to the other edge, and creates a closed loop. Projecting the map isn&#8217;t too bad, but mob placement once again gets complex; you have to account for the fact that a mob and you could be at opposite ends and thus extremely close, not far away.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-789\" src=\"http:\/\/test.adamantyr.com\/wp-content\/uploads\/2018\/04\/gamble.png\" alt=\"\" width=\"272\" height=\"208\" \/>On the plus side, transactions are working well. I got the gambling module working great, and buying and selling works too.<\/p>\n<p>Next on the list, I have to fix up some other services (healing, identifying) and make sure the new inventory system (removing and using equipment and items) works as intended.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It was a frustrating weekend filled with regressions and complex problems to solve&#8230; The travel module is by far the oldest code in the game. Iterations of it go back all the way to 2005. As a result, some things &hellip; <a href=\"http:\/\/www.adamantyr.com\/index.php\/2018\/04\/03\/slants-and-wraps\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,3,4,5,11,12],"tags":[],"class_list":["post-784","post","type-post","status-publish","format-standard","hentry","category-blog","category-coding","category-crpg","category-design","category-screenshots","category-ti-994a"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pgaeMJ-cE","_links":{"self":[{"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/posts\/784","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/comments?post=784"}],"version-history":[{"count":2,"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/posts\/784\/revisions"}],"predecessor-version":[{"id":790,"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/posts\/784\/revisions\/790"}],"wp:attachment":[{"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/media?parent=784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/categories?post=784"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/tags?post=784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}