{"id":350,"date":"2024-09-01T17:21:49","date_gmt":"2024-09-01T17:21:49","guid":{"rendered":"https:\/\/willkolb.com\/?p=350"},"modified":"2024-09-01T17:22:34","modified_gmt":"2024-09-01T17:22:34","slug":"less-project-more-game","status":"publish","type":"post","link":"https:\/\/willkolb.com\/?p=350","title":{"rendered":"Less Project More Game"},"content":{"rendered":"\n<p>Today I decided I needed to start making this an actual &#8220;game&#8221; rather than just focusing on the asset side of things. To start I made a simple arena:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"952\" height=\"457\" src=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image.png\" alt=\"\" class=\"wp-image-351\" srcset=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image.png 952w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-300x144.png 300w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-768x369.png 768w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-500x240.png 500w\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" \/><\/figure>\n\n\n\n<p>Essentially a bunch of walk-able pathways and two towers in the center. The goal was to essentially stress out the AI by putting a bunch of stuff in the way. This succeeded and I had to re-write a bunch of the AI tasks (luckily not the base ai tree too much). <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"776\" height=\"636\" src=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-1.png\" alt=\"\" class=\"wp-image-352\" srcset=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-1.png 776w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-1-300x246.png 300w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-1-768x629.png 768w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-1-366x300.png 366w\" sizes=\"auto, (max-width: 776px) 100vw, 776px\" \/><\/figure>\n\n\n\n<p>Now the ai flow is:<\/p>\n\n\n\n<p>1.) Check if it needs to reload<br>2.) Start fighting<br>3.) If it has ammo, try to move to a &#8220;strafeTarget&#8221; (i.e. a tactically relevant position) , if it doesn&#8217;t have one or can&#8217;t move to said target just generally move towards the target. <br>4.) Wait a few seconds to let some bulletsfly(firing timing happens in the patrol bot logic, not the ai logic)<br>5.) If you have ammo find a new tactically relevant position to stand in<br><br>In addition I have the AI and the patrol bots doing line traces from either the intended target position to the character to see if it can hit the shots it&#8217;s aiming for, or if it needs to move. <\/p>\n\n\n\n<p>The big struggle today was setting up the AI settings for unreal, which in general are a real pain. I&#8217;m worried I made it basically unplayable on cheaper PC&#8217;s but I&#8217;ll need to get a build together for testers before I start optimizing. The way unreal&#8217;s AI works (and I think uniity is pretty similar) is by setting up a grid of points, then using an &#8220;navigation agent&#8221; to handle how pathfinding works. This navigation agent is a primitive object (I assume a cube but I&#8217;m not 100% sure) that is placed along projected paths to check if it&#8217;s possible to move to the target location. If unreal\/unity Didn&#8217;t have this concept you&#8217;d hit a bunch of issues with the AI trying to navigate it&#8217;s body through a bunch of pinhole sized paths. So to handle cornering a bit better I started messing with the AI agent size: (Nav agent height near the bottom)<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"541\" src=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-2-1024x541.png\" alt=\"\" class=\"wp-image-353\" srcset=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-2-1024x541.png 1024w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-2-300x158.png 300w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-2-768x406.png 768w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-2-500x264.png 500w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-2.png 1484w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>However, I quickly found out that A.) You need to change it int he &#8220;navigation Mesh&#8221; settings:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"218\" src=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-3-1024x218.png\" alt=\"\" class=\"wp-image-354\" srcset=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-3-1024x218.png 1024w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-3-300x64.png 300w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-3-768x163.png 768w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-3-500x106.png 500w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-3.png 1297w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>also, AND that if you don&#8217;t have dynamic re-generation on Unreal just starts saying that the nav mesh needs to be rebuild (and I wasn&#8217;t sure how to do that&#8230;). So I had to check the &#8220;FORCE REBUILD&#8221; guy and set the &#8220;runtime generation&#8221; to dynamic.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"841\" height=\"182\" src=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-4.png\" alt=\"\" class=\"wp-image-355\" srcset=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-4.png 841w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-4-300x65.png 300w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-4-768x166.png 768w, https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/image-4-500x108.png 500w\" sizes=\"auto, (max-width: 841px) 100vw, 841px\" \/><\/figure>\n\n\n\n<p>This biggest hit here will be performance but again I&#8217;d rather rush a build, have it run like crap then optimize as needed.<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"464\" style=\"aspect-ratio: 960 \/ 464;\" width=\"960\" controls muted src=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/20240901-1716-03.5371964.mp4\"><\/video><\/figure>\n\n\n\n<p>The bots are doing most of the main things that I think baseline quality AI does:<br>1.)Don&#8217;t shoot at you if it doesn&#8217;t see you<br>2.)Don&#8217;t get stuck on corners<br>3.)Play an animation when turning<br><br>The three things it still needs:<br>1.) Coordination between bots<br>2.) Less bumping into other bots.<br>3.) Some form of IK<br><br>But In my opinion those things are secondary at the moment. The next thing I want to jump on is a basic health + hud+weapon system so there&#8217;s a &#8220;game&#8221; part of this.<br><br>Also this needs to be fixed, but I&#8217;ll probably write up a whole thing about how Unreal&#8217;s deferred rendering kinda sucks for First person view models (even though the originally &#8220;Unreal&#8221; games were all first person shooters&#8230;.)<br><\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"462\" style=\"aspect-ratio: 818 \/ 462;\" width=\"818\" controls src=\"https:\/\/willkolb.com\/wp-content\/uploads\/2024\/09\/20240901-1721-18.2724706.mp4\"><\/video><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Today I decided I needed to start making this an actual &#8220;game&#8221; rather than just focusing on the asset side of things. To start I made a simple arena: Essentially a bunch of walk-able pathways and two towers in the center. The goal was to essentially stress out the AI by putting a bunch of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,9],"tags":[],"class_list":["post-350","post","type-post","status-publish","format-standard","hentry","category-gamedev","category-unreal"],"_links":{"self":[{"href":"https:\/\/willkolb.com\/index.php?rest_route=\/wp\/v2\/posts\/350","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/willkolb.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/willkolb.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/willkolb.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/willkolb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=350"}],"version-history":[{"count":2,"href":"https:\/\/willkolb.com\/index.php?rest_route=\/wp\/v2\/posts\/350\/revisions"}],"predecessor-version":[{"id":359,"href":"https:\/\/willkolb.com\/index.php?rest_route=\/wp\/v2\/posts\/350\/revisions\/359"}],"wp:attachment":[{"href":"https:\/\/willkolb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=350"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/willkolb.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=350"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/willkolb.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=350"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}