[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-154937-105":59,"doc-detail-154937-en":130},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","university-of-aberdeen-ai-for-games-practical-2-simple-decision-making","University of Aberdeen AI for Games - Practical 2 - Simple Decision Making","","Practical 2 guides learners in implementing core game AI behaviors for an ogre in a dungeon setting. It starts with a simple decision tree where the ogre consistently attempts to kill the hero upon sight. It then designs a state machine for weapon constraints, including movement, longbow range, energy consumption, and energy regeneration. Finally, it extends the behavior to multiple simultaneous ogres so allies can independently keep firing longbows while the hero enters sword range of one.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/university-of-aberdeen-ai-for-games-practical-2-simple-decision-making/154937/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/university-of-aberdeen-ai-for-games-practical-2-simple-decision-making/154937.png","ImageObject",300,407,{"name":92,"@type":93},"Riley West","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-10-08","2026-08-28",true,{"@type":102,"interactionType":103,"userInteractionCount":39},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"What is implemented in Part 1 using a simple decision tree?","Question",{"text":112,"@type":113},"The practical implements a decision tree where, when an ogre sees the hero, it always tries to kill the hero by triggering the correct behavior in the Behaviour class.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"How do the sword and longbow constraints affect the ogre state machine?",{"text":117,"@type":113},"A sword requires the attacker to be next to the attackee, while a longbow can be used from up to 10 units away. Longbow attacks consume energy, and energy regenerates over time when the creature does not move.",{"name":119,"@type":110,"acceptedAnswer":120},"What changes are required in Part 3 for multiple ogres?",{"text":121,"@type":113},"The behavior class must handle several ogres so that even if the hero reaches sword range of one ogre, the others continue firing longbows as long as they have sufficient energy.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},154937,1787901821,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":39,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":14,"language":139,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":67,"update_tm":129,"read_time":24},1099523885074,"https://ap-avatar.wpscdn.com/davatar_9964176cb1d06d4a9deccf72a44ae3dc","University of Aberdeen AI for Games  \nPractical 2: Simple Decision Making  \n1 Set-up  \nGo back to the 􀀌rst practical if you have not done this already. Get the dungeon software working. Download p2.xml from the course webpage.  \n2 Part 1: Simple decision tree  \nLets assume that when an ogre sees the hero, it always tries to kill the hero. Implement this as a simple decision tree.  \nProgram the above in a Behaviour class, and try it out with the game in p2.xml. Note that you will need to move the hero when you play the game. Feel free to make the decision tree more complex if you wish.  \n3 Part 2: Simple state machines  \nThere are two kinds of weapons in p2.xml, a sword (which both the hero and the ogre have) and a longbow (which just the ogre has) . A sword can only be used if the attacker is next to the attackee, but a bow can be used from up to 10 units away. In the dungeon game, attacking with a longbow uses up energy (not arrows, these never run out), and energy regenerates over time if the creature does not move. Hence one attack strategy for the ogre is to move towards the hero until he is in longbow range, use the longbow until the ogre is out of energy,  \nretreat, wait until enough energy has accumulated for another longbow attack, and then repeat this process.  \nProgram this using a state machine with the following states  \n􀀏 REST: in this state, the ogre does nothing unless the hero comes within the range of its weapons, in which case it attacks.  \n􀀏 ATTACK: in this state, the ogre moves towards the hero until it is in longbow range, then it attacks with its longbow.  \n􀀏 RETREAT: in this state, the ogre moves away from the hero towards a resting spot, which (to keep things simple) can just be the centre of the room.  \nAssume transitions are as follows:  \n􀀏 REST 􀀀! ATTACK: when hero in room, have su􀀎cient energy for longbow  \n􀀏 ATTACK 􀀀! RETREAT: when insu􀀎cient energy for more longbow attacks  \n􀀏 RETREAT 􀀀! REST: when ogre has reached resting spot  \n􀀏 ATTACK 􀀀! REST: when hero leaves room.  \n4 Part 3: Multiple ogres (challenging)  \nModify the behaviour class so that it works if there are several ogres in the room; in this case even if the hero moves into sword range of one ogre, the other ogres should continue 􀀌ring their bows at the hero as long as they have su􀀎cient energy.","cbCaiiERoK6U9HOz","https://ap.wps.com/l/cbCaiiERoK6U9HOz","pdf",79248,"English","# 1 Set-up\n# 2 Part 1: Simple decision tree\n# 3 Part 2: Simple state machines\n# 4 Part 3: Multiple ogres (challenging)","[{\"question\":\"What is implemented in Part 1 using a simple decision tree?\",\"answer\":\"The practical implements a decision tree where, when an ogre sees the hero, it always tries to kill the hero by triggering the correct behavior in the Behaviour class.\"},{\"question\":\"How do the sword and longbow constraints affect the ogre state machine?\",\"answer\":\"A sword requires the attacker to be next to the attackee, while a longbow can be used from up to 10 units away. Longbow attacks consume energy, and energy regenerates over time when the creature does not move.\"},{\"question\":\"What changes are required in Part 3 for multiple ogres?\",\"answer\":\"The behavior class must handle several ogres so that even if the hero reaches sword range of one ogre, the others continue firing longbows as long as they have sufficient energy.\"}]","University of Aberdeen AI for Games - Practical 2 - Simple Decision Making | PDF"]