måndag 12 november 2012

Hotline Miami AI

I feel like writing a little bit about the AI in Hotline Miami as I've noticed from reviews and comments that it's not entirely clear how it is supposed to work.

There is basically one enemy behavior in the game, but there are several different variations. It's easy to confuse these as most enemies have the same look. The main enemy (white suit, blue shirt) is actually used as essentially five different enemies, and given certain conditions he can switch between different AI behavior.


Behavior no 1 / Random

This AI makes the enemy walk around totally at random, these enemies are always armed with guns and are hard to predict as they may end up moving between rooms. Any enemy you knock over will switch to this AI when he gets up unless he finds a melee weapon.

Behavior no 2 & 3 / Patroling

This behavior is used in both a melee and a gun wielding enemy, they will turn left when a wall or some other solid object blocks their path. The only difference between the one using guns and the one that has a melee weapon is the way they attack you given the range of their weapons. Knocking out an enemy will give him this behavior if he finds a melee weapon to pick up.

Behavior no 4 & 5 / Stationary

This AI is in guard mode, and will not respond to gunfire, it only reacts to visual contact with the player. If enemy with this AI is equipped with a gun he will try to shoot you on sight, if you retreat he will chase you and then return to his post if he can't find you. The melee version will chase the player instead of shooting him.


Another issue that might be confusing with the AI is how the gun toting enemies will react to seeing you. At some times it might seem they immediately turn around and shoot at you, and in other instances they will need to turn around slowly before they start to shoot. This is intentional and depends on how far away from the enemies you are when you approach them. If the enemy is at a fair distance from the player he will immediately jump around and kill you, this is meant to communicate that it's more risky to approach an enemy this way and should be avoided. The results would essentially have been the same if he had turned around more slowly, but would make it seem like a more plausible way to tackle the situation. Enemies will take about a second to get their guns pointed in your direction if you are closer to them when they first see you, which gives you a better opportunity to kill them regardless of your weapon of choice.

All of this could have been made more clear by giving different AIs different graphical appearances, but that would complicate the way we let enemies be able to pick up weapons on the fly and handle situations in a more interesting and complex way.

One of the things that makes the game fun to play is that we put so much effort into making essentially one basic enemy that is fun to engage for the duration of the whole game without making it feel way too repetitive. And I think this is largely to be attributed to the design decisions we made when designing the AI.


Another issue that has been brought up and criticized by many are the boss fights. The general consensus seem to be that they break the flow of the game and feel out of place. This is also intentional. While we didn't necessarily want people to hate these parts of the game, they are meant as a break from the regular enemies that make up the majority of the gameplay challenge. If the game kept doing the same thing over and over without any dips in fun and flow, then the peaks where you get to the meat of the game would be reduced and start feeling repetitive instead. It's a bit of a trade off but they serve a purpose to the story and makes it fun to get back to the regular gameplay afterwards.

