{"id":607,"date":"2025-02-16T16:18:45","date_gmt":"2025-02-16T16:18:45","guid":{"rendered":"https:\/\/hivemind.science\/?p=607"},"modified":"2025-02-16T16:18:45","modified_gmt":"2025-02-16T16:18:45","slug":"hive-mind-progress-update-10","status":"publish","type":"post","link":"https:\/\/hivemind.science\/?p=607","title":{"rendered":"Hive Mind Progress Update #10"},"content":{"rendered":"\n<p class=\"has-medium-font-size wp-block-paragraph\">Over the past two weeks, i have tackled one of the most challenging aspects of the Hive Mind project: <strong>ant navigation through the nest<\/strong>. It was a journey full of problem-solving, adjustments, and learning, but i made some significant progress.<\/p>\n\n\n\n<div style=\"height:34px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">The Challenge: Navigating the Nest<\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">The biggest hurdle was creating a system that allows ants to navigate through the complex structure of the nest, including surface areas, tunnels, and chambers. Due to the small size of the tunnels and chambers, Unreal Engine&#8217;s NavMesh system wasn&#8217;t suitable. This led us to rethink the entire approach and design a more custom solution. <\/p>\n\n\n\n<div style=\"height:32px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">The Solution: Graph-Based Navigation<\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Warning: this gets nerdy. When looking for solutions i got inspired by graph theory. Which to me it makes sense to represent the nest as a graph where:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\"><strong>Nodes<\/strong> represent chambers (including the surface as one large node).<\/li>\n\n\n\n<li class=\"has-medium-font-size\"><strong>Edges<\/strong> represent tunnels connecting the chambers.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">To implement this in code, i have created two key structures:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\"><strong>ChamberNode<\/strong>: Represents each chamber with its ID, location, and colony association.<\/li>\n\n\n\n<li class=\"has-medium-font-size\"><strong>TunnelNode<\/strong>: Represents tunnels with their connecting chambers, entrance and exit trigger locations, and additional metadata.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">This setup allows me to use <strong>Breadth-First Search (BFS)<\/strong> to find the shortest path through the nest from one chamber to another, ensuring ants can efficiently navigate their environment.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Reducible made on YouTube an excellent video on this subject:<br><a href=\"https:\/\/www.youtube.com\/watch?v=PMMc4VsIacU\">https:\/\/www.youtube.com\/watch?v=PMMc4VsIacU<\/a><\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Teleportation Through Tunnels<\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Since NavMesh couldn&#8217;t be used inside the nest, i have implemented a <strong>teleportation system<\/strong>. Ants walk to tunnel entrance triggers, get teleported through the tunnel to the exit trigger, and continue their journey to the next point or their final destination. For now it is instant, in the future i will add a timer that counts for the distance of the tunnel. Also in future we will add more properties to a tunnel like dangerlevel, length, congestion etc. <\/p>\n\n\n\n<div style=\"height:34px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Code Refactor and Improvements<\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">I have moved all route-finding logic to the <strong>TunnelManager<\/strong> for better organization and efficiency. The TunnelManager now:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">Calculates routes using BFS.<\/li>\n\n\n\n<li class=\"has-medium-font-size\">Stores all chambers and tunnels in memory.<\/li>\n\n\n\n<li class=\"has-medium-font-size\">Handles teleportation logic through tunnels.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Additionally, each ant now knows which chamber it is currently in, including when it is outside the nest (treated as a large chamber), making route calculation more seamless.<\/p>\n\n\n\n<div style=\"height:38px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">What&#8217;s Next?<\/h3>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Next, I plan to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-medium-font-size\">Refine our SpawnManager to spawn ants in specific chambers.<\/li>\n\n\n\n<li class=\"has-medium-font-size\">Complete the FollowRoute task to include walking to tunnel entrances, teleporting, and navigating through the nest.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">As the mesh includes the surface, nest chambers and tunnels i expect some problems when ants want to navigate in ant chambers. I believe in those chambers there is no collision detection available and the ant will fall through the mesh once teleported. If so, we will also find a way to deal with that later \ud83d\ude42<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">This sprint taught me lot about graph theory, navigation challenges, and efficient code design. I also faced several obstacles, such as collision issues, NavMesh limitations, and code refactoring needs, but each challenge helped me improve the complete system.<\/p>\n\n\n\n<div style=\"height:35px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">I also plan to make an extra blog post purely on AI, reinforcement learning and how i aim to implement it into this project. I already have decided to use PyTorch as a default instead of Tensorflow. But don&#8217;t worry this project will be framework agnostic. You can even write your own neural networks and connect to the simulation environment and test it. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">Stay tuned for more updates, and check out the recommended <a href=\"https:\/\/www.youtube.com\/watch?v=LFKZLXVO-Dg&amp;list=PLpXOY-RxVRTPPVLBP6-sz6CMWxhtrI-v_\">YouTube videos<\/a> on graph theory and BFS to see the inspiration behind our navigation system! <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over the past two weeks, i have tackled one of the most challenging aspects of the Hive Mind project: ant navigation through the nest. It was a journey full of problem-solving, adjustments, and learning, but i made some significant progress. The Challenge: Navigating the Nest The biggest hurdle was creating a system that allows ants [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-607","post","type-post","status-publish","format-standard","hentry","category-progress-updates"],"_links":{"self":[{"href":"https:\/\/hivemind.science\/index.php?rest_route=\/wp\/v2\/posts\/607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hivemind.science\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hivemind.science\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hivemind.science\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hivemind.science\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=607"}],"version-history":[{"count":1,"href":"https:\/\/hivemind.science\/index.php?rest_route=\/wp\/v2\/posts\/607\/revisions"}],"predecessor-version":[{"id":608,"href":"https:\/\/hivemind.science\/index.php?rest_route=\/wp\/v2\/posts\/607\/revisions\/608"}],"wp:attachment":[{"href":"https:\/\/hivemind.science\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=607"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hivemind.science\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=607"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hivemind.science\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}