The Daily Click ::. Forums ::. Klik Coding Help ::. Beat-em-ep AI
 

Post Reply  Post Oekaki 
 

Posted By Message

Matt Gardner



Registered
  07/10/2002
Points
  14
11th August, 2006 at 15:38:59 -

I'm trying to make a beat-em-up style game in the vien of the old TMNT arcade games.

I've made good progress on the character movement engine, I've even got a rudimentary combo system in place, but I'm going to have to start working on enemy movement soon, and I really don't know where to even start. I was wondering if anyone could give me any pointers or advice on where to start, or point me in the direction of an apropriate article that might help me get started.

 
It's Gravy!

Matt Gardner



Registered
  07/10/2002
Points
  14
11th August, 2006 at 16:45:50 -

After thinking about it a bit, I imagine I'm going to have to program different states for the enemies to be in, one for analizing whether or not there's an openining to attack available and which player to attack, one for moving into position to attack, one for actaully attacking, one for retreat if the situation warrants it etc.

The main one that I'm stuck on conceptually, (I don't even have MMF in front of me right now, I'm at work just pondering this over) is the analyzing. So for instance it's set up so that one enemy can line up on either end of the player to attack, and two more can flank either side to wait for an opening. How would I have the program determine if there're any enemies, and how many, already attacking the character?

Basically, I'm asking how I would go about assigning states to characters (most likely event groups that are inactive/active) and how to have a character check what state other characters are in.

 
It's Gravy!

deadeye



Registered
  22/07/2006
Points
  73
11th August, 2006 at 17:53:53 -

You could use a separate counter labeled "attackInProgress" or something like that, and when an enemy decides to attack, set it to 1. When he's knocked out or retreats, or the player moves out of range or whatever, set it to 0. Have the other enemies check the counter each cycle to see if the player is open for attack. If the counter is set to 1, they wait. If it's 0, they move in.

If you want to get complicated, have two counters, one each for the left and right flank of the player. If an enemy is waiting to attack, he can check both counters, and if one is open he can move into position.

As far as positioning the enemies when they're waiting, you could have a set of invisible targets set up that follow the player's position (say, forming the four courners of a square around him). If the enemy is in "waiting" mode, he can seek out the nearest target and stick to it. That way he'll be in position when a slot opens for attack.

At least, that's how I'd try it. I'm sure there are a hundred different ways.

Image Edited by the Author.

 
n/a

Matt Gardner



Registered
  07/10/2002
Points
  14
11th August, 2006 at 18:22:38 -

That's pretty much what I had in mind. I could have six targets around the character and flags for each one.

