{"id":1661,"date":"2012-08-01T11:22:43","date_gmt":"2012-08-01T10:22:43","guid":{"rendered":"http:\/\/www.holyfingers.co.uk\/main\/?p=1661"},"modified":"2020-03-14T16:45:10","modified_gmt":"2020-03-14T16:45:10","slug":"game-dev-diary-4","status":"publish","type":"post","link":"https:\/\/www.holyfingers.co.uk\/main\/blog\/2012\/08\/01\/game-dev-diary-4\/","title":{"rendered":"Development Diary #4: Progress"},"content":{"rendered":"<p style=\"text-align: justify;\">The last couple of months have had a pretty steep learning curve but, at last, something vaguely game-like is beginning to take shape. This is what I&#8217;ve been working on:<\/p>\n<ul>\n<li>Basic camera moves and cuts<\/li>\n<li>Various types of animation control<\/li>\n<li>Custom cursor with different animated rollover states<\/li>\n<li>Real-time and baked shadows with toon-shading<\/li>\n<li>Lightswitchs<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">You can see a video on YouTube <a href=\"https:\/\/youtu.be\/NYmxhzqxCWM\">here<\/a>. Unsurprisingly, it&#8217;s still my lack of general scripting experience that&#8217;s slowing me up. All too often I find myself going online to &#8220;quickly&#8221; look up a reference, only to encounter basic terms I&#8217;ve never heard of and having to spend hours\/days down tutorial filled rabbit-holes&#8230;<\/p>\n<p style=\"text-align: justify;\"><!--more-->For instance, while working on the light switches I was trying to find out how to access culling-masks\/layers via script, I came across numerous examples that look like this:<\/p>\n<blockquote>\n<pre><span style=\"color: #3366ff;\">var<\/span> cullingMask = <span style=\"color: #ff00ff;\">1<\/span>&lt;&lt;<span style=\"color: #ff00ff;\">8<\/span>|<span style=\"color: #ff00ff;\">1<\/span>&lt;&lt;<span style=\"color: #ff00ff;\">9<\/span>;<\/pre>\n<\/blockquote>\n<p style=\"text-align: justify;\">If, like me, you&#8217;ve never heard of a bitwise operator how do you go about deciphering the above? <a href=\"http:\/\/www.google.com\/search?q=%3C%3C\" target=\"_blank\" rel=\"noopener noreferrer\">Googling <strong>&lt;&lt;<\/strong><\/a> isn&#8217;t even slightly helpful so it comes down to looking though forum posts for clues and relevant terms before piecing together a solution. Eventually I established that Unity references its layers as bits in a 32-bit integer, so in a list of 0&#8217;s, each one representing a layer, a 1 indicates a layer is active, essentially it&#8217;s a series of check boxes with a 1 instead of an x. In order to convert the layer number you see in Unity to this format it has to be bitshifted, with the help of <a href=\"http:\/\/en.wikipedia.org\/wiki\/Bitwise_operation#Shifts_in_Java\" target=\"_blank\" rel=\"noopener noreferrer\">Wikipedia<\/a> I learn that that&#8217;s what the <strong>&lt;&lt;<\/strong> does, and the <strong>|<\/strong> is an <em>or<\/em> operator. The above code essentially checks the visibility box for layers 8 and 9.<\/p>\n<p style=\"text-align: justify;\">This may seem like a ridiculous way of learning how to develop a game, stopping and starting constantly, and I certainly find it very frustrating at times, but to be honest I don&#8217;t think I could do it any other way. This goes back to my <a title=\"Development Diary #2: First Steps\" href=\"https:\/\/www.holyfingers.co.uk\/main\/2012\/02\/game-dev-diary-2\/\" target=\"_blank\" rel=\"noopener noreferrer\">previous entry<\/a> about the context of learning; if I&#8217;d been taught this in a CS101 class I would&#8217;ve fallen asleep. In this case I wanted to stop the moon from lighting up the kitchen when I switched the light on, this is just the convoluted way the software makes me do that and, as a 3D artist, if there&#8217;s one thing I&#8217;m comfortable with it&#8217;s convoluted solutions to straight forward problems.<\/p>\n<p style=\"text-align: justify;\">As for the rest of the scene, I&#8217;m slowly pushing towards a look I like, still aiming for something like a vector illustration, at the moment I&#8217;m using a combination of Unity&#8217;s built-in Lighted Toon Shader with a few different constant ramps, the Basic Toon Shader with a cube map and several textures with shadows baked in Softimage. So far, after much trial and error I&#8217;m getting reasonably consistent results.<\/p>\n<p style=\"text-align: justify;\">Next step now is to replicate the click-to-move and inventory system functionality of my last <a title=\"Updated Prototype\u2026\" href=\"https:\/\/www.holyfingers.co.uk\/main\/2012\/04\/updated-prototype\/\" target=\"_blank\" rel=\"noopener noreferrer\">prototype<\/a>, only with an animated character. I had more than a few issues getting simple animated transforms working so it should be interesting to see how I get on with a whole hierarchy of bones and a skinned mesh. Really looking forward to trying out the new <a href=\"http:\/\/unity3d.com\/?mecanim\">animation features in Unity 4<\/a>, until then I&#8217;ll be looking at <a title=\"UNITY: Locomotin System\" href=\"http:\/\/unity3d.com\/support\/resources\/unity-extensions\/locomotion-ik\">Locomotion<\/a>, from what I can gather Mechanim wont be supporting quadrupeds from launch so I&#8217;ll need to get to grips with the latter anyway.<\/p>\n<p style=\"text-align: justify;\"><em>If you have questions, suggestions or happen to know where I can get cheap, brand-name clothing, feel free to leave your words in the box below.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The last couple of months have had a pretty steep learning curve but, at last, something vaguely game-like is beginning to take shape. This is what I&#8217;ve been working on: Basic camera moves and cuts Various types of animation control Custom cursor with different animated rollover states Real-time and baked shadows with toon-shading Lightswitchs You &#8230; <a title=\"Development Diary #4: Progress\" class=\"read-more\" href=\"https:\/\/www.holyfingers.co.uk\/main\/blog\/2012\/08\/01\/game-dev-diary-4\/\" aria-label=\"Read more about Development Diary #4: Progress\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":1906,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[55],"tags":[43,64,58,18,76,57,59],"class_list":["post-1661","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-game-development","tag-3d","tag-dev-diary","tag-scripting","tag-softimage","tag-toryanse","tag-unity","tag-unityscript"],"_links":{"self":[{"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/posts\/1661","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/comments?post=1661"}],"version-history":[{"count":65,"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/posts\/1661\/revisions"}],"predecessor-version":[{"id":4054,"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/posts\/1661\/revisions\/4054"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/media\/1906"}],"wp:attachment":[{"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/media?parent=1661"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/categories?post=1661"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.holyfingers.co.uk\/main\/wp-json\/wp\/v2\/tags?post=1661"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}