• Register
Post news RSS Kyn News and Combat FX overview

This week we hit a big milestone! We now have a demo of Kyn that we will use for feedback and testing and soon we will make it available to the press! I also wrote a short article about Combat FX.

Posted by on

Combat FX Overview

Last week we wrapped up a demo of the game. This was a big milestone in the development of Kyn. The demo will be made available to the press soon and we also want to use it to get feedback on Kyn. So shoot us an e-mail at vlegerstee@tangrin.com if you would like to play an alpha demo of Kyn. Today I want to talk a bit about ways to make combat more impactful. There are many little tricks we use in Kyn to make the combat feel more responsive to the player. I will give some short implementation notes that might be useful if you just started developing a combat system, or if you are generally interested in how video games work.

*I had to take out a paragraph about sound FX, because I have no idea how to add mp3s to indie DB, but if someone can explain it I will update the post.

Blinking

Blinking the target on impact gives is a quick visual cue that you actually hit it.

Blinking

Technically this effect is easy to pull off. In Kyn the character shader is switched to a different shader at the moment of impact. This shader mixes in a flashcolor with the monster's diffuse texture. A script handles the flash color transparency. Basically it is a countdown that slowly turns off the flash. Once the flash is fully done we switch the material back to its original shader. In the shader the following line mixes the flash color with the diffuse color:

Albedo = Color.rgb * FlashColor.a + FlashColor.rgb * (1 -FlashColor.a);

And in a script we use the following line to fade out the flash color over time:

flashColor.a = CurrentHurtTime / TotalHurtTime;

materials.SetColor("FlashColor", flashColor);

Numbers

Numbers are an often used indicator of combat impact. In Kyn we kept the number implementation pretty small and minimal because we feel a lot of big flashy numbers can block vision. We use an internal buffer to keep track of the running damage numbers. It is very similar to how you would implement a particle system, for each number we keep a world position, scale, velocity and they are also influenced by gravity. Then during the update cycles we adjust the position, color and scale based on the velocity and gravity. Kyn uses 3 colors, white for damage to your own warriors. Red is for damage to enemies and green for healing. Of course you can take this much further like show bigger numbers when you do a lot of damage, have critical damage numbers. It depends a bit on the game how far you want to take it.

Numbers

Particles and Gibs

For damage impacts we often use particle systems with animated sprite sheets. This works especially well for blood splats, but also for impacts like fire spells. Gibs, or giblets are another fun visual. We usually use gibs when something fleshy explodes or to throw around bones when one of the skeletons is hit. In our implementation we use a small library of different parts that can be spawned. Each object has a minimum and maximum scale and a minimum and maximum force that is applied. Each gib is a physical object, so it will bounce and roll once it is spawned.

DeathFX1
splash

Death Material switches

For some monsters we swap the material on death, for example to show blood on the body, or to fade away the monster.

DissolveDissolve2

A dissolve shader gradually fades away parts of an object over time. The shader works by raising the transparency threshold over time, each pixel that is below the transparency threshold will be fully transparent. The alpha channel of the monster is multiplied with a noisemap. The noise map is used to let certain parts of the object fade earlier than others. The image below demonstrates the technique.

Decals

Decals are images that are placed in the environment to add detail and variation. In combat we use decals mainly for blood splats and explosion effects. Implementations of decals vary and are beyond the scope of this article, but there are two implementations that I can recommend:

Blog.wolfire.com

The article by wolfire shows the usual way of creating decals. Another option is to not calculate the specific decal meshes and do the entire thing in screen space:

Slideshare.net

One subtle addition that really helps push the decals is using animated sprites as the decal image. This way when something takes a hit you can smear out the blood in a certain direction. In Kyn we have a set of different blood smear patterns that we select from based on the direction of impact. So when you hit an enemy with an axe in your right hand the blood pattern will spread differently from when you would hit the enemy with an arrow. We also take the impact direction into account when placing the splat and the size of the splat is dependent on the scale of the monster.

Decals blood

Animation

Each time a character takes damage there is a chance it gets hurt. When a character is hurt it plays a hurt animation and it becomes incapacitated for a short time. The chance of a character being hurt increases relatively to the characters current health. If a character has a lot of health and the hit is only a fraction of it, then the chance of getting hurt is small. The weaker the character the higher the chance of it becoming hurt.

Hurt serves both a gameplay and a visual purpose. A hurt character will be stopped in its track. This buys the player time to reposition or evaluate. It is also serves a visual purpose, because it gives impact to the combat.

When a character dies we generally use between 2 and 4 different death animations. More is better in this case, because if there are 10 similar characters you don’t want them all to fall down in the same pose. Death animations are also a chance to add some detail to the characters background or culture. For example, some trolls will perform seppuku like moves when they are about to die to deny their enemy the kill.

Gibs

Artificial Intelligence

Cowardice
Artificial Intelligence can also be a powerful tool to give impact to your combat. In Kyn each character has morale and a measurement of cowardice. They will start to panic if you unleash a very powerful attack, if their friends die, or if they are outnumbered. On the other hand if they receive some healing from allies, or get reinforcements their morale will grow again and they will regroup. Small additions like this make the combat more dynamic.

Critically Hurt
Every time a character takes damage the game does a critically hurt roll. There are various responses a character will have to a successful roll depending on the intelligence of the character. When critically hurt it might try to crawl away, grab a hurt limb, become confused, or beg for their lives.

Conclusion

I hope this overview gives some insight. In the future I would also like to experiment a bit with ragdolls and leaving behind blood trails. The next post will be about AI formations. I am planning to have that up next week.

Comments
TKAzA
TKAzA - - 3,154 comments

Lovely update, tracking.

Reply Good karma Bad karma+2 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.