TeamPorcupine / ProjectPorcupine

Project Porcupine: A Base-Building Game...in Space!
GNU General Public License v3.0
484 stars 278 forks source link

Body Parts #1528

Open Geoffrotism opened 8 years ago

Geoffrotism commented 8 years ago

Being able to add prosthetics were briefly discussed in #1040. I would like to add body parts as a solution to this as well as being the foundation for other potential features.

The design I had in mind was that every character gets a Race, each Race has multiple body parts determined by reading an Xml file. The reason i think this is appropriate is that, other than mutations, every human has 2 hands, 2 feet, 1 head etc. and each Alien species would have X amount of limbs. My example of the xml is:

image

@dusho made a suggestion that we add "position = left/right/center" attribute that I think would be a nice touch. That way making left and right hands would be super easy. I would add to this by changing "name" to "type" in the Xml and then creating the name at runtime by combining the two strings.

This system would also make Race specific features possible. If you want all characters of Race X to have a bonus to carrying capacity you could add a Strength modifier. Alternatively, let's say that this character then had all of its hands shot off, there could be an easy check on all the limbs with type = hand and check if either the health of that limb = 0 or potentially add a "isBroken" or "IsMissing" property that when change runs an update command that re-evaluates a method in Character that calculates various properties of that character. @MANDAL0R3 as he wanted to help work on this.

dusho commented 8 years ago

yes, I wanted to list every part separately, so e.g. if you have wounded hand, it would limit your ability to carry things. And also if you see info about selected character, you can see list of wounded parts, e.g. Left Hand - broken Here is what I proposed:

<Species name="Human">
    <Body>
        <Part name="Hand" position="Left" health="5">
            <Tag>CanCarry</Tag>
        </Part>
        <Part name="Hand" position="Right" health="5">
            <Tag>CanCarry</Tag>
        </Part>
        <Part name="Leg" position="Left" health="5">
            <Tag>CanWalk</Tag>
        </Part>
        <Part name="Leg" position="Right" health="5">
            <Tag>CanWalk</Tag>
        </Part>
        <Part name="Chest" position="Center" health="20"/>
    </Body>
</Species>
<Species name="Insectoid">
    <Body>
        <Part name="Hand" position="Left" health="5">
            <Tag>CanCarry</Tag>
        </Part>
        <Part name="Hand" position="Right" health="5">
            <Tag>CanCarry</Tag>
        </Part>
        <Part name="Leg" position="Left" health="5">
            <Tag>CanWalk</Tag>
        </Part>
        <Part name="Leg" position="Right" health="5">
            <Tag>CanWalk</Tag>
        </Part>
        <Part name="Leg" position="Left" health="5">
            <Tag>CanWalk</Tag>
        </Part>
        <Part name="Leg" position="Right" health="5">
            <Tag>CanWalk</Tag>
        </Part>
        <Part name="Chest" position="Center" health="20"/>
        <Part name="Tail" position="Rear" health="10">
            <Tag>CanAttack</Tag>
        </Part>
    </Body>
</Species>

I wouldn't put functionality on types of body parts - some aliens may carry stuff on chest, I would use list (set) of tags that are applied for each part. Tags will specify special abilities that body part can have, if severed or wounded, character will loose that ability. Example method int Character.CanCarryAmount() will loop through body parts and return those that have flag CanCarry, will multiply with base amount one can carry and also multiply with strength attribute of character to get maximal amount character can carry,

Hooch0 commented 8 years ago

I'm thinking were going to need something better then position="Center", i'm not to sure how that would work since a leg and arm can be both on the left but have different height values.

dusho commented 8 years ago

the position is more informative than functional.. I don't think there is other use than to show it localized in info panel. If you come up some scenario where we can have use of system where body parts are uniquely placed then yes, we may need more attributes for that.

Hooch0 commented 8 years ago

Well it really depends on how were going to let the player equip items. If theres gear slots like a RPG then we may need more information then that but if not then maybe just displaying a list displaying the names of the body parts that can have equipment.

dusho commented 8 years ago

another way that comes to mind is using some kind of arcAngle, so relative angle to facing of character. So if character is facing north, angle of right hand is 90, left hand is 270: image This can be then used also for calculation on what got injured when shot from various sides and character is facing different directions as well.. E.g. shot came from top (north), character was facing west, meaning that his right arm was in line of fire. But maybe I'm going too far already and someone should stop me...

<Species name="Human">
    <Body>
        <Part name="Hand" arcAngle="90" health="5">
            <Tag>CanCarry</Tag>
        </Part>
        <Part name="Hand" arcAngle="180" health="5">
            <Tag>CanCarry</Tag>
        </Part>
        <Part name="Leg" arcAngle="90" health="5">
            <Tag>CanWalk</Tag>
        </Part>
        <Part name="Leg" arcAngle="180" health="5">
            <Tag>CanWalk</Tag>
        </Part>
        <Part name="Chest" arcAngle="0" health="20"/>
    </Body>
</Species>
Tranberry commented 8 years ago

@koosemose I really want yo to hear your opinions here

ajahraus commented 8 years ago

I'd just like to point out that all body parts should be named in anatomical position.

mikejbrown commented 8 years ago

:+1: anatomical naming: anterior vs posterior (i.e. front vs back), superior vs inferior (i.e. up vs. down), left vs right. For short ANT/POST, SUP/INF, L/R. If we get starfish aliens then you could have 1st, 2nd, 3rd ANT etc. or whatever...