Damage effects

I finally got around to working on some better damage effects.  All I had before was entire characters flashing red when hit.  It was functional but not very fun and didn’t give you any information about where you hit the enemy.

I knew I wanted some very accurate blood spray – it should come from the first spot that your blade intersects the enemy, and spray in the direction of the blade.  The problem is that the sword moves very fast, even with 60fps frames it will tend to skip right through an enemy body.

My first attempt was to use Box2D’s Continuous Collision detection to solve this.  I setup several physics bodies on the character and several on the weapon and told them to listen for contacts with each other.  I never figured out why, but they would not consistently collide, even when enabling CCD.  I have a feeling it’s because one of the sets of bodies were sensors only – which means Box2D only notifies them of contacts but doesn’t actually collide them.

My next try was to use the same simple method I use for sword trails: subdivide the animation as long as the distance between weapon points are too far.  This works great for weapon trails and ensures that they are smooth, no matter what the framerate is, or how fast the weapon is moving.  For hit effects it’s similar, I just have to check whether the weapon is intersecting the enemy body at many times within the last timestep.  I setup a convex hull on each bone of the enemy that can be hit, since that’s a really efficient yet accurate representation for intersecting points.

Collision

Now that I knew where the weapon hits, I needed to make a particle effect to represent the blood spray.  Vanilla red particles don’t really cut it, blood has a very unique look.  I combined a few basic techniques to make it look better – stretching the particles along the direction of movement, and accumulating blood density instead of blood color.  Once I accumulate density it’s just a matter of applying a lookup texture indexed by density that gives the final color of the blood.  These two things are really effective at making a blobby, dynamic fluid effect.

Blood2

Now that I have it working, it’s amazing how much more satisfying basic attacks are, especially with the sound effects.  I’m not completely happy with it though, the effect is not at its potential.  I would like to keep around some parts of the blood that spray on the environment.  I would also like to have some dripping off of your weapon for a while.

Campfires

Campfires are very important in DarkMaus, just like bonfires in Dark Souls.  They let you heal, but also revive any regular enemies in the area.  They are the only place where you can spend your gathered Marrow to level up, and resting at one saves the game.

Campfire

In earlier versions of DarkMaus I used campfires only as regular checkpoints – if you died you would lose any progress after the checkpoint.  After some playtesting I noticed a few things.

People didn’t want to explore anymore because the cost of dying was too high.  In order to retain items you picked up from exploring you had to make it back to a campfire.  if you continued exploring and then died (which happens A LOT) you would lose those items and have to get them again.

Another problem was that the replayability of areas was reduced and there was no more opportunity for grinding for levels if you got stuck on a hard part.  You would kill each enemy once in a successful run and never deal with him again.

The Dark Souls bonfire mechanic solves all of these problems and makes you consider your exploration options in a whole new way, so I borrowed it.  It’s really an amazing gameplay mechanic and I wonder why we don’t see more games innovating in how the saving works.  We generally get automatic checkpoints or save-anytime (aka save crawl in a hard game).

It’s alive!

DarkMaus has been in development for some time and I should have done this forever ago!  I intend to use this blog to show cool stuff about the game and talk about the development.  I always appreciate feedback.