HarbourMasters / HarbourMasters/Shipwright
Enemy rando, new Dark Link actor?
- Dominant language
- C
- Stars
- 5.4k
- Forks
- 837
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 72
Description
**Problem:** Dark Link (`EnTorch2`) shares several overlay static variables with Player in z_player and with other Dark Link actors in z_en_torch2. This causes issues in enemy randomizer such as:
- If Dark Link is in water, `sWaterSpeedScale` is set to 0.5, shortening player's jumps etc
- If more than one Dark Link in a room, they will not behave independently, but share timers, flags and other variables key to actor behavior - can lead to things like 1 Dark Link attacking and 10 others just standing around watching
This is kind of boring and not worthy for cool enemy. To improve this, the static variables have to be made part of the actor.
However, Dark Link shares actor struct with Player, so any modification there would also modify player. It would also require a rewrite of Dark Link code to a degree where it wouldn't make sense to just use hooks for using the static (for vanilla play) vs actor variable.
**Idea:** I'm thinking the best solution would be to simply make a new actor for enemy randomizer Dark Link (codename `EnTorch3`), copypaste code + new actor struct copied from player, place the statics there and modify the code to use the struct variables.
This would also allow directly modifying new Dark Link code to adapt better to more than one Dark Link (in particular, currently practically sharing inputs) or unusual battlefields (tendency to fall out of bounds) without having to use hooks or take into consideration vanilla actor behavior.
It would also create an easy solution for the Dark Link/Player problem - add the shared static variables to the struct, and let player alone use player static variables if enemy randomizer.
Putting this question up if someone else has some good ideas to solve these problems and it would be quite a big change.
As far as I'm aware the only custom actor thus far is Ivan which doesn't seem to be handled in the same way as scene actors, but handling shouldn't be an issue as the replacement is done in EnemyRandomizer and not directly in scene commands.
This is testing with z_en_torch2 statics moved into Player struct + miniboss music (cool fight between skill issue and dark forces).
Only Dark Links close to projectile react etc:
https://github.com/user-attachments/assets/25dc0f85-6836-46d0-842f-d3ae1e8bf5de
This is current behavior (boring, no skill needed, shared death flag):
https://github.com/user-attachments/assets/07416dd8-2cb9-4cae-805e-94009b3f0ed5
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the Dark Link code in z_en_torch2 alongside the Player code in z_player, focusing on the shared static variables and actor structs. Then inspect how EnemyRandomizer replaces the actor and how the custom actor Ivan is handled compared with scene actors. Done means multiple randomized Dark Links maintain independent timers, flags, inputs, and movement without affecting Player behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100