Skip to content

Land hits from the attacker's client and sync player health - #40

Merged
absol89 merged 5 commits into
API-playtestfrom
claude/party-health-sync
Nov 14, 2026
Merged

absol89 merged 5 commits into
API-playtestfrom
claude/party-health-sync

Conversation

@absol89

@absol89 absol89 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Requested by Eric · project thread

Based on v1.8.7-10 (same commit as API-playtest). Adds one message pair (RequestPlayerHit / NotifyPlayerHit), so clients and server must come from the same build.

Why

Damage logs from the diagnostic build (#39) showed:

  • A party member only took an enemy hit when their own replayed copy of the enemy connected: 4 of 10 real hits landed. PvP hits had the same problem, so friendly fire landed one way and not the other.
  • Copies of players defend with none of the player's perks, armor skill or block (armor 158 vs 400), so a hit computed against the copy was ~3x too strong.
  • Regen and heals are never sent, so copies of other players only lose health (88 HP off after a minute).

What

  • Attacker detects, victim resolves. Actor::ProcessHitData (38586) is hooked to expose the HitData to HookDamageActor. When the local player or an NPC owned here hits a remote player, the client sends RequestPlayerHit with the HitData physical damage (+0x54: after the attacker's perks, sneak and crit, before armor/block), attacker, weapon and flags. The server forwards it to the hit player's owner only.
  • The victim (Actor::ApplyHitFromOwner) builds a HitData (ctor 43995) against its real player, runs the armor and block step (44014), Mod Incoming Damage (ApplyPerkEntryPoint 23526, entry 0x24), then the original DamageActor (37335) which applies the player difficulty multiplier (3x on Legendary for PvP too), bleedout and death. The attacker's armor penetration (entry 0x25) is answered on the victim's side by the existing RemotePerks.
  • The local player ignores hits from any remote attacker's replayed copy. The PvP-off rule (players and their summons) is applied on the sending side.
  • Health: remote players take their owner's health from the actor value sync; the local player's health is sent every 250 ms when it changes, independent of party. Health deltas are no longer applied to players.
  • Server: OnHealthChangeBroadcast subtracted damage with the wrong sign from the stored health used for later spawns.
  • [DmgDiag] logging, quieter than Log damage and health sync events to find doubled or missing party damage #39: player hits of at least 1 point, sent/received player hits, and FLAG DUP_LOCAL_HIT / DUP_RECEIVED_HIT / DUP_BROADCAST warnings.
  • Also carries the build_version xmake option from Log damage and health sync events to find doubled or missing party damage #39.

Verified / assumed

Verified with Ghidra on SkyrimSE 1.6.1170 (decompiled, read-only): HitData offsets (+0x18 aggressor handle, +0x1C target handle, +0x30 TESObjectWEAP*, +0x50 total, +0x54 physical, +0x80 flags, size 0x98), ctor/dtor 43995/43997, 44014 reads only +0x50 as input and null-checks aggressor and weapon, 23526 call pattern (0x24, target, aggressor, weapon, float*), 38586 calls 37335 with +0x50 once per hit, main thread only.

Assumed: the 1.7.104 code (IDs from the Address Library only); per-entry perk argument counts (filled at runtime, taken from call sites); Mod Incoming Damage now runs after armor instead of before crit, a small ordering difference. Weapon enchantments/poison and stagger still come from the victim's own replay of the hit.

Needs an in-game test with 2 clients; the server needs a rebuild.

🤖 Generated with Claude Code

https://claude.ai/code/session_018fvQxSwpo46aX4h3sn2BYB

…sion

A diagnostic build from a branch reports e.g. v1.8.7-10-1-ga91c0c49 and
the v1.8.7-10 server rejects it. With --build_version=v1.8.7-10 the build
stamps that version instead of git describe. The protocol is unchanged on
this branch, so the client stays compatible.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fvQxSwpo46aX4h3sn2BYB
…ealth

A party member only took an enemy hit when their own replayed copy of the
enemy happened to connect: in a test 4 of 10 real hits landed. The client
that owns the NPC now sends the raw hit to the player's client, which
runs it through the game's damage with its own difficulty, and players
ignore hits from replayed NPC copies.

Health regen and heals were never synced, so copies of other players only
ever lost health (88 HP off after a minute). Copies now take the owner's
health from the actor value sync instead of summing deltas.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fvQxSwpo46aX4h3sn2BYB
@absol89 absol89 self-assigned this Nov 14, 2026
…alth faster

PvP hits only landed when the victim's replayed copy of the attacker
happened to connect, so friendly fire went through one way and not the
other. The attacker's client now sends the hit like an NPC owner does,
and the victim applies it with its own difficulty, the same multiplier
as an enemy hit.

Other clients now take a player's health only from the owner, so the
local player's health is sent every 250 ms when it changes instead of
once a second, for everyone nearby whether in a party or not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fvQxSwpo46aX4h3sn2BYB
The server added health deltas with the wrong sign, so a damaged actor's
stored health went up until the owner's next actor value sync. Players
who walk in later spawn actors with that stored health.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fvQxSwpo46aX4h3sn2BYB
@absol89
absol89 force-pushed the claude/party-health-sync branch from 7467cc0 to 81d644b Compare November 14, 2026 19:13
@absol89 absol89 changed the title Let the attacking NPC's owner land hits on players, and sync player health Land hits from the attacker's client and sync player health Nov 14, 2026
Copies of players defend with none of the player's perks, armor skill or
block, so a hit computed on the attacker's client was about 3x too strong
against a well armored player. The attacker now sends the hit's damage
from before armor (HitData physical damage), plus attacker, weapon and the
flags the armor step reads, in a new RequestPlayerHit. The victim's client
rebuilds the HitData against its real player, runs the game's armor and
block step (44014), its Mod Incoming Damage perks, then the damage
function with its own difficulty.

Also brings the damage diagnostics over, quieter: only hits involving a
player and of at least 1 point, flags only for hits or deltas that arrive
twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018fvQxSwpo46aX4h3sn2BYB
@absol89
absol89 merged commit d7e1c9b into API-playtest Nov 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants