{"id":183,"date":"2012-03-03T12:35:47","date_gmt":"2012-03-03T12:35:47","guid":{"rendered":"http:\/\/www.zombox.net\/?p=183"},"modified":"2012-07-04T21:52:33","modified_gmt":"2012-07-04T21:52:33","slug":"npcs","status":"publish","type":"post","link":"http:\/\/www.zombox.net\/?p=183","title":{"rendered":"NPCs&#8230;."},"content":{"rendered":"<p><iframe loading=\"lazy\" title=\"Zombox Preview 12 - NPCs\" width=\"450\" height=\"253\" src=\"https:\/\/www.youtube.com\/embed\/pEK3FYvL6Kw?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>This week I worked on NPCs (non-playable characters). They are basically the other survivors in the city.<\/p>\n<p>NPC AI is based on zombie AI. It runs in a modular behavioral hierarchy. Right now NPCs can perform many different actions. They can wander, give the player attention, attack the player, attack zombies, flee, talk, etc.<\/p>\n<p>If they&#8217;re near the player, they can shout phrases in small, floating speech bubbles. These phrases can be greetings, cries for help, taunts, etc.<\/p>\n<p>You can initiate a full chat with an NPC, by walking close to it and pressing the chat icon that pops up in the top right of the screen. In these full chats you can respond to what the NPC says and essentially have a little conversation with them. Certain responses you give will trigger a positive reaction in the NPC, other responses will trigger a negative one. You can also ask the NPC to follow you, or trade with you. If you anger the NPC too much while talking to him, he will attack you.<\/p>\n<p>NPCs will also attack you if you purposely attack them, and if nearby NPCs see this altercation, they will gang up attack you as well.<\/p>\n<p>The full NPC chat system is based on a dialog tree editor that I wrote, which uses <a href=\"http:\/\/www.lumonix.net\/helium.html\">Helium<\/a> for its schematic view. Here is a scaled-down image of a complex dialog tree created for generic NPCs found outside of the sewers:<\/p>\n<p><a href=\"http:\/\/www.zombox.net\/stuff\/zombox_51.jpg\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone\" title=\"Dialog tree\" src=\"http:\/\/www.zombox.net\/stuff\/zombox_51sm.jpg\" alt=\"\" width=\"255\" height=\"345\" \/><\/a><\/p>\n<p>The blue boxes are branch nodes that are seed-locked to each NPC, so NPCs will &#8220;respond&#8221; to a player&#8217;s dialog choice predictable at that point in the tree. The rest of the branches are chosen at random to keep conversations unique. Green lines represent conversational choices that trigger a positive reaction in the NPC. Red lines represent negative reactions. If you insult\/threaten an NPC too much during a conversation, he will attack you.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This week I worked on NPCs (non-playable characters). They are basically the other survivors in the city. NPC AI is based on zombie AI. It runs in a modular behavioral hierarchy. Right now NPCs can perform many different actions. They can wander, give the player attention, attack the player, attack zombies, flee, talk, etc. If [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8,3],"tags":[],"_links":{"self":[{"href":"http:\/\/www.zombox.net\/index.php?rest_route=\/wp\/v2\/posts\/183"}],"collection":[{"href":"http:\/\/www.zombox.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.zombox.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.zombox.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.zombox.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=183"}],"version-history":[{"count":7,"href":"http:\/\/www.zombox.net\/index.php?rest_route=\/wp\/v2\/posts\/183\/revisions"}],"predecessor-version":[{"id":240,"href":"http:\/\/www.zombox.net\/index.php?rest_route=\/wp\/v2\/posts\/183\/revisions\/240"}],"wp:attachment":[{"href":"http:\/\/www.zombox.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.zombox.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=183"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.zombox.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}