Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411511 Posts in 69375 Topics- by 58430 Members - Latest Member: Jesse Webb

April 26, 2024, 01:47:07 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperDesignMaking unique enemies while keeping a similar base design
Pages: [1]
Print
Author Topic: Making unique enemies while keeping a similar base design  (Read 979 times)
Rxanadu
Level 0
*


View Profile
« on: June 30, 2015, 10:30:38 AM »

I'm making an arena-based FPS game in the vein of Ratchet & Clank Arena challenges. At the moment, I have a playable character and a working weapon, but I'm having trouble designing enemies for the player to face. I wanted to make at least 3 different enemy types, but I'm not sure how to design them properly.

Here are the three types:
  • Shooter: moves toward player, attacks player with ranged attack without shooting
  • Flying enemy: flies toward enemy. Can be above the enemy and come down to player's height. Can attack with ranged or melee attack
  • Timebomb: enemy explodes after a set time has passed. Detects the closest player and moves toward them in all instances.

The main issue I have is ensuring the AI structure can be used in multiple situations; I need the code to be portable for other enemies (e.g. defensive enemies, bosses). What do you recommend I do to make each enemy feel unique while also keeping the code and design of each enemy virtually the same?
Logged
DanglinBob
Level 0
***



View Profile
« Reply #1 on: June 30, 2015, 10:50:37 AM »

Well, why not create some modular parts?

At the very least you have

"Mode of Movement"

and "Mode of Attack"

- then just mix and match them so you can randomly get a wide variety.

So you have a basic
"Charge the enemy"

you could also do a "flank the enemy" where the AI simply tries to move around the player until they detect being out of LOS, then charge.

Or a "Stay at range & look for cover"

Or a more complex thing like "Shielded when still & plays a game of Red Light, Green Light"

Then you can add a "movement method" which could include at the very least flying and ground, but also different models of flying. Airplanes can't strafe but helicopters can. Animals like dogs don't strafe either (and rarely back up quickly) whereas other creatures could.


Mode of attack is simple really: Various types of attacks. Melee. Ranged. AOE with charge up. Cone of attack. Self destruct AOE.... and so on.

If you create all these modular components and have the ability to assign attributes to each (or even have the game combine them at random) you'll end up with some interesting stuff Smiley
Logged
The_Saddest_Warus
Level 0
*


View Profile
« Reply #2 on: July 09, 2015, 07:55:43 AM »


Just some ideas!

One thing you could do is play with ranges. If you have a shooter, perhaps you could have different shooters have different weapon ranges/projectile hit boxes?

You could have the flying enemies have unique patterns of flight, or unique dive patterns. You could have some of them drop things on the player, use ranged attacks as they dive, or require melee swoops.

For the time bombs, you could have different explosion sizes, and amounts of health.
Logged
Cunnah
Level 1
*



View Profile
« Reply #3 on: July 10, 2015, 03:16:58 PM »

I am currently working on an RPG that uses a base NPC which without any other input can move towards a target (note the target is not anything in particular just a point to which it paths to).

I then add behaviors as modules and each one is designed so that they can be described in one sentence or one word. For example I have "charge" (run towards the target), "stand ground" (stay put), "Hide" (find a place the target can't see), "run away" (simply go the opposite direction from target (side note this one was oddly the hardest to get right and not have your guys just run into walls!)), etc...

Each NPC has a script (this is in unity) that basically has an array of custom structs which allow me to add conditions for activating each routine. The script goes through the list activating the last one in the list that is satisfied (in other words if it is half way through the list and a condition is met it doesn't stop it keeps going down the list until it finds another or reaches the end, this is to stop contradictions occurring). Whats more is I can attach these scripts to weapon types so a weapon can add its conditions to that of an NPC (generally speaking the NPC overrides the weapons conditions to avoid cowardly goblins suddenly becoming Conan the barbarian because "the weapon told it to!") this means that the AI can properly use a weapon.

The upshot of this setup is I can create seemingly diverse AI from ultimately a short list of instructions. For example;

A defensive monster has as its combat AI. 1st action is if "distance > 2m" "charge", 2nd action if "distance = 2m" "stay put", 3rd if "action = "stay put" "block attacks", 4th action if "distance = 0m" "attack".

each time the ai checks what it is doing it goes through the list in this case the monster when in combat will charge the player until it is close, hold up its shield until the player gets too close and attacks.

Generally speaking I only need to check Distance, Monster health, target health, target weapon (and to be honest I only check if its ranged or not), and the current action. From these variables you can create seemingly complex AI from quite basic building blocks. The script takes each variable in the stuct and if I have entered a value assumes I am checking for that condition.

  
Logged
baconman
Level 10
*****


Design Guru


View Profile WWW
« Reply #4 on: July 15, 2015, 02:18:29 AM »

I'm looking to use 4 main movement patterns, usually in response to weaponry or abilities associated with the enemies. So, starting with the abilities:

-Contact damage
-Slash-and-Dash
-Run-and-Gun

Since contact damage is about colliding with the player, and is the most common and versatile - and simple method. There's a few ways to go about this semi-sensibly:

-Patrolling

Simply go back and forth between a vertical and horizontal range; by going back and forth between a range of movement speeds back and forth. Setting one or the other to 0 will simply result in horizontal/vertical movement, but they can also be toyed with to make figure-eights, rotations, curves and half-curves, or diagonals.

-Low-speed homing

These simply home in on the player slowly, creeping towards them. It is important that if they can outrun the player, they be easy to kill, and if they are not easy to kill, the player can outrun them.

-Set-up and follow-through

In this approach, the enemy tries to position itself where it can charge or pounce the player; and then after a set timer - if it can, it does; otherwise it sets a new timer value.


Slash-and-Dash is a lot more like setup/followthrough, intrinsically; and usually implies some variable defensive ability, and the ability to mix it up. Zelda II "tall" enemies are a perfect example of this approach - they stay just outside of the player's comfortable range, until they're ready to attack, and then they step in and do so. The player has to be gaining ground on them in order to attack them - which makes attacking them equally risky for the player. Vertical inconsistency also adds a layer of advantage/disadvantage to this, if it's something you'd like to play with, as well.

Run-and-Gun is more the patrolling type, typically; but it can also be done with the other methods. The important difference with RnG though, is that typically higher level AI is about *avoiding* the player or their line-of-fire, while being placed in a position where theirs works out better.
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic