{"id":1390,"date":"2017-01-21T20:53:38","date_gmt":"2017-01-22T04:53:38","guid":{"rendered":"http:\/\/haymanquarterly.com\/blogs\/?p=1390"},"modified":"2017-01-21T21:07:14","modified_gmt":"2017-01-22T05:07:14","slug":"smalltown-grocery-devlog-2","status":"publish","type":"post","link":"http:\/\/haymanquarterly.com\/blogs\/blog\/2017\/01\/21\/smalltown-grocery-devlog-2\/","title":{"rendered":"Smalltown Grocery &#8211; DevLog 2"},"content":{"rendered":"<p>This week I&#8217;ve managed to come closer to terms with my limitations.<\/p>\n<p>While trying to prototype grid-based\u00a0pathfinding (using the gamemaker mp- and path functions) I have realized I will not be able to use small sized walls (4 x 4) in conjunction with larger objects (32 x 32). \u00a0When I tried it, the customer would travel too close to objects, overlapping them. \u00a0Plus, it causes major headaches when trying to map out a grid, having to adjust for the 4 pixels of the wall then start counting by 32&#8217;s again. \u00a0It&#8217;s probably do-able, but not by me! \u00a0No, thank you! \u00a0So I&#8217;ve determined\/decided that a 32 x 32 square will be my grid cell size. \u00a0Thereafter, all objects will need to be placed so that the unused cells will allow for pathfinding.<\/p>\n<p>Many of my shelves (Produce, Cold Cases, Freezers, Dairy Coolers) are 32 x 32 and they will work fine, as long as I don&#8217;t double park these on two or four different grid cells. \u00a0I must make sure they line up with the grid cells perfectly when I create the store layout for the game.<\/p>\n<p>The regular store shelves are 32 x 16. \u00a0These are a little tricky. \u00a0I need to make sure the fronts of these shelves are adjacent to an open cell, otherwise they won&#8217;t be reachable by the pathfinding. \u00a0This leaves me with a slight dilemma of unused space behind the shelf if I want to put these against a wall. (You can see what I mean in the gif below.)<\/p>\n<p>I found some graph paper and began scrawling out a level. \u00a0This was a good move on my part because it helped me begin to visualize what I was wanting to accomplish\u00a0a bit better. \u00a0On graph paper, I mapped out an entire store. \u00a0But right now, I just wanted to figure out pathfinding from shelf to shelf. \u00a0A small prototype room of walls and shelves and a customer is what I need.<\/p>\n<p>So, after throwing out a bunch of code and starting over, I was able to make a small (un-animated) prototype of a customer wandering to randomly chosen shelves, grabbing an item, then moving on. \u00a0Not great progress, but progress nonetheless. \u00a0Baby steps, man, baby steps.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/haymanquarterly.com\/haymangames\/SmalltownGrocery\/promo\/customer_shopping_proto_00.gif\" alt=\"\" width=\"640\" height=\"464\" \/><\/p>\n<p>The numbers on the shelves represent the amount of items on that shelf. \u00a0The black dot is a debug item I made to show the intended destination of the current path. (The coordinates were off a bit at first, so this was how I helped myself to see it better, along with the debug text at the top-left.) \u00a0The way it works is &#8212; it finds all the available shelves, randomly chooses one of them, finds\u00a0the grid cell coordinates of the open grid cell in front of the chosen shelf, and then creates the path to those coordinates. \u00a0There&#8217;s a delay between paths with a toggle to grab an item from the shelf at that location.<\/p>\n<p>After putting this together, I&#8217;m contemplating how to give different shelves (items) popularity factors. \u00a0With a high popularity factor, that item has more of a chance to be chosen as the next path destination. \u00a0I&#8217;m debating whether to give the shelves item types also (canned food, baking goods, pet food, etc). \u00a0This also gave me other insights as to what sort of stats I&#8217;ll need for the customer. \u00a0Stuff like: \u00a0number of items needed, perhaps types of items (produce, dairy, meat, etc), and customer satisfaction (if a desired item is unavailable). \u00a0I&#8217;m really going to have to give this a good, healthy think. \u00a0I don&#8217;t want to get bogged down in a bunch of unnecessary features, but I don&#8217;t want it to be too generic, either.<\/p>\n<p>Looks like I&#8217;m going to have to get serious about writing out some game design elements and features on paper. \u00a0I&#8217;m pretty sure that is my next step, as I can&#8217;t really write code for features and ideas that are not fully formed. \u00a0\ud83d\ude1b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I&#8217;ve managed to come closer to terms with my limitations. While trying to prototype grid-based\u00a0pathfinding (using the gamemaker mp- and path functions) I have realized I will not be able to use small sized walls (4 x 4) in conjunction with larger objects (32 x 32). \u00a0When I tried it, the customer would &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"http:\/\/haymanquarterly.com\/blogs\/blog\/2017\/01\/21\/smalltown-grocery-devlog-2\/\">Continue reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,20,64],"tags":[71,80,66,81,65],"_links":{"self":[{"href":"http:\/\/haymanquarterly.com\/blogs\/wp-json\/wp\/v2\/posts\/1390"}],"collection":[{"href":"http:\/\/haymanquarterly.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/haymanquarterly.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/haymanquarterly.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/haymanquarterly.com\/blogs\/wp-json\/wp\/v2\/comments?post=1390"}],"version-history":[{"count":1,"href":"http:\/\/haymanquarterly.com\/blogs\/wp-json\/wp\/v2\/posts\/1390\/revisions"}],"predecessor-version":[{"id":1391,"href":"http:\/\/haymanquarterly.com\/blogs\/wp-json\/wp\/v2\/posts\/1390\/revisions\/1391"}],"wp:attachment":[{"href":"http:\/\/haymanquarterly.com\/blogs\/wp-json\/wp\/v2\/media?parent=1390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/haymanquarterly.com\/blogs\/wp-json\/wp\/v2\/categories?post=1390"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/haymanquarterly.com\/blogs\/wp-json\/wp\/v2\/tags?post=1390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}