beyond-all-reason / beyond-all-reason/RecoilEngine
Pass attackerTeam to UnitDamaged etc even when missing attackerID
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 683
- Forks
- 293
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 40
Description
### Description / repro of the problem
* have an attacker unit shoot a victim, with a slow projectile.
* make the attacker die before the projectile hits.
* when the projectile hits, both `attackerID` and `attackerTeam` passed to wupgets for events (`UnitDamaged` etc) are `nil`.
This means that gadgets are unable to tell what team damaged a unit and fail to implement team-based mechanics, despite it generally being obvious to the player,
### Use cases
* stats tracker that tracks how much damage each player dealt. (Exists in ZK, mostly minor annoyance because it's just stats)
* a gadget that makes some units deal no friendly fire. (Exists in ZK, necessitates a big pile of hax involving dead units because else you would get major teamkill)
* implementing every one of Brood War Zerg Queen abilities (Modding capability, plus funnily enough broodwar actually has the exact same problem so you may know exactly what i'm talking about even if you're unfamiliar with the ZK examples)
### Existing workarounds and how they fail
* ZK artificially keeps some units alive beyond death by giving them a fake "death animation" that just hides them and waits 15s, just so that damage can be attributed properly. This fails because units can be force-removed in ways that don't involve any way to delay it (e.g. reclaim), and it's absurdly inelegant and requires a pile of further hax on top.
* some damage-related events receive a projectileID param, from which you can poll the projectile for its teamID. This fails because with slow enough `explosionSpeed` the projectile can be gone by the time the shockwave reaches the victim, and sometimes you simply don't have a projectile in the first place.
### Other remarks
* damage that was never sourced to any team (e.g. falling, lava) should still pass `nil`.
* `attackerDefID` is also `nil` and it would be good if it was available, but that is not in the scope of this request.
* be aware of #1434.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by tracing the UnitDamaged and related event paths for cases where attackerID is missing, while reviewing #1434; done means team-sourced damage carries attackerTeam even after the attacker is removed, while unsourced damage still passes nil.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100