{"id":26,"date":"2024-03-09T07:50:31","date_gmt":"2024-03-09T07:50:31","guid":{"rendered":"https:\/\/blogs.oregonstate.edu\/arzumana\/?p=26"},"modified":"2024-03-09T07:50:31","modified_gmt":"2024-03-09T07:50:31","slug":"6-challenge-of-optimization","status":"publish","type":"post","link":"https:\/\/blogs.oregonstate.edu\/arzumana\/2024\/03\/09\/6-challenge-of-optimization\/","title":{"rendered":"#6 &#8211; Challenge of Optimization"},"content":{"rendered":"\n<p>Once our team hit the development stage and started implementing our plan, one issue quickly reared its head &#8211; performance. Our evolution simulation simulates thousands of species living, reproducing, and dying &#8211; which means thousands of objects needing thousands of calculations every tick. In our first implementation, we quickly found out that our original model didn&#8217;t work. Well, it did, but for all of 30 seconds before my computer froze and the Unity Editor crashed.<\/p>\n\n\n\n<p>It was something we hadn&#8217;t really planned for, but we had to deal with regardless. If we can&#8217;t run the simulation, we can&#8217;t test out mechanics in the simulation. So we had to get to fixing. I took the lead on this, and researched ways to analyze performance in Unity. Fortunately, it wasn&#8217;t difficult &#8211; the Unity Editor has a built-in Profiler that tallies function calls and reports their relative percentages. It helped me track down the most demanding functions &#8211; creation of new genomes, and a constant UI refresh. I fixed the UI performance hit on my end, and relayed the genome issue to the teammate in charge. Problem solved!<\/p>\n\n\n\n<p>&#8230;Not so fast. After applying the fixes, our simulation ran for about 10 seconds longer, before it started to chug again. Another look at the profiler revealed new issues &#8211; a naming function, UI updates for thousands of entities, and more. We had to fix those as well. And more. And more. In the end, we had to spend a good chunk of our time for 3 weeks optimizing before the performance became serviceable, and we are under no illusion that that&#8217;s the end of the story. The experience  gave me some perspective into why it often takes so long for video games to get optimized &#8211; it&#8217;s a hard task, and there&#8217;s no way around it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Once our team hit the development stage and started implementing our plan, one issue quickly reared its head &#8211; performance. Our evolution simulation simulates thousands of species living, reproducing, and dying &#8211; which means thousands of objects needing thousands of calculations every tick. In our first implementation, we quickly found out that our original model [&hellip;]<\/p>\n","protected":false},"author":13896,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-26","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/posts\/26","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/users\/13896"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/comments?post=26"}],"version-history":[{"count":1,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/posts\/26\/revisions"}],"predecessor-version":[{"id":27,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/posts\/26\/revisions\/27"}],"wp:attachment":[{"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/media?parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/categories?post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.oregonstate.edu\/arzumana\/wp-json\/wp\/v2\/tags?post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}