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

Record instance info for Fighters/Items #120

Merged
merged 2 commits into from
Sep 20, 2023

Conversation

NickCondron
Copy link
Contributor

@NickCondron NickCondron commented Feb 18, 2023

Every time a fighter starts an action a new 16 bit 'instance' value is incremented and stored in the fighter at offset 0x2088. Additionally, when a fighter throws/spawns an item/projectile, that item inherits that fighter's instance at offset 0xDA8. When a fighter is hit by a move/item, the instance value of the attacker/item is copied to the victim fighter at offset 0x18EC.

This PR adds the fighter instance & instance_hit_by fields to post frame update and the item instance field to the item update. These fields can be used to better track hits in doubles because lastHitBy field is unreliable (project-slippi/slippi-js#71).

Notes:

  • Behaves identically for grabs, throws, and phantom hits
  • Hits that are shielded, reflected, absorbed, or taken while invincible are not stored
  • items without an owner have instance 0 (eg. bob-omb spawned in)
  • instance IDs are unique such that no two fighters have the same ID at the same time
  • instance hit by resets to 0 only on death

Short example replay 1v1 against CPU:
Game_20230316T213900.zip

@JLaferri
Copy link
Member

I haven't confirmed the fields themselves but code-wise this seems fine to me. I'm down to merge it but prior to that can you increment the minor version number in Recording.s? The symbol is called CURRENT_VERSION.

@NickCondron
Copy link
Contributor Author

Updated the version.

Here's the PR I wrote that would add parsing project-slippi/slippi-js#124

This is the only other place I've seen this behavior documented: https://github.com/akaneia/m-ex/blob/master/MexTK/include/fighter.h#L2426C21-L2426C21

@JLaferri JLaferri merged commit 676c8a0 into project-slippi:master Sep 20, 2023
1 check 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