[HELP] Top Down Enemy Behavior

Started by
3 comments, last by scott8 4 days, 3 hours ago

So I am currently making a top-down hack-and-slash game, like a faster-paced version of the Legend of Zelda games. I had been wanting to add something unique to Keys in the game since the whole locked doors system can get a bit stale at times.

I had recalled an enemy from Super Mario 2, a cursed key that when taken will summon an enemy that will pursue the player until the key is used. (Since it was in a 2D platformer the AI wouldn't worry about walls and would behave in a way that would only make sense in 2D platformers.)

I wanted to reference this partially with a key that would summon some sort of enemy that (similar to the one in Mario 2), would pursue the player until using or dropping the key. My game is more futuristic/technology-based, so the enemy couldn't be a phantom that just floats around. How could I make the concept of an enemy like this?

Advertisement

You could say the enemy is made from neutrinos. They can go through any matter without interaction, or something like that.

Or you use something called path finding. : )

Edit: For a floating enemy, traditional A-star path finding in a grid would look too axis aligned, so this would be an application of diffusing energy from the player, and enemies following the gradient.
I've tried this for fun, and the enemies move in natural smooth and curvy paths. Pretty similar to the haunting killer moons of Super Mario:

https://gamedev.net/forums/topic/709827-how-to-prepare-an-influence-map-to-take-the-influence-of-obstacles-into-account/5438468/?page=1

The details of how the enemy “pursues” the player appear to be the main design issue.

In a fantasy game on a tight map (you mention The Legend of Zelda), simple turn based pathfinding towards the player constitutes realistic and possibly clever enemy behaviour, is easy to see and understand, and provides a tactically and strategically interesting inexorable threat.

In a “futuristic/technology-based” setting easier long range travel and communication should be expected: if the player triggers an alarm, the responders are likely to be at the very least off screen and plausibly they are

  • unaware of the exact location of the player character after they leave the place where the key was held (or the key might have a tracer, if it is fun)
  • in need of significant travel (e.g. aliens from a starship on a low planetary orbit, player on the surface)
  • difficult to recognize when they appear: are these armed thugs looking for the key, or after the player character for other reasons, or interested in an impersonal robbery?
  • an organization with a number of agents and teams (e.g. first send a police patrol, then a group of mercenaries, then assassins for special occasions), not one phantom

Omae Wa Mou Shindeiru

For a game with a tech vibe, you could make the enemy some sort of ‘Super AI’. Maybe it's not composed of matter, so it can go through walls. Another option, one that I'm using in a game, is to have an indestructable enemy that goes thru walls by breaking them.

Advertisement