{"id":101,"date":"2013-03-17T09:58:00","date_gmt":"2013-03-17T17:58:00","guid":{"rendered":"http:\/\/adamantyr.com\/blog\/?p=101"},"modified":"2017-09-20T08:26:20","modified_gmt":"2017-09-20T16:26:20","slug":"tactical-position","status":"publish","type":"post","link":"http:\/\/www.adamantyr.com\/index.php\/2013\/03\/17\/tactical-position\/","title":{"rendered":"Tactical Position"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-597\" src=\"http:\/\/test.adamantyr.com\/wp-content\/uploads\/2017\/09\/bm4.png\" alt=\"\" width=\"272\" height=\"208\" \/>It was a bit more work than expected, but battlemaps are now loading dynamically AND units are being placed dynamically as well.<\/p>\n<p>The main problem I encountered was that my trigonometric functions were, well, not working right. I dug around and found a test program I&#8217;d written for them and discovered I had fixed the issues there, so I just had to port the code over into the CRPG source.<\/p>\n<p>Experimentation with positions was a bit of work too. I wanted it to be intelligent when placing units. Your top two units are your &#8220;front-line&#8221; characters, so they should usually be the ones closest to your foes, while the others hang back. So I included a starting angle and two different coordinates for each side of the map. Interestingly enough, the second set of coordinates end up trying to place units off-map, which kicks in the directional placement, that scoots them back in on the back line. Wow, it&#8217;s like I designed it that way. \ud83d\ude42<\/p>\n<p>For ambushes, there&#8217;s only one coordinate at the center, and both sets of units are placed around it at a different radius. I haven&#8217;t written this code yet, since it requires monster A.I. to make sure that they get the first turn.<\/p>\n<p>Now I&#8217;ll move on to the battle&#8217;s end, when treasure is determined and clean-up and updates are done prior to returning to travel mode. Eventually this will also involve updating data on disk; I do not want the game to have the same encounters (and treasure) in the same place. If there&#8217;s one thing I&#8217;ve learned from reading up on the <a href=\"http:\/\/crpgaddict.blogspot.com\/\">CRPG Addict&#8217;s blog<\/a>, it&#8217;s that CRPG&#8217;s should make you feel like your actions CHANGE the world.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It was a bit more work than expected, but battlemaps are now loading dynamically AND units are being placed dynamically as well. The main problem I encountered was that my trigonometric functions were, well, not working right. I dug around &hellip; <a href=\"http:\/\/www.adamantyr.com\/index.php\/2013\/03\/17\/tactical-position\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","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":[3,4,5,11,12],"tags":[],"class_list":["post-101","post","type-post","status-publish","format-standard","hentry","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-1D","_links":{"self":[{"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/posts\/101","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=101"}],"version-history":[{"count":1,"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/posts\/101\/revisions"}],"predecessor-version":[{"id":656,"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/posts\/101\/revisions\/656"}],"wp:attachment":[{"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/media?parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/categories?post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.adamantyr.com\/index.php\/wp-json\/wp\/v2\/tags?post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}