Lets get 'em!

Published July 22, 2008
Advertisement
So, work on the enemy AI has begun:


I wanted to start off simple, with two AI states to test out the state machine. The AI was supposed to:

1. Find a random trash can in the stage and pick it up.
2. Take the trash can, line up with the player, and throw it at him.

The first attempt did not go so well. They all picked up trash cans, eventually, but some of them walked in place after grabbing it, some of them just threw it randomly, and some of them appeared to be having a seizure by moving back and forth rapidly. So, I redid step 2 so they would simply throw the trash can once they picked it up.

This worked better, but there were still numerous problems, like some enemies following others, some walking in place, and some trying to walk off the map. Then I realized the obvious, the enemies were trying to pick up a random trash can in the stage, even ones that were already held or off the map. I knew this because I was actually able to play fetch with one of the enemies by tossing the trash can back and forth, and he would always follow it.

Although I was enjoying playing fetch with them, I decided to fix the AI so they would only go for trash cans that were on the floor and still on the map. With this fixed, I watched as they found each trash can in the stage, picked it up, and threw it right off the stage, with the exception of one. Then something interesting happened. Two enemies, perfectly lined up, began to toss the remaining trash can back and forth to each other, like a bizarre game of catch. Before I could take a screenshot, the third enemy intercepted the trash can and chucked it off the stage.

Finally, I fixed step 2 so they would actually throw the trash cans at the player, and it works. Next up, I have to get the AI working for actual close-up fighting. For this, I'll add a "Fight" and "Retreat" AI state for this purpose(and probably also a "Charge" state for running attacks).

I was thinking of how I would handle the retreating aspect of the AI, and I actually looked to Warhammer 40k for inspiration. In that game, if a unit is in melee combat, and they lose a turn, they have to take a morale check to determine if they continue fighting or flee. I'll have a similar concept in this, as if an enemy is knocked to the ground, they'll take a "morale check" to determine if they continue fighting. I mentioned in the last entry that the AI would have traits, and I figure that they'll have a "bravery" trait which will determine how they pass a morale check.

Hmmm, that was a long entry. I'll try and replace the excessive text with excessive screenshots in later entries[grin]
Previous Entry Update?!
Next Entry Vista?!
0 likes 5 comments

Comments

rip-off
Quote:
Although I was enjoying playing fetch with them, I decided to fix the AI so they would only go for trash cans that were on the floor and still on the map. With this fixed, I watched as they found each trash can in the stage, picked it up, and threw it right off the stage, with the exception of one. Then something interesting happened. Two enemies, perfectly lined up, began to toss the remaining trash can back and forth to each other, like a bizarre game of catch. Before I could take a screenshot, the third enemy intercepted the trash can and chucked it off the stage.


Its this kind of odd behaviour that I love to find in my games. It can be particularly hilarious sometimes when it is a bug. For example, one of the earliest games a friend of mine and I made had a wonderful bug caused by a copy and paste error: gravity in both the X and Y dimensions [smile]
July 22, 2008 12:17 PM
sanch3x
A friend and I were working on Narcoleptic Soccer Rush for a game competition on Tigsource (the name was generated by a video game name generator)... Suffice to say that one of our bugs was in our narcolepsy algo and once I tried to run it all the players fell asleep on the field at the same time. It was funny [smile]

Back on topic... I love the bravery idea. It reminds me of an "ego" stat a friend was talking to me about. Basically a NPC wouldn't want to gang up on the player if his ego was big enough to make him think that he was all that. So yeah, having them cower from the player would be pretty awesome.

Well I'm glad to see the game moving forward.
July 22, 2008 01:57 PM
Stompy9999
Quote:Its this kind of odd behaviour that I love to find in my games. It can be particularly hilarious sometimes when it is a bug. For example, one of the earliest games a friend of mine and I made had a wonderful bug caused by a copy and paste error: gravity in both the X and Y dimensions


At first I was dissapointed that the AI wasn't working, but then I started having fun making the AI characters chase after the trash can, then picking it up and throwing it before they could get it. I just wish I had taken a screenshot.

Quote:Original post by Gazillion
A friend and I were working on Narcoleptic Soccer Rush for a game competition on Tigsource (the name was generated by a video game name generator)... Suffice to say that one of our bugs was in our narcolepsy algo and once I tried to run it all the players fell asleep on the field at the same time. It was funny [smile]

Back on topic... I love the bravery idea. It reminds me of an "ego" stat a friend was talking to me about. Basically a NPC wouldn't want to gang up on the player if his ego was big enough to make him think that he was all that. So yeah, having them cower from the player would be pretty awesome.

Well I'm glad to see the game moving forward.


I like that ego idea, I can picture having one of the enemies sitting back while his buddies are beat up just so he can fight the player by himself. Of course, then there are the bosses who will push the others out of the way just to fight the player on their own.
July 22, 2008 04:35 PM
HandCraftedRadio
Looks awesome Stompy, I love beat'em ups! AI was one of the hardest parts when I was working on mine, I never really got it working exactly how I wanted to. If you are still looking for a way to make it so all the badguys don't overwhelm you, you can make it so a couple badguys go in and fight you and the rest could stand around and cheer their friends on.

Having different traits like courage sounds cool, but it is going to be difficult to implement so the player knows what is going on and it doesn't just look like the AI is doing something goofy. If you want them to get scared and run you might want to change their facial expressions or think of some other way of letting the player know its not a glitch when they run off screen.

Again, it's looking really cool so far, keep up the good work! Also, make sure you add in a 2 player mode, it makes beat'em ups so much more fun!
July 22, 2008 08:56 PM
Stompy9999
Thanks!

Although, I have alot of ideas about what will go on with the AI, I don't know if it's going to look natural in the game. I agree I'll probably have to change their facial expressions when they flee, but I was also thinking of having comic book style word bubbles with the enemies saying stuff like "He's too strong!" or "We can't win!" when the player is doing really well.

And yes, I'll definitly make sure to have a two player mode. I always loved playing Streets of Rage and Golden Axe co-op with my brother, so I also want that in this game.
July 22, 2008 11:58 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement