Skip to content

Conversation

@NiteKat
Copy link

@NiteKat NiteKat commented Jan 1, 2025

Fixes issue where a Larva's build queue can have hanging items causing problems with morph commands on the larva or Hydralisks and Mutalisks by having a morph command and stop command issued on the same frame. This ensures the build_queue is clear before attempting to add the desired unit type to the build_queue.

Directly erasing maintains the 1.16.1 behavior of the resources still being consumed by this situation, while keeping the larva and it's future unit type functioning properly as in 1.16.1.

Fixes issue #32

Fixes issue where a Larva's build queue can have hanging items causing problems with morph commands on the larva or Hydralisks and Mutalisks by having a morph command and stop command issued on the same frame. This ensures the build_queue is clear before attempting to add the desired unit type to the build_queue.

Directly erasing maintains the 1.16.1 behavior of the resources still being consumed by this situation, while keeping the larva and it's future unit type functioning properly as in 1.16.1.
@NiteKat
Copy link
Author

NiteKat commented Jan 1, 2025

A note on this - this fix, while it makes OpenBW align with BW behavior in this specific case, is not BroodWar behavior, as it looks like you can permanently break a Larva in BroodWar if you pull this trick on it enough times in a row.

image

With that in mind, I'm not sure what the proper BW fix is, because this trick doesn't break Hydra to Lurker morph, but I think the "bug" in behavior differences might lie somewhere else.

This removes the loop I made to clear build queues for larva - this deviates from BW behavior in edge cases since in 1.16 and Remaster you can brick a larva with morph/stop on same frame 5 times, and previous fix prevented that.

I observed that 1.16 puts the Lurker/Guardian/Devourer types at the front of the build queue on the unit instead of the back. In OpenBW there is no function to do this with a static_vector, so if it pushes to the end successfully I check if it is a Lurker/Guardian/Devourer morph, then push indexes 0 through 3 down 1, then puts the correct unit type (what was pushed to the end) at the front of the build_queue. Behaviorally this is what BW does, but I'm not sure it does it exactly this way.

I feel this would be cleaner if there was a way to push to the front of the build queue, but that doesn't exist for a static_vector from what I can see.
@NiteKat
Copy link
Author

NiteKat commented Jan 1, 2025

This removes the loop I made to clear build queues for larva - this deviates from BW behavior in edge cases since in 1.16 and Remaster you can brick a larva with morph/stop on same frame 5 times, and previous fix prevented that.

I observed that 1.16 puts the Lurker/Guardian/Devourer types at the front of the build queue on the unit instead of the back. In OpenBW there is no function to do this with a static_vector, so if it pushes to the end successfully I check if it is a Lurker/Guardian/Devourer morph, then push indexes 0 through 3 down 1, then puts the correct unit type (what was pushed to the end) at the front of the build_queue. Behaviorally this is what BW does, but I'm not sure it does it exactly this way.

I feel this would be cleaner if there was a way to push to the front of the build queue, but that doesn't exist for a static_vector from what I can see.

@tscmoo
Copy link
Collaborator

tscmoo commented Jan 3, 2025

Thanks! While this does fix this particular issue (and helped me debug), I decided to go for a more thorough replication of the original behavior that might also fix other desyncs.

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