{"id":7430,"date":"2018-10-28T21:14:41","date_gmt":"2018-10-28T21:14:41","guid":{"rendered":"http:\/\/phoenixgamedevelopment.com\/blog\/?p=7430"},"modified":"2018-10-28T21:14:41","modified_gmt":"2018-10-28T21:14:41","slug":"p0-a2-part-461-ai-overhaul","status":"publish","type":"post","link":"https:\/\/phoenixgamedevelopment.com\/blog\/p0-a2-part-461-ai-overhaul\/","title":{"rendered":"P0-A2: Part 461: AI Overhaul"},"content":{"rendered":"<p>The AI overhaul is still going well. <\/p>\n<p>I have come up with a new way of implementing the game logic for the actions.<\/p>\n<p>I was using a system which used a large number of global variables and nested if statements, etc, as well as checking of variables during the update loop.<\/p>\n<p>I am now using a &#8220;flag&#8221; based system, where a common flag is used to determine the internal state of each action. I am also using a coroutine, which only runs once a second, instead of the update loop. The code now does the same thing, but is far more efficient and easier to read and extend in the future.<\/p>\n<p><a href=\"https:\/\/imgur.com\/bcmF1aV\"><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/bcmF1aVm.png\" title=\"source: imgur.com\" \/><\/a><br \/>\n<a href=\"https:\/\/imgur.com\/YgNKkeT\"><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/YgNKkeTm.png\" title=\"source: imgur.com\" \/><\/a><br \/>\n<a href=\"https:\/\/imgur.com\/XIF3dnl\"><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/XIF3dnlm.png\" title=\"source: imgur.com\" \/><\/a><br \/>\n<a href=\"https:\/\/imgur.com\/2idDy0a\"><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/2idDy0am.png\" title=\"source: imgur.com\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The AI overhaul is still going well. I have come up with a new way of implementing the game logic for the actions. I was using a system which used a large number of global variables and nested if statements, etc, as well as checking of variables during the update loop. I am now using [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,17,10,11],"tags":[],"class_list":["post-7430","post","type-post","status-publish","format-standard","hentry","category-astral-realms","category-p-0","category-software-and-games","category-spiritus-astrum","has-post-title","has-post-date","has-post-category","has-post-tag","has-post-comment","has-post-author",""],"aioseo_notices":[],"builder_content":"","_links":{"self":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/7430"}],"collection":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/comments?post=7430"}],"version-history":[{"count":2,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/7430\/revisions"}],"predecessor-version":[{"id":7432,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/posts\/7430\/revisions\/7432"}],"wp:attachment":[{"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/media?parent=7430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/categories?post=7430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/phoenixgamedevelopment.com\/blog\/wp-json\/wp\/v2\/tags?post=7430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}