Tweaking Durability

J Young Kim

New Member
Contributor
Design
Durability Module (https://github.com/Terasology/Durability)

Purpose: The purpose of this module is to add a durability factor to Terasology items which can experience wear and tear. To be specific, the durability for a tool reduces upon using it to successfully break a block. For instance, a pickaxe, after X number of blocks broken with it, will break and be unusable. The players would like this module because it adds realism to the whole game. In other words, the players would be further engaged in survival because it adds the variable of durability to the tool that's being used. The players would not be able to make a tool and use it forever, the player would need to keep making sure that he or she has enough resources to build more tools if necessary.
Structure:
  • Systems:
    • DurabilityAuthoritySystem: This is the system which is responsible for the entire system of degrading of durability, and even destroying the items if there remains no more durability on the item. There are methods such as destroyItemOnZeroDurability(), which, as the name implies, destroys the item once the item reaches zero durability, and reduceDurability(), which decreases the remaining durability of the tool. Please check https://github.com/Terasology/Durability/blob/master/src/main/java/org/terasology/durability/systems/DurabilityAuthoritySystem.java for the code regarding how the durability system works.
    • DurabilityClientSystem: This system, as the name implies, is designed for the player's user-interface. The methods featured are drawDurabilityBar(), getTerasologyColorForDurability(), and getDurabilityItemTooltip(). As these method names also imply, the system will provide a graphical user-interface of the item's durability. The drawDurabilityBar() displays a bar which represents the remaining durability, getTerasologyColorForDurability() gets the color to be used for the bar, which would represent the state of the item (green is good, red is bad, but it's not black/white, the colors will change gradually), and getDurabilityItemToolTip() would tell the player exactly how many usages the item has when hovering over the item.
  • Events:
    • DurabilityExhaustedEvent: An event which is launched when an item has zero durability left. Used as a parameter in destroyItemOnZeroDurability() and launched by checkIfDurabilityExhausted() in the DurabilityAuthoritySystem.
    • DurabilityReducedEvent: An event which is launched when an item was used/got it's durability lowered. It's launched by reduceDurability() and used as a parameter by checkIfDurabilityExhausted() in the DurabilityAuthoritySystem.
    • ReduceDurabilityEvent: An event which is launched with a parameter (an integer denoting how much durability should be taken away from the tool) when the item needs to have it's remaining durability lowered. It's launched by update() and reduceItemDurabilityOnBlockDestroyed() with a parameter of 1 and is used as a parameter in reduceDurability() in DurabilityAuthoritySystem.
  • Components:
    • RetainDurabilityComponent: The component for retaining the current durability it has. Used in dropBlockWithRetainDurability(), placeBlockWithRetainDurability(), and saveRetainDurability() in DurabilityAuthoritySystem.
    • OverTimeDurabilityReduceComponent: The component for reducing the durability of a tool over time. Used in update() of DurabilityAuthoritySystem.
    • DurabilityComponent: The component for adding the durability feature for items in Terasology. Used extensively throughout DurabilityAuthoritySystem.
Extensibility:
First of all, the module can have some added factors. For instance, mining diamond would require a lot more durability than stone, because diamond is much harder physically than stone. Another instance would be weather, since we can have metal tools 'rust' and lost durability if the player has a metal tool out while in water or in the rain. These are places where the developers can extend this module to add modules which consider block hardness (can use for TNT, where dirt is easier to blow up than stone), or modules that would create 'rust' on metallic objects, such as tools and machines.

The following are some modules which can used the Durability module:

  • CopperAndBronze: The tools created with this module can have increased durability compared to tools created with wood and stone.
  • JoshariasSurvival: As stated earlier, this module can be used to add realism to the survival aspect for the player's experience. In other words, the player will also have to factor in the durability of their tools to make a decision to do something.
  • ManualLabor: As a module providing tools for NPC workers that perform manual labor such as mining, the Durability module can make this module more realistic. Most games have the NPC have infinite durability with the item it is using. The player can have a chest where the NPC worker can pick up a new tool if the tool it is using breaks due to durability. This would also make Terasology more realistic.
  • Minerals and Ore Generation: As stated earlier, the type of block being broken can contribute to the degree of durability reduced (the harder the block, the more durability it takes). These modules would most likely only contribute to the mining aspect of the game. In addition to altering level of durability reduction based on block mined, we can also make it so that the tool has a different starting amount of durability based on the material it's made out of. Wooden pickaxes would be much less durable than diamond pickaxes.
 

Cervator

Org Co-Founder & Project Lead
Contributor
Design
Logistics
SpecOps
Nice write-up! And actually a perfect fit for going into the Module forum instead, since this covers an existing and published module that's available for usage. So I'm moving this thread there and marking it accordingly.

Also, by the properties of "touched it last" you're now its maintainer @J Young Kim - no take backsies! :D (joking, but hoping no joke!)
 
Top