GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Health and Death · Issue #358 · feather-rs/feather

Health and Death #358

New issue
Copy link
New issue
Copy link
Open
Open
Health and Death#358
Copy link
Labels
help wantedExtra attention is neededExtra attention is needed

Description

@caelunshun
caelunshun
opened on Mar 2, 2021
Issue body actions

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.

Activity

  1. caelunshun
    added
    help wantedExtra attention is neededExtra attention is needed
    on Mar 2, 2021
  2. kirawi commented on Mar 4, 2021

    @kirawi
    kirawi
    on Mar 4, 2021
    Contributor
    More actions

    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)?

  3. caelunshun commented on Mar 4, 2021

    @caelunshun
    caelunshun
    on Mar 4, 2021
    MemberAuthor
    More actions

    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.

    Sorry I sound very noobish!

    No worries, these are all good questions!

    Reacted by Kirawi
  4. z-targz commented on Mar 27, 2021

    @z-targz
    z-targz
    on Mar 27, 2021
    More actions

    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?

    Reacted by TypicalDarkness
  5. Schuwi commented on Mar 27, 2021

    @Schuwi
    Schuwi
    on Mar 27, 2021
    Member
    More actions

    Short answer: Because feather uses a data-oriented architecture with its ECS and not an object-oriented architecture like vanilla minecraft

  6. kirawi commented on Jul 13, 2021

    @kirawi
    kirawi
    on Jul 13, 2021
    Contributor
    More actions

    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.
  7. TypicalDarkness commented on Aug 5, 2021

    @TypicalDarkness
    TypicalDarkness
    on Aug 5, 2021
    More actions

    Short answer: Because feather uses a data-oriented architecture with its ECS and not an object-oriented architecture like vanilla minecraft

    How would one infer the death cause in that case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.