An analysis of the AI in Hotline Miami
<p><a href="https://store.steampowered.com/app/219150/Hotline_Miami/" rel="noopener ugc nofollow" target="_blank">Hotline Miami</a> is fantastic game, I’ve played both and I am still replaying them to date.</p>
<p>The fact is, the core mechanic in the game is the combat against this NPC’s.</p>
<p>While i was playing the 2nd one, I noticed a lot of interesting things about their behaviors, and since I am deeply interested in learning AI I decided to give it a shot.</p>
<p>In this article, I will not go in depth into code, but in <strong>how the NPC is designed</strong>, and how it can be recreated using the <a href="https://unity.com/" rel="noopener ugc nofollow" target="_blank"><strong>Unity Engine</strong></a>.</p>
<p>The first step in my analysis is the NPC states. I noticed 6 of them: <strong>Idle</strong>, <strong>Inspect</strong>, <strong>Attack</strong>, <strong>Knocked</strong> <strong>Down</strong>, <strong>Looking for Weapon</strong> and<strong> Dead</strong>.</p>
<p>In this article I will avoid the <strong>Knocked Down</strong> and<strong> Looking for Weapon</strong> behaviors, I may add them in the future.</p>
<p><img alt="" src="https://miro.medium.com/v2/resize:fit:770/0*VUWOuX_pOFEXresr.png" style="height:175px; width:700px" /></p>
<p>Judging from this 4 states(<strong>Idle</strong>, <strong>Inspect</strong>, <strong>Attack,</strong> <strong>Dead</strong> ), I decided to use a <strong>State Machine</strong> for the NPC, the reason for this its because it has <strong>very little number of states</strong>, and its<strong> easier/faster</strong> to implement and will get the job done.</p>
<p><a href="https://medium.com/@RodFernandez91/an-analysis-of-hotline-miami-ai-23c37dbcb156"><strong>Website</strong></a></p>