If we make a sequel we will definitely try to experiment with potential boss fights and make them more polished and fun, but it's a hard thing to accomplish in a game like this where you can't simply let your imagination run wild to create engaging scenarios as it is equally (or more) important not to have them clash with the style and tone of the game. I would be very interested in hearing suggestions for different approaches we could have used to tackle this problem, as there are very few good examples out there that we can look at for inspiration (toned down boss fights in top down shooters is something I'm very unfamiliar with).


And I think most people will be glad to hear that we have no plans of ever adding a pure stealth level to any of our games in the future.

12 kommentarer:

  1. Trauma is probably my favorite level, I don't know why so many people dislike it

    SvaraRadera
  2. I must be the only person who didn't hate the stealth level. The checkpoints were generous and the whole thing was pretty easy once to realize that you are supposed to be going fast and shadowing enemies instead of hiding and waiting.

    SvaraRadera
  3. Count me among the people who liked Trauma.

    SvaraRadera
  4. Thinking a little bit why people didn't like the stealth level:
    1 - other levels are very flexible and allow different gameplans, Trauma has a very fixed path
    2 - if you mess up your gameplan in other levels you can still finish them with skill,luck or creativity, in Trauma if you mess up is an instant fail
    3 - in other levels you just click "r"(reload) when you fail, very fast paced, in Trauma you have to skip through some additinal dialogue every time you fail (obs: maybe the devs could make "r" instantly skip the dialogue and restart in a future update?)
    4 - you learn some skills and techniques in previous levels and can't use any of them in Trauma
    5 - the headache thing is interesting, but also does slows down the gameplay (obs:personally, I like it)
    6 - and the obvious things: no masks, no weapons, no kills, etc...

    SvaraRadera
  5. I dunno, I loved the Prank Caller boss fight, it always feels so tense no matter how many times I play it... Though I must say it's bullshit how fast he moves after picking up his knife if it doesn't get stuck in the wall

    SvaraRadera
  6. I enjoyed each boss fight immensely and naturally, I died numerous times. The battles are difficult, but they are fair; they do not insult the player by forcing them to wade through a sea of enemies just to reach the boss and fail all over again. The bosses are instantly replayed. I think there is a sense of satisfaction to be found in surmounting the bosses and as their name implies, they are supposed to be hard.
    In short, I would be disappointed to find future enemies less challenging to appeal to very impatient people. Perhaps their frustration could be lessened by adding boss related save points (such as the game auto saving after you defeat the eye patch assassin in Showdown).

    I outright disagree with the argument that Hotline Miami bosses disrupt the "flow" of the game. I don't think that is what is happening here. Adding an unexpected element to a level does not constitute as subtracting from its atmosphere. It's a change of rhythm, but the overfall flow is consistent stylistically and gameplay wise. I welcomed these surprises, Hotline Miami has too many interesting aspects to its world and storytelling to deteriorate into an overly predictable arcade-like pattern.

    There is another detail concerning enemy behaviour that I had seen noted frequently by new players: their absence of clear response to seeing fresh blood splatters and the corpses of their friends. I think it would be cool to implement some sort of reactionary behaviour, but nothing on the scale of a stealth game where a corpse changes the status of a living enemy entirely. Perhaps the AI becomes prone to pacing or behaving in a slightly jittery manner, something like that.

    Anyway, incredible game.

    SvaraRadera
  7. The best bosses were the ones that more closely fit in with the rest of the game - you could tell because their behavior could be re-used. The first boss was an intro to the 'big guy' enemy type, and the Biker also made a good PC. In the future, a good test for a fun boss would be if it could be used again in future levels. Slight differences in behavior and resistances is more fun than the typical multiple-stage scripted boss. For example: a boss wearing body armor that makes him immune to bullets. A stalker that tries to ambush the player. A coward that runs away if he sees you. The skills you learn killing a boss should be applicable to more than just that one instance.

    SvaraRadera
  8. Kudos to the white suits! There was enough variation in their weapons to give some leeway in the attacks, and enough in their behavior that it made it difficult to pin them down. Hallway and doorway ambushes work most of the time, but sometimes the guy gets out of the way at the last second, sometimes an enemy hears your gunshots from the next room, and the plan you had laid out takes a sudden change. Not every time, but often enough that the game always keeps you on your toes. Throw in the dogs, the melee-immune enemies, and the large variety of weapons, and there is more than enough going on to keep the player on their toes, be it the 1st playthrough or the 100th!

    As for the bosses, I think it is a difficult thing to balance. You have a couple of choices, like either teaching the player a skill, and presenting the boss as a final "test" of that skill, or making each boss fight unique, and making the player learn the skills for that bossfight. You went with the second route, and since we have instant R to Restart!, it is not much to get killed, then get back in and try something else right away. The problem is that once you learn the boss fight, there is no more trick to it.

    Fights like the producer, the car, the Mafia Boss, those were fine, on subsequent playthroughs it was just a matter of trying to kill them faster. The fight with Biker, though, ended up being so random (will he charge me and kill me as I go for the bag this time?) and so long (wait two swings, hit, wait two swings, hit...) each time that after the first, it just felt like it slowed things down.

    I think for future bosses, it would be good to follow the pattern of fights like like the car or the Mafia Boss, where learning the rules of the fight is key. Another tactic you can take is, look at all the combat mechanics you have (quiet guns, melee, loud guns, thrown weapons, doors, takedown attacks), look at the enemy mechanics you have (stationary, melee, patrolling, random) and look at bosses that need the player to manipulate those behaviours, or bosses that require combinations of each to win. Another thing to do might be to look at the display; what if there was a level where you couldn't see into the next room until you opened the door? A level where you *could* try to fight your through barehanded, but the proper way would be to sneak past the enemies until you can get your hands on a weapon and then turn around and kill them with it (basically the tramua level, with attacks).

    On of the reasons I really like the car fight is because while the molotov cocktails are supposed to be lethal to you, there are also a great help, because they are lethal to regular enemies as well. If you kill the first pair of goons and then stand in front of the car door, the molotov guy will burn the floor, and every goon who steps out afterward will catch on fire. Having more situations like this where you can "trap" the enemies, or even including weapons that allow for traps like that, will also open it up for more enemies to use traps against the player.

    This has gone on a bit long so let me just close by saying, thank you for such a wonderful game! Played 20 hours so far, and still I want more!

    SvaraRadera
  9. I really liked the inclusion of the stealth level and boss fights (especially the final guy and his team; those panthers reminded me of the excellent game Amorphous+) and how they affected the flow/rhythm of the story. The fight against the biker wasn't as much fun as the rest of the game, though.

    SvaraRadera
  10. I enjoyed the boss fights a lot, but Trauma was a little annoying. I felt it was still necessary tho.

    SvaraRadera
  11. I just like to say that Hotline Miami's AI is in absolutely perfect shape and there's really no need to make adjustments for the sequel...my heart races every time i think about a Hotline Miami sequel. OH, I have a question! is it Hotline: Miami? or Hotline Miami? what i meant is, is the sequel gonna be like, Hotline California or Hotline Detroit? just wondering! You guys keep up the good work, and I hope we hear of the sequel soonish!

    SvaraRadera