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>&nbsp;is fantastic game, I&rsquo;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&rsquo;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&nbsp;<strong>how the NPC is designed</strong>, and how it can be recreated using the&nbsp;<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:&nbsp;<strong>Idle</strong>,&nbsp;<strong>Inspect</strong>,&nbsp;<strong>Attack</strong>,&nbsp;<strong>Knocked</strong>&nbsp;<strong>Down</strong>,&nbsp;<strong>Looking for Weapon</strong>&nbsp;and<strong>&nbsp;Dead</strong>.</p> <p>In this article I will avoid the&nbsp;<strong>Knocked Down</strong>&nbsp;and<strong>&nbsp;Looking for Weapon</strong>&nbsp;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>,&nbsp;<strong>Inspect</strong>,&nbsp;<strong>Attack,</strong>&nbsp;<strong>Dead</strong>&nbsp;), I decided to use a&nbsp;<strong>State Machine</strong>&nbsp;for the NPC, the reason for this its because it has&nbsp;<strong>very little number of states</strong>, and its<strong>&nbsp;easier/faster</strong>&nbsp;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>
Tags: Hotline Miami