Jump to content

Diablo style melee attacking


Rick
 Share

Recommended Posts

In games like Diablo where you mindlessly just kill things and you don't have a target, what is the best way to implement melee attacking?

 

These games seem to have very fluid systems for melee attacks which aren't very presice in their targeting. Do they use physic bodies around the weapon itself, do they just do a cone in front of the player and just damage everything inside this cone when the player attacks? Just curious if anyone has an idea about how best to get that same smooth attacking style.

Link to comment
Share on other sites

One way to do it is code a physical object using something similar to the bullet code, and set a range to how far it can go before deleting itself.

 

Or. You could use some of the ways you described. You would have to have already made your own hp/damage system regardless, but I am not overly sure.

Win7 64bit, Leadwerks SDK 2.5, Visual Studio 2012, 3DWS, 3ds Max, Photoshop CS5.

 

 

 

Life is too short to remove USB safely.

Link to comment
Share on other sites

I don't know how the games you mentioned do it, but I would first try something simpler than physics.. I think it can be done reasonably well with just two checks (distance & angle):

- if the enemy is inside the melee range of the player ( governed by the players current weapon length or reach )

- and if the player is facing the enemy ( or rather if the enemy is inside the weapons angle of attack )

- dish out damage to all who qualify or only the closest one(s)

 

 

Simple and easy to extend, for example you could specify different angles or field-of-damage for each move so you could have 180° backward axe spins etc, just set the proper ranges for the move/animation and it's done. Maybe even add a "Leap to enemy" special power - easy, just multiply the weapons reach, and move/animate the player towards the enemy..

 

.. maybe this is what you meant with the "just do a cone in front of the player and just damage everything inside" ?

  • Upvote 1
Link to comment
Share on other sites

If i would make such game - i will make physics body with form of punch area, attach it to player controller, make it collide with enemyes with responce "2", and on collide callback get enemy entity, get it user data (GameObject class), and do it player_hit() function.

"Better" is big enemy of "good"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...