Showing posts with label Monster AI. Show all posts
Showing posts with label Monster AI. Show all posts

Sunday, January 10, 2010

The Joys of Emergent Behavior - Monsters that work "well" togeather

So today I had a moment where my own AI monsters did something I thought was "clever". I have two monster AIs hacked out so far, the Sprinter and the Ranged. The Sprinter can "rush" when within two moves of the player. This moves them next to the player and immediately attacks, but then takes an an extra turn before it gets to go again. The ranged can use a sling as a ranged attack, requiring a turn to reload between shots. The only "intelligent" AI is the Ranged. If it figures out there are others monsters nearby the AI, it tries to move away if it's inside the minimum range of their weapon (unless they are at melee, then they swap to melee and attack).

So, I ran into a Ranged in the hallway and chased it down. The hallway opened up into a room, with another Ranged and a Sprinter. The Ranged I has caught up to backed off due to nearby help. I chased it again, and the sprinter rushed me, one Ranged hit me and the other moved back again. As I dealt with the sprinter I took another two sling stones to the face, and then turned on one of the Ranged. As I chased it, the other backed away and kept pelting me as the other ran away. In the end I ran out of health and died.

Now, from the code's point of view nothing special happened. Each actor followed it's simple rules. However, from my point of view the buggers seemed smart for a second. The Sprinter tanked me, while the Ranged moved away and nuked me. I was kited by one of the enemies since I didn't have ranged attack while the other killed me. That sounds like something more out of a WoW boss fight than Magecrawl.

It was an amazing to see simple rules you write turn into something that seems "alive" even just for a moment.

Saturday, January 9, 2010

Monster classes and types - Making the opposition interesting

As I mentioned here, my plan is that every 2 months or so to have a "tech demo" release until I have enough of the game to release something fun and playable. While I have a lot of other nice things in this release, a list of which I'll cover later, one of the major bullet points for this release is better and more varied monsters. The last release just had a single type of identical monsters wander around. Current trunk has something that looks more like:




It's still in work, but the idea I'm most excited about in this area of the game is the differences between "Classes" and "Types". A class of monster is kinda like a base class, it defines behavior and types of abilities it has access to. A type of monster is a specific instance of a type with a given name and stats. Both Orcs and Brigands would be standard monsters, even if their equipment and stats are different.

Here's my current list of ideas (With a typical example):
  • Standard (Orc Warrior) - Average "intelligent" monster, able to use basic ranged attack if it has one as it closes the distance. Might try to escape when in trouble (unsure on that).
  • Healer (Human Healer) - Tries to stick near elite, standard, or ranged monsters (at range of player). Weak on its own, but can buff and heal other monsters.
  • Ranged (Goblin Slinger)- Ranged "blaster", either with traditional weapons or magic.
  • Sprinter (Wolf) - Fast monster that will quickly enter melee range (possibly with rush attack).
  • Swarmer (Giant Ants) - Individually weak monsters that try to stick together and attack en mass.
  • Elite (Dragon) - The big guns of the dungeon. A challenge in themselves. Ignores all other monsters (due to pride?) and charges towards player.
The issue in general is to make the game interestingly difficult without being impossible. I've modified the map generate to be intelligent in how it places monsters, so I could drop "groups" of monsters near each other.  After I write out the basic AI for each type, the trick will be balancing. Any thoughts? Obvious (in terms of other roguelikes) classes of monster that I've forgotten?