{"id":328,"date":"2018-12-22T23:28:35","date_gmt":"2018-12-22T23:28:35","guid":{"rendered":"http:\/\/blog.qubekwest.com\/?p=328"},"modified":"2018-12-30T00:06:30","modified_gmt":"2018-12-30T00:06:30","slug":"calendar-adjustments","status":"publish","type":"post","link":"https:\/\/blog.qubekwest.com\/?p=328","title":{"rendered":"Calendar Adjustments"},"content":{"rendered":"<p>As I ramp up my work on the project again, I am reading over and relearning a lot of code.\u00a0 Today I got to the GameCalendar class and remembered that I had a bunch of changes I wanted to make before I&#8217;d stopped work on QubeKwest.\u00a0 What I wasn&#8217;t sure of exactly, was what changes I wanted to make.\u00a0 After a bit of consideration followed by a bunch of coding, here&#8217;s the things I&#8217;ve changed.<\/p>\n<p>Tracking game ticks was a pointless complexity for the calendar system.\u00a0 Thus it was removed and that of course means that the math ticks added into the calendar was removed too.\u00a0 This makes several parts of the calendar easier to calculate and it also means that the internal workings of advancing the time for the calendar now only needs to happen roughly 1\/53rd as often.\u00a0 It&#8217;s not a lot of overhead, but I&#8217;ll take it.<\/p>\n<p>Days were too short.\u00a0 My brother and I have played a bit of Minecraft lately and been repeatedly frustrated by how short the days are.\u00a0 While I&#8217;d already build days to be longer than they were in Minecraft, I decided I wanted to make them even longer, and a bit more asymmetrical in favor of daylight.\u00a0 This table demonstrates what I&#8217;m talking about:<\/p>\n<pre>Part of Day   Minecraft   QK (Old)   QK (New)\r\n-------------------------------------------------\r\nDay            10 min     16 min     40 min      \r\nDusk          1.5 min      3 min      4 min\r\nNight           7 min     10 min     12 min\r\nDawn          1.5 min      3 min      4 min\r\n-------------------------------------------------\r\nTotal          20 min     32 min     60 min<\/pre>\n<p>This change adjusted how the game represents the current &#8220;wall clock time.&#8221;\u00a0 In simple terms, the math is different for deciding what time of day it is.\u00a0 The game will still represent the clock as a 24 hour clock of 60 minutes in each hour.\u00a0 The length of a minute in the game has just increased.\u00a0 (Now 2.5 seconds each.)<\/p>\n<p>Seasons were too short.\u00a0 Due to the length of months (16 days) it seemed incorrect to have seasons be only 2 months long.\u00a0 Thus, I&#8217;ve changed to a 16 month calendar.\u00a0 Now each of the 4 seasons is 4 months long.\u00a0 I haven&#8217;t come up with names for any of the months, and I&#8217;m not even sure if I&#8217;m going to bother.<\/p>\n<p>Moon phases still line up in the months the same way they did before.\u00a0 This is because neither the length of a month nor the number of moon phases there are have been changed.\u00a0 It doesn&#8217;t sound like a lot, but I was thankful for this break in the sweeping changes I was making.<\/p>\n<p>Due to the collected changes, the timestamp format was adjusted to have a second digit for the day of the month. The resulting format is:<\/p>\n<pre>hh:mm YYYY-MM-DD<\/pre>\n<p>Calculating this was simplified by the removal of game ticks from the calendar, but it was an almost total rewrite for this method to accommodate that adjustment.\u00a0 The best part is that the wall clock time and the timestamp are no longer only approximate values.\u00a0 Since I now only track down to the minute level, the number of minutes involved is always exactly known.\u00a0 No rounding errors any more.<\/p>\n<p>Last but not least, the collection of constants used by the calendar were updated in both name and value to make using them a little cleaner.\u00a0 It&#8217;s been a fun day that involved drawing in my notebook, coding, and correcting tests that I blew up with all these changes, but I&#8217;m also glad it&#8217;s all set now.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As I ramp up my work on the project again, I am reading over and relearning a lot of code.\u00a0 Today I got to the GameCalendar class and remembered that I had a bunch of changes I wanted to make before I&#8217;d stopped work on QubeKwest.\u00a0 What I wasn&#8217;t sure of exactly, was what changes &hellip; <a href=\"https:\/\/blog.qubekwest.com\/?p=328\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Calendar Adjustments<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-328","post","type-post","status-publish","format-standard","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/posts\/328","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=328"}],"version-history":[{"count":6,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/posts\/328\/revisions"}],"predecessor-version":[{"id":338,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=\/wp\/v2\/posts\/328\/revisions\/338"}],"wp:attachment":[{"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=328"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=328"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qubekwest.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=328"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}