I'll probably have to download the Isometric extension and one of the Pathfinding ones...
(my old version of TGF doesn't have any of these newfangled extensions, and I haven't ordered the new MMF yet, I'm just working with the demo at the moment)

Would the Isometric extension help when I want them to be able to move at the X axis at a faster rate than they can move through the Y axis? (which as much as I can figure it kinda fakes into a Z axis...) Or would I be better off keeping the movement customized?

 
It's Gravy!

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
11th August, 2006 at 18:37:26 -

The ISO ext. is for making games in an iso view similar to the Strike Series (Desert Strike, Jungle Strike) or the Final Fantasy Tactics.

I'm not really sure if you could get it to work for a beat em up, but I think that a perspective like that would seriously hamper your game. Either way, good luck on it duder.

 
Craps, I'm an old man!

deadeye



Registered
  22/07/2006
Points
  73
11th August, 2006 at 18:40:42 -

Yeah, isometric would definitely not work for a beat-em up like TMNT. I'm not terribly familiar with TGF, but I know there's a tutorial around somewhere for MMF1.5 that shows how to layer active objects based on thier Y coordinate. That's what you need.

Edit:
What I mean to say is, the tutorial is about showing an object "in front" of another object if it's Y coordinate is higher, and "in back" if it's Y coordinate is lower. I'm pretty sure you can do it easily with layer.cox, but I don't know if there's a TGF version.

Good luck...

Image Edited by the Author.

 
n/a

Matt Gardner



Registered
  07/10/2002
Points
  14
11th August, 2006 at 18:48:21 -

From what I udnerstand there's a rather simple Layer extension for MMF that'd take care of that part easilly so I'm not too concerned with that.

I'm more concerned about the enemies moving around at a different rate on the X and Y axis, I could program this easilly, but I'm not sure how I'd do this and implement some sort of pathfinding so they don't walk through each other.

And how would I have a monster check whether there is a target location without a flipped flag? Is there a command or function for this? I'm not familiar with how to achieve this.



Image Edited by the Author.

 
It's Gravy!

Knudde (Shab)

Administrator
Crazy?

Registered
  31/01/2003
Points
  5125

Has Donated, Thank You!Clickzine StaffKlikCast StarVIP MemberGhostbuster!Dos Rules!I donated an open source project
11th August, 2006 at 18:58:27 -

Well, there is a ghetto way to do it.

Have the AI shoot a bigish detector and set any flag of the enemy to on.

Flag(x) of Enemy = on AND Detector is overlapping Enemy AND Detector is overlapping Player AND Player Flag is Off(the flag for determining if person can be hit or not).

The above event is a bit wierd, and it does kind of exploit some bugs in CT products, but it works even in a huge group of enemies.

I'm not the greatest at explaining things, so let me know if you're confused.

 
Craps, I'm an old man!

deadeye



Registered
  22/07/2006
Points
  73
11th August, 2006 at 19:19:11 -

You'd keep the enemies from walking through each other the same way you'd keep them from walking through walls, I guess. Make a collision box for them. Only, instead of around the entire enemy, just put it around thier feet, like this:

http://img108.imageshack.us/img108/3179/collisionvw2.jpg

That way, Johan Von Kakhipants won't bump into Pimpy McPurplepants, or whatever other pallette-swapped characters you might have.

Like Fred Redtrousers, maybe. Or Billy O'Greenjeans. Who knows. Just so long as it's the same character with a different colored outfit, you're fine. It's the mark of a truly authentic beat-em up.

 
n/a

Matt Gardner



Registered
  07/10/2002
Points
  14
11th August, 2006 at 19:33:23 -

Hah, I LOVE the feather. I'm sure the feet marker can help, but what I'm unsure about is how to make them actually try to walk around the other character instead of just stopping.

Perhaps I could have another mode for the AI where they step back and move to the side and then try again.

 
It's Gravy!

deadeye



Registered
  22/07/2006
Points
  73
11th August, 2006 at 20:12:54 -

I think you're overthinking this "pathfinding" issue. I don't think it's as hard as you're thinking it's going to be.

Let's say enemy A is directly behind enemy B, and enemy B is attacking the player from the right, then enemy A will be looking for a waiting target. Let's say he picks the top right target. He tries to move left and up. So first he tries to move left, and is blocked by B. Then he moves up. Then he tries to move left, and is blocked by B again. Then he moves up. Now he tries to move left and, whaddaya know, he's not blocked any more, so he moves left. Then he moves up. Now he's even with the target, so he moves left but not up. Pretty simple, really. Requires no pathfinding, and you don't have to stop him. Just restrict his movements.

Just about every beat-em up game I've ever played behaves pretty much like that. Except for special enemies that just plow through everything, that is.

 
n/a

Nova Soft



Registered
  16/10/2005
Points
  427
11th August, 2006 at 20:20:18 -

Image

 
By a route obscure and lonely,
Haunted by ill angels only,
Where an Eidolon, named night,
On a black throne reigns upright,
I have reached these lands but newly
From an ultimate dim Thule
From a wild clime that lieth, sublime,
Out of space
Out of time.

Matt Gardner



Registered
  07/10/2002
Points
  14
12th August, 2006 at 00:29:16 -

Boy, I haven't even gotten to making them move and I've already got a problem.

I'm having one object act as a sensor for the enemies, and there's another object on top of it which is the visible graphic, but doesn't actually interact with anything.

The problem is that any time I need to change the animation for the graphic (for instance when the enemy gets hit) the graphic changes for every single instance of the enemy if there are more than one on the screen.

Any suggetions on how to handle this?

 
It's Gravy!

Nova Soft



Registered
  16/10/2005
Points
  427
12th August, 2006 at 01:05:14 -

Image

 
By a route obscure and lonely,
Haunted by ill angels only,
Where an Eidolon, named night,
On a black throne reigns upright,
I have reached these lands but newly
From an ultimate dim Thule
From a wild clime that lieth, sublime,
Out of space
Out of time.

Nova Soft



Registered
  16/10/2005
Points
  427
12th August, 2006 at 01:19:18 -

Image

 
By a route obscure and lonely,
Haunted by ill angels only,
Where an Eidolon, named night,
On a black throne reigns upright,
I have reached these lands but newly
From an ultimate dim Thule
From a wild clime that lieth, sublime,
Out of space
Out of time.
   

Post Reply



 



Advertisement

Worth A Click