You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reimplement health and death. This feature existed before #307 but was lost in the rewrite. You can refer to the old directory for how it was previously implemented.
In short, we want:
A Health component containing an entity's health and its max health, with methods to deal damage and regenerate.
A system that queries for all entities with Health components and removes the entities if health == 0. For players, we instead want to respawn them, which is trickier. It involves sending the ChangeGameState packet and waiting for the client to send ClientStatus. The hard part here is that the player should not be visible to the game while they are in the respawn menu. I'm not sure what the best way to implement this is.
To test health, implement fall damage. This entails a system that checks the Position and OnGround components each tick and computes how far an entity has fallen.
I'm probably not experienced enough to actually do it, but I'll take a stab at it. Why does the UpdateHealth packet send the client info about food saturation if stuff like that is handled server-side, at least from my understanding? Also, you said there should be a method to deal damage and regenerate, but would it make more sense to have a set_health() function that is used by a system that updates health? Also, after how many ticks will 1 HP regenerate, and how is that related to food/food saturation? Is there a singular regeneration rate or can they vary?
Sorry I sound very noobish!
Edit:
Okay, I got an answer to the latter half of my question, here and here respectively. Should the Health component also contain hunger/saturation and regeneration, or should they be separate (Health, Hunger, and then Saturation, Regeneration as status effects)?
Why does the UpdateHealth packet send the client info about food saturation if stuff like that is handled server-side, at least from my understanding?
I believe is used on the client to display the vibrating hunger bites when the player is losing saturation. If we don't have food implemented yet, we can just use a default value for hunger/saturation.
you said there should be a method to deal damage and regenerate, but would it make more sense to have a set_health() function that is used by a system that updates health
There will be many systems that deal damage—combat, fall damage, etc. We want to encapsulate the damage calculation, e.g. to ensure we don't get integer underflow.
Should the Health component also contain hunger/saturation and regeneration, or should they be separate (Health, Hunger, and Saturation, Regeneration as status effects)?
Hunger should probably be separate from health, though we don't have to separate saturation from hunger, since they're intertwined. So we can go with Health and Hunger components, the latter of which contains both hunger and saturation.
if a Living Entity is initialized with a given amount of health that health isn't just going to disappear on its own, something has to damage it, why loop through every Living Entity every tick and check it's health instead of just check if the health is <= 0.0f immediately after it's damaged by a damage source?
Small update: I have been very busy and will likely be busy for a while as I'm now in my senior year of high school, and because of other projects that have caught my attention. I still intend to fulfill my obligation to this issue, but it may take a few months to get around to it. If anyone else is interested, please feel free to tackle this issue. Though my previous PR was closed, it was quite close to completion.
I plan to split up this PR into two separate PRs for the sake of time:
Implementing the components, their methods, and exposing them to systems.
Implementing the functionality required to communicate between the server and other clients about the health of entities in the world. This was where I was at with Health System #394. It's complicated as it needs to touch quite a few aspects of the API.
Activity
kirawi commentedon Mar 4, 2021
I'm probably not experienced enough to actually do it, but I'll take a stab at it. Why does the UpdateHealth packet send the client info about food saturation if stuff like that is handled server-side, at least from my understanding? Also, you said there should be a method to deal damage and regenerate, but would it make more sense to have a
set_health()function that is used by a system that updates health? Also, after how many ticks will 1 HP regenerate, and how is that related to food/food saturation? Is there a singular regeneration rate or can they vary?Sorry I sound very noobish!
Edit:
Okay, I got an answer to the latter half of my question, here and here respectively. Should the
Healthcomponent also contain hunger/saturation and regeneration, or should they be separate (Health,Hunger, and thenSaturation,Regenerationas status effects)?caelunshun commentedon Mar 4, 2021
I believe is used on the client to display the vibrating hunger bites when the player is losing saturation. If we don't have food implemented yet, we can just use a default value for hunger/saturation.
There will be many systems that deal damage—combat, fall damage, etc. We want to encapsulate the damage calculation, e.g. to ensure we don't get integer underflow.
Hunger should probably be separate from health, though we don't have to separate saturation from hunger, since they're intertwined. So we can go with
HealthandHungercomponents, the latter of which contains both hunger and saturation.No worries, these are all good questions!
z-targz commentedon Mar 27, 2021
if a Living Entity is initialized with a given amount of health that health isn't just going to disappear on its own, something has to damage it, why loop through every Living Entity every tick and check it's health instead of just check if the health is <= 0.0f immediately after it's damaged by a damage source?
Schuwi commentedon Mar 27, 2021
Short answer: Because feather uses a data-oriented architecture with its ECS and not an object-oriented architecture like vanilla minecraft
kirawi commentedon Jul 13, 2021
Small update: I have been very busy and will likely be busy for a while as I'm now in my senior year of high school, and because of other projects that have caught my attention. I still intend to fulfill my obligation to this issue, but it may take a few months to get around to it. If anyone else is interested, please feel free to tackle this issue. Though my previous PR was closed, it was quite close to completion.
I plan to split up this PR into two separate PRs for the sake of time:
TypicalDarkness commentedon Aug 5, 2021
How would one infer the death cause in that case?