{"id":184,"date":"2014-10-12T12:27:51","date_gmt":"2014-10-12T12:27:51","guid":{"rendered":"http:\/\/www.meer-emanuel.nl\/portfolio\/?p=184"},"modified":"2014-10-12T12:27:51","modified_gmt":"2014-10-12T12:27:51","slug":"bitwise-tilemaps","status":"publish","type":"post","link":"https:\/\/meer-emanuel.nl\/?p=184","title":{"rendered":"Bitwise Tilemaps"},"content":{"rendered":"<p>Here is a technique that I have been wanting to use in my projects for a while: Bitwise Tile Generation. It&#8217;s usefull to add some flavor to your world\/level.<\/p>\n<p>Basically you use a full tileset for the grass or platformer tiles in your game and you calculate if there are similair tiles next to each other to change the sprites. If you don&#8217;t have to calculate corners you just have to check 4 tiles each time for 16 different combinations.<\/p>\n<figure id=\"attachment_185\" aria-describedby=\"caption-attachment-185\" style=\"width: 120px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.meer-emanuel.nl\/portfolio\/wp-content\/uploads\/2014\/10\/Bitwise-1.png\"><img decoding=\"async\" class=\"wp-image-185 size-full\" src=\"http:\/\/www.meer-emanuel.nl\/portfolio\/wp-content\/uploads\/2014\/10\/Bitwise-1.png\" alt=\"Bitwise 1\" width=\"120\" height=\"120\" \/><\/a><figcaption id=\"caption-attachment-185\" class=\"wp-caption-text\">Bitwise Tile Generation<\/figcaption><\/figure>\n<p>If\u00a0 you only have a tile on top you will use sprite 1 in the middle. But it you have a tile to the right and on the bottom you would use sprite 6. There are 16 different combinations from no tiles (0) to all tiles(15).<br \/>\nThe reason why this technique is called Bitwise is because you&#8217;re basically using bits to check if there is a tile or not. 0000 translates to 0 or no tiles. And 0001 would be a tile on the top and so on.<\/p>\n<p>But what if you would like to check the corner tiles as well?<\/p>\n<figure id=\"attachment_186\" aria-describedby=\"caption-attachment-186\" style=\"width: 120px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.meer-emanuel.nl\/portfolio\/wp-content\/uploads\/2014\/10\/Bitwise-2.png\"><img decoding=\"async\" class=\"wp-image-186 size-full\" src=\"http:\/\/www.meer-emanuel.nl\/portfolio\/wp-content\/uploads\/2014\/10\/Bitwise-2.png\" alt=\"Bitwise 2\" width=\"120\" height=\"120\" \/><\/a><figcaption id=\"caption-attachment-186\" class=\"wp-caption-text\">Bitwise Tiles with Corners<\/figcaption><\/figure>\n<p>Wel you just need to use more bits to check every possible combination. With corners you will have a full byte with 256 possible combinations from 00000000 to 11111111.<\/p>\n<p>It&#8217;s a very usefull technique to use and it saves you a lot of time compared to building the world manually!<\/p>\n<p><strong>Source\/Extra links:<\/strong><br \/>\nSaltgames blog: <a href=\"http:\/\/www.saltgames.com\/2010\/a-bitwise-method-for-applying-tilemaps\/\">http:\/\/www.saltgames.com\/2010\/a-bitwise-method-for-applying-tilemaps\/<\/a>Flashpunk Forum post: <a href=\"http:\/\/developers.useflashpunk.net\/t\/flixel-compatible-tilemap-autoset\/1736\">http:\/\/developers.useflashpunk.net\/t\/flixel-compatible-tilemap-autoset\/1736<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a technique that I have been wanting to use in my projects for a while: Bitwise Tile Generation. It&#8217;s usefull to add some flavor to your world\/level. Basically you use a full tileset for the grass or platformer tiles in your game and you calculate if there are similair tiles next to each<\/p>\n<div class=\"more-link\">\n\t\t\t\t <a href=\"https:\/\/meer-emanuel.nl\/?p=184\" class=\"link-btn theme-btn\"><span>Read More <\/span> <i class=\"fa fa-caret-right\"><\/i><\/a>\n\t\t\t<\/div>\n","protected":false},"author":3,"featured_media":186,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,6],"tags":[],"class_list":["post-184","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-game-design","category-programming"],"_links":{"self":[{"href":"https:\/\/meer-emanuel.nl\/index.php?rest_route=\/wp\/v2\/posts\/184","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meer-emanuel.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meer-emanuel.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meer-emanuel.nl\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/meer-emanuel.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=184"}],"version-history":[{"count":0,"href":"https:\/\/meer-emanuel.nl\/index.php?rest_route=\/wp\/v2\/posts\/184\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/meer-emanuel.nl\/index.php?rest_route=\/"}],"wp:attachment":[{"href":"https:\/\/meer-emanuel.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=184"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meer-emanuel.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=184"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meer-emanuel.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=184"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}