Sign in to follow this  

Diablo type attacks

This topic is 1193 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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'

Edited by ferrous

Share this post


Link to post
Share on other sites

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) ...

Share this post


Link to post
Share on other sites

This topic is 1193 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this