Diablo type attacks

Started by
3 comments, last by Xai 9 years, 7 months ago

I'm working on a top down game like Diablo. My question is how are attacks usually done in terms of hitting the enemy. Is it physics based in that if the weapon/sword collides with the enemy it registers a hit? This seems like it could be error prone and cause issues. What are other ideas to register a hit in a game like this where things aren't actually targeted?

Advertisement

Many of the weapons are purely stat based - the attackers accuracy stat and the defender's dodge stat are used to determine whether or not the attack lands, possibly modulated by the distance between them.

Other weapons are of the 'skill shot' variety, where the user actually aims, and the simulation has to determine if they hit. many of these are area-of-affect weapons (such as a cone of fire), so the checks don't necessarily need to be terribly accurate.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

OK, so I could find all enemies within an bounding box in front of the character for melee or where the spell hits and if you are in that box you are registering a hit. That makes sense. Thanks

ones that tend to be 'physically' based, tend to have some sort of collider that emanates out with the animation, usually much larger than the weapon / fist / spell. For a game like Diablo, it could just be, "When attack is initiated determine hit-miss-result based on stats/random results, display results when 'strike' frame is played'

You have probably already realized this, based on the 2 posts and your own, but just in case you didn't:

There are 2 separate ideas at play here:

1. Determining what the targets are.

2. Determining if the targets take damage (or how much).

For most diablo type games, number 1 is based on either a "collision template" or a function that does the same thing ... the goal being to have a quick method to determine what enemy (or set of enemies) is within the potential "hit box" (which can be a cone/sphere or whatever) ... for non-AOE weapons, the "nearest" such enemy is usually selected. For AOE weapons, all such enemies are usually selected ...

And then the logic passes the (hit / potentially hit / targetted) units to the part of the code that computes / applies the damage ... which takes into account things like resistence, etc.

Then the output of this function is used to generate sound/graphic/particle artifacts (so that blocked attacks sound different than crits, etc) ...

This topic is closed to new replies.

Advertisement