Closed stilnat closed 1 year ago
To have some degree of accuracy, we need to have a rough idea about quantitative measures in the body, here's some useful data for our system.
At rest a human consumes about 250 ml of oxygen each minute, 4.16 mL per second, so approximately 4.16/22.4 = 0.18 mmol per second (22.4 is the molar volume of oxygen under 1 atm and 25 degree celsius). https://www.britannica.com/science/human-respiratory-system/Interplay-of-respiration-circulation-and-metabolism
Average volume of a human body : 65 L https://bionumbers.hms.harvard.edu/bionumber.aspx?s=n&v=3&id=109718
One milliliter of body then consume 0.18/65/1000 = approximately 2.77*10^-6 millimoles per second. We'll call that MilliMolesOfOxygenPerMillilitersOfBody.
This data is useful as it gives us some rough rough idea about things such as the volume of blood in a given body part, if we make the simple approximation that blood quantity is homogeneous in the body (obviously untrue, but good enough for SS3D).
Volume of intestines : https://bionumbers.hms.harvard.edu/bionumber.aspx?s=n&v=2&id=111759
Volume of Heart, lungs and liver : https://bionumbers.hms.harvard.edu/files/Mass%20and%20volume%20of%20the%20organs%20of%20the%20human%20body.pdf
Volume of stomach : https://en.wikipedia.org/wiki/Stomach
Using those sources, we can approximate the volume for each body part :
For the torso and its organs :
For the limbs :
For the head and its organs :
The maximum volume of oxygen which the blood can carry when fully saturated is termed the oxygen carrying capacity, which, with a normal haemoglobin concentration, is approximately 20 mL oxygen per 100 mL blood.
https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4666443/
A human contains around 5 liters of blood, so if a human has an approximate volume of 65L, we have a ratio of approximately 0.077, blood on total volume. Applying this ratio to individual body parts we can deduce their blood volume (always assuming that blood is spreaded homogeneously in the body). Let's call this Blood volume for a body part $BV(B)$, then
$$ BV(B) = 0.077 \times \text{Vol(B)} $$
In SS3D, we make the following approximation. Blood and oxygen are two different substances, so on the 5 liters of blood, and using the number above ("approximately 20 mL oxygen per 100 mL blood."), we want under normal conditions that a human carry 4 liters of blood and 1 liter of oxygen.
Under normal atmos pressure, one mole of oxygen occupies 22.4 L (or a molar volume of 22.4 milliliters/moles). For blood, it's indeed more complex and we'll have to invent one, around 0.05 milliliters per millimoles (roughly two and a half times more than water). We then have for blood, in a healthy human, around 4000/0.05 = 80000 mmols of blood.
For oxygen, we'll have 1000/22.4 = 44 mmols of oxygen.
A body part might, or might not, need oxygen. At the basis, it's the layers composing it that needs oxygen. Oxygen needed for a given layer should be implemented through an interface, but generally, the formula will be very simple, let's call L a single layer and O() the function for the needed oxygen. O(L) is expressed in millimoles, Vol(L) in milliliters and MilliMolesOfOxygenPerMillilitersOfBody is the constant above (unit in the name). The volume of a layer is currently simply the volume of its body part.
$$ O(L) = \text{MilliMolesOfOxygenPerMillilitersOfBody} \times \text{Vol(L)}$$
Now for each layers present in the body part, we just compute the average of their need in oxygen to get the need of the bodypart itself.
The circulatory layer contains the oxygen reserve.
The amount of oxygen a single body part can hold will rely on its volume and on a factor that user can pass in parameter.
$$ R_o(B) = \text{MilliMolesOfOxygenPerMillilitersOfBody} \times \text{Vol(B)} \times \text{ReserveFactor}$$
The reserve factor is here to allow the user to set different amount of oxygen reserves for body parts, thus making some dying faster than others.
We can use the blood to body volume ratio (around 0.077) defined above to compute the average amount of blood in a given body part. Let's call the blood volume of the body part B, $BV(B)$, then :
$$ BV(B) = \text{Vol(B)} \times 0.077$$
The substance container should then have a maximum volume capacity roughly equal to the sum of individual body parts blood volume. let's call this substance container volume $Vol(S_c)$, then
$$ Vol(S_c) = \sum BV(B)$$
This quantity will change if the player lost a limb, or any other parts. It is important because it can help to define the right amount of blood the player needs to have in its circulatory system, and it's drastically different if it's a whole healthy human or just a living head.
The maximum volume of oxygen in the body is proportionnate to the volume of blood, it can never get more than 20% of the (oxygen + blood) volume.
With this quantity in the system, and with an average of 0.18 mmol consumed each seconds, it'll take about 244 seconds (4 minutes) for anything to start taking any OXY damages. It should be noted that this is assuming the player is completely resting. In the future, physical effort could drastically change the oxygen need (in reality, up to 10 folds for a regular person), meaning that it would be a matter of a few dozens of seconds before taking OXY damages.
Make sure all this gets into the gitbook docs at some point.
Will do, if the PR is accepted.
Second iteration : Bloody mate
Add blood container
This is a substance container containing mostly blood, but also oxygen and various substances present in the body.
Heart
Circulatory Layer
Lungs
Damages