{"id":813,"date":"2015-12-03T11:19:35","date_gmt":"2015-12-03T11:19:35","guid":{"rendered":"http:\/\/faulknermano.com\/blog\/?p=813"},"modified":"2015-12-03T11:24:03","modified_gmt":"2015-12-03T11:24:03","slug":"3400ad-lookups","status":"publish","type":"post","link":"http:\/\/faulknermano.com\/blog\/3400ad-lookups\/","title":{"rendered":"3400AD: Lookups"},"content":{"rendered":"<p>So I had been working in Open Office Calc recently, something I didn&#8217;t expect to do more than just table up some values and do simple additions. In fact, I got a little deeper than I thought I would.<\/p>\n<p>Normally, I would weigh up the worth of learning something new with the practicality of getting stuff done. Furthermore, &#8216;getting stuff done&#8217; is about keeping the flow of the work going so that I don&#8217;t get stuck, don&#8217;t procrastinate, don&#8217;t lose my train of thought. So it&#8217;s more than just producing new code, or new assets; it&#8217;s about striking when and where the iron is hot.<\/p>\n<p>I had been working on tables in Calc because I use lookups for system <em>rolls<\/em> such as <em>chance-to-hit<\/em> and <em>defence<\/em>. Up to this point I had been simply inputting the values by hand (temporarily hard-coding it in Unity). But I realised that I wanted a way to visualise skill improvements as the player <em>levelled up<\/em> and apply this visualisation to the actual values. This visualisation was simply being able to draw a curve that represents increase of values over another value (eg skills).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-814\" src=\"http:\/\/faulknermano.com\/blog\/wp-content\/uploads\/2015\/12\/2015-12-03-23_52_32-DisguiseStealth.ods-OpenOffice-Calc.jpg\" alt=\"2015-12-03 23_52_32-DisguiseStealth.ods - OpenOffice Calc\" width=\"749\" height=\"500\" srcset=\"http:\/\/faulknermano.com\/blog\/wp-content\/uploads\/2015\/12\/2015-12-03-23_52_32-DisguiseStealth.ods-OpenOffice-Calc.jpg 749w, http:\/\/faulknermano.com\/blog\/wp-content\/uploads\/2015\/12\/2015-12-03-23_52_32-DisguiseStealth.ods-OpenOffice-Calc-300x200.jpg 300w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/p>\n<p>The basic premise is that I define a curve, whose Y value is from 0-1, and whose X value represents a <em>real number<\/em>, which, in the case I had been working on, skill level points of the player. (Thinking about it now, I could have further made the curve generic by using 0-1 on the X as well and interpolate the skill points on the table.) When the curve is defined, I take the min\/max values that are pre-defined, map the inbetween values using the interpolation code, which derives itself from the curve.<\/p>\n<p>This was just as much to do with automation as it is with experimentation and balancing; it would take too much time to keep tweaking a list of skill values vis a vis a corresponding item for that skill value (eg &#8220;how much disguise bonus do we award a player who wears a hoodie at a given skill level?&#8221;).<\/p>\n<p>Linear interpolation is quick and dirty, but is simply a compromise. I could have compromised and put more code into Unity to interpolate internally, but that&#8217;s just putting more code than required.<\/p>\n<p>So I turned to Calc&#8217;s cell formula functionality. I have no deep understanding of Calc, so I relied on someone else&#8217;s <a href=\"https:\/\/forum.openoffice.org\/en\/forum\/viewtopic.php?f=9&amp;t=75795\">example<\/a> to learn from. Though this was not the first time I brushed with polynormals, coefficients, and plotting curves, I&#8217;m math-stupid, so it takes me some time to figure it out. This kind of math is something that always <em>interested<\/em> me, but interest and talent are two different things. I wish I was smarter in math; it would make my life so much easier.<\/p>\n<p>Anyway, after 2 hours looking into the math, I figured out what the example was getting at. With this technique sorted, it frees me up to implement more lookups that require curve interpolation. It&#8217;s easier to see what&#8217;s going, instead of just looking at numbers. Also, it&#8217;s much easier to tweak the system, to balance the game as I continue to develop.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I had been working in Open Office Calc recently, something I didn&#8217;t expect to do more than just table up some values and do simple additions. In fact, I got a little deeper than I thought I would. Normally, I would weigh up the worth of learning something new with the practicality of getting [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_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":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[377,52],"tags":[389,391,392,390,397,398,388,395,393,394,352,396],"class_list":["post-813","post","type-post","status-publish","format-standard","hentry","category-3400ad","category-game-development","tag-calc","tag-coefficient","tag-curve","tag-formulas","tag-game-balancing","tag-math","tag-open-office","tag-points-on-curve","tag-polynormal","tag-skill","tag-unity","tag-visualisation"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1gtd2-d7","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/posts\/813","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/comments?post=813"}],"version-history":[{"count":3,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/posts\/813\/revisions"}],"predecessor-version":[{"id":817,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/posts\/813\/revisions\/817"}],"wp:attachment":[{"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/media?parent=813"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/categories?post=813"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/faulknermano.com\/blog\/wp-json\/wp\/v2\/tags?post=813"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}