So I thought I should write a bit more in-depth about features in my game and engine to give you some more content between the demo releases.
The characters, or bodies as they are named in my code have a number of properties that define their health and to emulate functions of the human body. Mostly in terms of emitting blood:
* Heart rate
* Blood pressure
* Amount of blood
* Number and size of wounds
The body as a whole has a blood pressure. This is simply the ratio of blood left in the body out of how much was in it from the beginning. It will be between 0 and 1 and it drops when the bodies bleed. It is combined with the body's heart rate so that the pressure changes in rythm with the beats. But the blood pressure value is not ready to be used at this point. Next it is passed on to the limbs of the body.
Each body has a set of limbs and each of these has an individual constant or modifier for the blood pressure. They are a bit different. For example the head has a much higher pressure than the feet. I'm no expert on these things but it's meant to be an abstraction of the different pressures in veins and arteries inside the body. The body's pressure is modified by this constant to create a local blood pressure for each limb.
Now on to the wounds. The limbs can have wounds (read bullet holes). These emit blood particles at a rate determined by the limb's local pressure. A wound at a limb with high pressure will squirt out the blood, while at lower pressure it will just drip. Remember that the pressure at the body level is based on the amount of blood left in the body. This means that each wound on the body decreases the blood pressure. In effect, this means that a single wound in the head of a body will pump out more forcefully than two wounds, or if there were many other wounds present on the body already. The size of the wounds also have an effect on how the blood will be emitted.
Low pressure due to loss of blood.
A smaller hole makes the emission more focused and the particles leave with a higher velocity. The size of an entry wound is determined by the diameter of the bullet. The size of the exit hole is more complicated and might be an article by itself.
A single emitter from the head with high pressure. The second one also showing pooling on the floor, and towards the end how the pressure is noticeably dropping.
Each emitted particle represents one milliliter of blood as it stands now, for a total of 4000-5000 milliliters (about one gallon) in a body's total capacity. Every particle has it's own velocity and is affected by gravity. When they spawn they also inherit the velocity of the limb they come from. You can see this in the gif above: when the head flips forward it makes a small bounce which is also makes the blood spawned at that time fly higher.
I hope you enjoyed this article. I will try to drop one once in a while when I feel there might be need for a 'filler episode' between my other updates.