{"id":1009,"date":"2026-02-25T20:18:06","date_gmt":"2026-02-25T20:18:06","guid":{"rendered":"https:\/\/sites.wsagames.com\/yy8y24\/?p=1009"},"modified":"2026-03-07T20:06:01","modified_gmt":"2026-03-07T20:06:01","slug":"npc-patrol-and-tracking-system","status":"publish","type":"post","link":"https:\/\/sites.wsagames.com\/yy8y24\/2026\/02\/25\/npc-patrol-and-tracking-system\/","title":{"rendered":"NPC patrol and tracking system"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>The video shows npc patrol and follow function\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-video alignwide\"><video height=\"1080\" style=\"aspect-ratio: 1920 \/ 1080;\" width=\"1920\" controls src=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/NPC-follow.mp4\"><\/video><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Npc Tracking system\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"612\" data-id=\"1039\" src=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/d603e6874930175c7eb10913c89f832f-1024x612.png\" alt=\"\" class=\"wp-image-1039\" srcset=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/d603e6874930175c7eb10913c89f832f-1024x612.png 1024w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/d603e6874930175c7eb10913c89f832f-300x179.png 300w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/d603e6874930175c7eb10913c89f832f-768x459.png 768w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/d603e6874930175c7eb10913c89f832f-1536x918.png 1536w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/d603e6874930175c7eb10913c89f832f-2048x1224.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Because I choose to use blueprint, so I create Blueprint type first.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Since my group didn&#8217;t have any npc art resources yet, I found a character resource in UE5 to use as a vehicle for this blueprint class.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The character already comes with collision volumes, so I don&#8217;t need to add them.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I keep this npc&#8217;s face always facing the blue arrow that appears on the screen, as this ensures that the npc is facing the player for following.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Create blueprint:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"613\" src=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/e0949daf6ea051cfc8201e894b600e8d-1-1024x613.png\" alt=\"\" class=\"wp-image-1042\" srcset=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/e0949daf6ea051cfc8201e894b600e8d-1-1024x613.png 1024w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/e0949daf6ea051cfc8201e894b600e8d-1-300x179.png 300w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/e0949daf6ea051cfc8201e894b600e8d-1-768x459.png 768w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/e0949daf6ea051cfc8201e894b600e8d-1-1536x919.png 1536w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/e0949daf6ea051cfc8201e894b600e8d-1-2048x1225.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">I create a AI Conttoller. In the blueprint class named aiCharacter, change the AI Controller class to the AI Controller you just created.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add a run behaviour tree to the ai controller&#8217;s event graph. And then I create a ai behaviour tree.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Add ai behaviour tree in run behaviour tree in the ai controller.Make sure they are interconnected.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Create Blackboard:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"612\" src=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/cc9060999c35a81ef3f9c52b9743ecf9-1-1024x612.png\" alt=\"\" class=\"wp-image-1040\" srcset=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/cc9060999c35a81ef3f9c52b9743ecf9-1-1024x612.png 1024w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/cc9060999c35a81ef3f9c52b9743ecf9-1-300x179.png 300w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/cc9060999c35a81ef3f9c52b9743ecf9-1-768x459.png 768w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/cc9060999c35a81ef3f9c52b9743ecf9-1-1536x918.png 1536w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/cc9060999c35a81ef3f9c52b9743ecf9-1-2048x1224.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Add a new decorator to the behaviour tree called Find Player.The blueprint class that looks for players is then tied to the blackboard and the behaviour tree.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The behaviour tree pulls out branches following the flow of npc&#8217;s looking for players.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">NPCs seek out players first, and walk towards them second.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Create Find Player blueprint\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"610\" src=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/ac2f743f4116e91dca04abd3ddea5786-2-1024x610.png\" alt=\"\" class=\"wp-image-1041\" srcset=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/ac2f743f4116e91dca04abd3ddea5786-2-1024x610.png 1024w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/ac2f743f4116e91dca04abd3ddea5786-2-300x179.png 300w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/ac2f743f4116e91dca04abd3ddea5786-2-768x457.png 768w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/ac2f743f4116e91dca04abd3ddea5786-2-1536x915.png 1536w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/ac2f743f4116e91dca04abd3ddea5786-2-2048x1220.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Add a function called Execution Condition Check AI.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The logic of this blueprint is that first you need to get the location of the actor. Then a spherical detection is placed on the actor position, giving the actor a detection range (it will be detected only after it enters the range).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Getting the position of the actor makes the actor&#8217;s position +1 to make sure it doesn&#8217;t start and end in the same position.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can change the default value of an object type after elevating it to a variable.Changing the default to pawn will detect the player. And then add a loop.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Converting Array Elements to Players, afterwards give the blackboard to the player as a character.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Finally you need to add a navigation grid body to the scene, this is the NPC&#8217;s range of action, the NPC will only walk within this range, the player leaves this range and the NPC stops tracking. The NPC will stop tracking when the player leaves this range. And without a navigation grid, the NPC can&#8217;t move.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>NPC patrol system\uff1a<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"611\" src=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-031549-1024x611.png\" alt=\"\" class=\"wp-image-1090\" srcset=\"https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-031549-1024x611.png 1024w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-031549-300x179.png 300w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-031549-768x458.png 768w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-031549-1536x916.png 1536w, https:\/\/sites.wsagames.com\/yy8y24\/wp-content\/uploads\/sites\/65\/2026\/02\/\u5c4f\u5e55\u622a\u56fe-2026-03-03-031549-2048x1221.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">When the behaviour tree is run to this task is triggered to get the position of the NPC&#8217;s character, set to be the character to control. Set a random point location, the NPC moves to this point after randomly finding a point within the activity range I set, and finally tells the behaviour tree that the event is done.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The video shows npc patrol and follow function\uff1a Npc Tracking system\uff1a Because I choose to use blueprint, so I create Blueprint type first. Since my group didn&#8217;t have any npc art resources yet, I found a character resource in UE5 to use as a vehicle for this blueprint class. The character already comes with collision [&hellip;]<\/p>\n","protected":false},"author":56,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[75,1],"tags":[],"class_list":["post-1009","post","type-post","status-publish","format-standard","hentry","category-development","category-year2"],"_links":{"self":[{"href":"https:\/\/sites.wsagames.com\/yy8y24\/wp-json\/wp\/v2\/posts\/1009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.wsagames.com\/yy8y24\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.wsagames.com\/yy8y24\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.wsagames.com\/yy8y24\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.wsagames.com\/yy8y24\/wp-json\/wp\/v2\/comments?post=1009"}],"version-history":[{"count":9,"href":"https:\/\/sites.wsagames.com\/yy8y24\/wp-json\/wp\/v2\/posts\/1009\/revisions"}],"predecessor-version":[{"id":1091,"href":"https:\/\/sites.wsagames.com\/yy8y24\/wp-json\/wp\/v2\/posts\/1009\/revisions\/1091"}],"wp:attachment":[{"href":"https:\/\/sites.wsagames.com\/yy8y24\/wp-json\/wp\/v2\/media?parent=1009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.wsagames.com\/yy8y24\/wp-json\/wp\/v2\/categories?post=1009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.wsagames.com\/yy8y24\/wp-json\/wp\/v2\/tags?post=1009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}