I don't really know where else to put this.
Basically I'd like to make a combat simulator which is similar to the one I so admire in Dwarf Fortress. The end goal is to create a multiplayer text-based/ASCII fighting game (like street fighter or soul caliber but..text). This isn't for any commercial purpose, just as a learning project.
What I'm primarily interested in is the way the body systems/parts are implemented in DF. As well as combat physics (which I assume determine things like accuracy and "damage"). I'm obviously not asking for any actual code (I don't even know C++ that well; I'll be using python) but just ideas for how to implement these things (even just speculation on how they are implemented in DF would help).
For some more details on the game:
Its basically like DF arena mode. Small room. Two players. Turn-based. Each player has some amount of time to think (i.e timer) and make a move (similar to the Shift+A menu in DF adventure mode). I want DF level detail but only with regards to combat. Ideally game addresses three things:
1. Realism - The combat should be simulation-first
2. Variability - Many different types of strategies should be viable, with many different choices (otherwise there's really no point to the game
)
3. Environment - You should be able to use your environment (high ground, footing, jumping off stuff, hanging from stuff, throwing sand/dirt in someone's face, etc.)
Here's what I know so far:
1. Body Systems
It looks like all the major body systems are simulated except for excretory and digestive (which makes sense for the purposes of combat). The latter is partly implemented since you can get nauseous with blows to the stomach and even vomit if the nausea is great enough.
The nervous system determines "life" and "death" (i.e damage to the brain), but also controls motor movement and sensory perception (sight, smell, hearing and touch, though the latter seems cosmetic). There seem to be "nerves" to each body part, which, if damaged, render that body part useless. I don't actually know how they work though, whether each body part is localized with its own set of nerves or if the nerves are actually part of the whole nervous system, or both. The nerves, I would also assume control pain, but usually the pain comes from the breaking of bones. Perhaps the sensory nerves are supposed to control this? Along with pain there is also the "stunned" status which seems to lower speed. I am unsure if that has to do with nervous system though.
The skeletal system provides support for the body. Breaking a leg usually results in the opponent falling down and unable to stand. Similarly breaking an arm or a hand or even a finger, will result in the opponent dropping his weapon. Also there is the well known intense pain associated with bone breaking leading to unconsciousness, though I am unsure whether this is intentional or just a bug. It seems like all the major bones are simulated but none are done so by name (e.g femur, ulna, etc. its for the best probably). This leads me to believe the bodies in game are made up of parts rather than being a cohesive whole (i.e the same parts which show up in the target selection menu) and that each part has bones, nerves, muscles, etc. Again, I'm not sure.
The respiratory/circulatory system consists of the heart and lungs and of veins and arteries. Like the skeletal system the blood vessels are not named. Damage to the blood vessels result in bleeding. Excessive bleeding I assume leads to shock/fainting, then death (which itself is caused by lack of oxygen via blood to the brain) though I'm not sure how this is implemented in the game. I don't know how time really works either (discussed below), but usually a severed limb results in "heavy bleeding" but does not often lead quickly to death. Damage to the heart or lungs is a "mortal wound" which does lead to death, albeit not an immediate one.
The muscular system doesn't really seem to do anything except act as a kind of armor to the more deeper and important tissue (nervous, skeletal and circulatory). I think it may also control stamina, though I'm not sure. As far as I know, repeatedly damaging muscle tissue doesn't really do much of anything. However if you damage it enough I do know you can pulp that particular body part. I could be wrong though, there might be other effects.
2. Combat Physics
In order to begin considering this we have to first look how time is implemented.
a. Time
Time seems to be divided into discrete units. I think these units are constant. I don't actually know how they are determined however. I do know the "," key moves time forward 1 tick and the "." moves it forward more than 1 (10?) tick.
All creatures have a speed. I don't actually know how this speed is calculated, but it seems to be a ratio. A speed of 1.0 therefore represents the "standard" and everything else is just a proportion to this standard. I suspect the standards may be different species to species and even character to character (high agility might influence this). There also seems to be a different speed for combat actions which I believe is more heavily influenced by the agility stat (and maybe the kinesthetic sense stat). I have no idea how this is calculated. But it is a certainty that there are several variables involved and that different characters have different combat speed. The speed, I think determines how much you can do in a time unit. I suspect actions are described in terms of a number of time units, though I can only speculate as to how the actions are executed (e.g are simultaneous blows possible?)
b. Physics
Now Toady is a mathematician by profession so I assume the physics system is quite complex. However I think for the purposes of combat, Newtonian mechanics are what is used. If that's true we can boil the combat down to two things: force and area. I wonder if the different "types" of damage (blunt, cutting etc.) are implemented specifically or if they are just the consequence of the calculations the game makes (e.g whether cutting damage is just force in a narrow band or piercing damage just force at a small point etc.) I suspect the former, but I'm not sure.
According to the wiki, weapon forces are influenced by a number of factors, including the size of the weapon, the material and the shape as well as the strength of the user. I don't know the specific formulas used, but I assume something close to reality is used as much as possible.
c. Damage
I'm curious to know how force translates to damage to the body systems. I assume there are some threshold values, if the force is greater than those thresholds than some effect happens. However, if we consider armor, enemies can sometimes penetrate the armor, therefore there is also some element of randomness.
Any help in clearing some of this up would be appreciated. Thanks.