Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: add component and ui element docs #102

Merged
merged 6 commits into from
Jun 30, 2023
Merged

doc: add component and ui element docs #102

merged 6 commits into from
Jun 30, 2023

Conversation

jdrueckert
Copy link
Member

@jdrueckert jdrueckert commented Apr 22, 2023

Player Docs - UI elements and game mechanics

  • Health HUD
  • Damage Overlay
  • Directional Damage Overlay

Modder Docs - concepts & public API

  • Health
  • Damage
  • Regeneration
  • Restoration

Developer Docs - architecture & API

  • API (master) Reference
  • Snapshot API (develop) Reference

@jdrueckert jdrueckert added Type: Improvement Request for or addition/enhancement of a feature Category: Doc Requests, Issues and Changes targeting javadoc and module documentation labels Apr 22, 2023
@jdrueckert jdrueckert requested a review from skaldarnar April 22, 2023 22:23
@jdrueckert jdrueckert changed the title doc: add component docs doc: add component and ui element docs Apr 22, 2023
@jdrueckert jdrueckert marked this pull request as draft April 23, 2023 09:17
@jdrueckert
Copy link
Member Author

jdrueckert commented Apr 23, 2023

Had some more discussion with @skaldarnar on module doc structure today, so I'll add some more changes before setting this back to "Ready for review".
Gist:

  • player documentation on UI elements, effects and mechanisms introduced by activating this module
  • modder documentation on public API (which events are processed and sent by module systems, which components can be used by module-external systems) based on common use cases
  • developer documentation on module architecture + link to javadoc

@jdrueckert jdrueckert marked this pull request as ready for review April 24, 2023 20:29
skaldarnar
skaldarnar previously approved these changes Apr 25, 2023
Copy link
Contributor

@skaldarnar skaldarnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few smaller remarks and minor notes, but overall looks good and improves the documentation! 👍

Comment on lines +4 to +5
Self-inflicted causes include, for instance, falling, drowning, or poison damage.
Damage inflicted by a third party typically involves some form of hitting the affected entity.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this separation 🤔 I wouldn't have thought of "poison damage" as self-inflicted, for example.

Why do we think this distinction is important?

Ideally, the instigator (I guess this is what this is technically about) could carry information about the body of water the player drowned in, the exact poison or disease they are infected with, etc. The instigator might not be another player or NPC, but it could be any entity in the game.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do vaguely recall this from the past - poison is "internal" damage in a sense, unlike third party direct damage. Probably "self-inflicted" is a poor term for that. It would be nice if an internal damage effect had an original trigger source that could be referenced as well.

Player X died from poisoning, after getting too close to a Thornwood Cactus!

That might be a bit of a lofty goal for this point in time tho :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we think this distinction is important?

This distinction is important because the directional damage indicator depends on having a direction to indicate. If we as the player are drowning in water, suffocating due to gas, or dying to poison in our system, there is no specific direction for the damage indicator to indicate as the "instigator" is in ourselves (poison) or all around us (water/gas).
We can also make the distinction between an instigator in or all around us vs an instigator at a specific location, however I have even less of a clue how to name that then...

Probably "self-inflicted" is a poor term for that.

Yeah, naming things is not exactly a strength of mine... I'm happy about any suggestions!

It would be nice if an internal damage effect had an original trigger source that could be referenced as well.

In terms of the directional damage indicator, I'm not sure how it would help the player to know that the cactus they originally got poisoned by, for instance is somewhere to their right...

For the player the interesting point is "why / where from do I lose health right now?" The directional damage indicator shows them, where their attacker can be found, for instance an archer. It's important for the player to understand whether there's an attacker they might be able to defend themselves against or whether the damage is caused by an "environmental" (again maybe not the right term) effect like water, gas, poison, ...

docs/damage.md Outdated
Comment on lines 7 to 9
The `DamageSystem` handles damage dealt to entities with health.
The `BlockDamageAuthoritySystem` enables blocks to sustain some damage before getting destroyed.
The `DamageEffectAuthoritySystem` produces block particle effect in the event of damage.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be rendered as single paragraph. Should we use bullet points here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Send a `DoDamageEvent` to a specific entity to deal damage to it.

Use the `DamageResistComponent` to configure an entity to not take damage from specific damage types.
Examples for damage types are drowning (`engine:drowningDamage`) or explosive (`engine:explosiveDamage`) damage.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future: explain how to add more damage types?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a vague recollection that we have a module that adds a new damage type. But I have no idea what that is 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #103 to track this. Not sure we want the main docs for that in the Health module, though... I guess it makes more sense putting it in the engine wiki and linking to it from docs of relevant modules including Health.

docs/damage.md Outdated
Event chain:
* `DoDamageEvent`
* `BeforeDamageEvent`
* Entity damaged, health component saved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think of using italic font to indicate that this is an abstract explanation of what is happening?

Suggested change
* Entity damaged, health component saved
* _Entity damaged, health component saved_

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

* `OnDamagedEvent`

Commands:
* `damageResist(damagetype,percentage)`: gives resistance to damage (damagetype = all for total resistance).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future: Would be nice to have a command to list possible damage types.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, I can write an issue for that. However, I'm wondering whether that should be a command introduced by Health... Damage types are an engine-level concept after all...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like to challenge that damage types are part of the engine if the engine itself does not have a notion of, well, health....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair point

docs/health.md Outdated Show resolved Hide resolved
To activate regeneration send `ActivateRegenEvent(String id, float value, float endTime)` for a specific entity.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future: Link to JavaDoc when referencing events or methods.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created #104 to track this. This is currently blocked by #101

docs/ui-damage-overlay.md Outdated Show resolved Hide resolved
skaldarnar
skaldarnar previously approved these changes Jun 30, 2023
Co-authored-by: Tobias Nett <[email protected]>
@jdrueckert jdrueckert merged commit 335d6d7 into develop Jun 30, 2023
@jdrueckert jdrueckert deleted the doc/components branch June 30, 2023 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Doc Requests, Issues and Changes targeting javadoc and module documentation Type: Improvement Request for or addition/enhancement of a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants