Jump to content
  • Advertisement

Recommended Posts

I was wondering how combat is done in games like Shadow of War, Zelda: Breath of the Wild, Witcher 3 or any other rpg? Because i can't really think of any other way then to do it with animations. I am fairly new to gameplay programming and programming in general with no Work experience yet. Just curious how its done in AAA games or even any other way people do it. Hope this is the right Forum to ask this in.

Thanks for any replies!

Share this post


Link to post
Share on other sites
Advertisement

"how combat is done" is a very broad question. Is there anything specific you want to know?

Usually RPG combat follows these rough lines:

  1. Player clicks or presses something to initiate an attack.
  2. The attack starts playing an animation.
  3. The hit is detected via one of the following methods:
    1. a hitbox on the character or weapon contacts the enemy due to the animation moving it
    2. a specific frame in the animation is reached, which signifies the 'hit' time
    3. a certain period of time has elapsed, again indicating it's time to register a hit
  4. The system decides whether the hit deals damage or not, and how much
  5. The effects of the hit and damage are applied to the target, e.g. ragdoll physics

You can choose which of the different hit detection methods to use based on the trade-offs you want to make. If you use hitboxes then you have to be sure your animations are correct and that the hitboxes are adequately sized to make contact during a fight. (This is harder than you might think, especially when trying to get a 1st person viewpoint to work well.) If you use timers, then you have to be sure that your animations match them closely otherwise things will look inconsistent. And a specific frame in the animation is a compromise method.

Share this post


Link to post
Share on other sites

I've once used a kind of mix of 3.1 and 3.2 in that all animation frames where damage may be applied provide sweeps of weapon movement, e.g. the plane (actually a short triangle fan) where the blade of a sword is moved along during a swing, or a segmented line from stabbing with a spear . This volume is then collision tested against simplified hit volumes of the possible targets. This means that the animation itself explicitly defines when and where damage may happen.

Share this post


Link to post
Share on other sites
13 hours ago, Erik Nivala said:

My bad, i mostly wanted to know how the hit detection is done.

Thanks for your reply.

 

Look up bounding box collision detection. They are not limited to boxes, some use spheres, some use even finer detection with octrees. Typically the more accurate the collision, the more expensive is the calculation. Once two geometries are "colliding", then different animations and events can be triggered.

Share this post


Link to post
Share on other sites

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!