twhl-community / halflife-updated

Half-Life SDK updated to compile under VS2019 and 2022. Check README.md for more information.
Other
382 stars 146 forks source link

Nihilanth healing stars don't update correctly if the charging sequence is interrupted by a quick load #224

Closed Ronin4862 closed 1 year ago

Ronin4862 commented 1 year ago

I've reported this over a year ago. If you let the Nihilant teleport you to the adjacent rooms, shoot him between teleportations, let the stars heal him, come back and shoot him some more and let the stars replenish from the three crystals and then die and reload from a saved game somehow messes up the stars and they don't update correctly anymore. The video here is after I've destroyed the crystals. It's hard to make a complete video...any combinations of what I said leads to this. You have to complete the four rooms and return. It's long and tricky but it happens. I've completed this game more than a hundred times in my life and more often than not this combination of events leads to this bug. Unrelated: Notice the square flashes at 01:13 when the Nihilant releases its energy and dies. They look ugly. Is there something that can be done about them?

P.S. If you die after defeating the Nihilant, the ending sequence with the G-Man is still triggered instead of an auto-reload (second video).

https://youtu.be/9RiFD6x_AWM https://youtu.be/GRKs8nZfKPw

SamVanheer commented 1 year ago

I can't reproduce this even if if follow the steps exactly. I've looked at the code and i can't see any way this could happen so without a way to reproduce it i can't do anything about it.

Find a way to reproduce it, reduce it to the simplest possible reproducible case and then let me know how to do it.

The sprites created when Nihilanth dies have the wrong render mode, that's fixed in the Unified SDK.

You can die and still trigger stuff in a lot of cases, you can also commit suicide in the middle of scripted sequences and dialogue. It's not a bug, i'd call it more of an easier egg. It's not worth fixing anyway.

Ronin4862 commented 1 year ago

Stars are added to Nihilant's aura from the crystals. I guess if you keep shooting him when he powers up, or you die at that moment and you quick load, or you are teleported immediately before he powers up and then you return, the wrong number of stars are added leading to a surplus when his head opens up. I'll see what I can do about the video...

Ronin4862 commented 1 year ago

I've managed (by accident) to recreate the issue by simply quick saving and quick loading while shooting the Nihilant when he's charging from the crystals. His head will open while stars are still overhead. I'll do a proper video soon.

Ronin4862 commented 1 year ago

Here you go:

https://youtu.be/FoJNq3gXbM0

Yes, you don't normally quick save and quick load while he's charging but consider this very plausible scenario: You inflict some damage when you first encounter the Nihilanth without touching the crystals. He then teleports you to one of his adjacent chambers where you get killed right away. At the same time the Nihilanth starts his powering up sequence (you can actually hear this from any of his chambers). The autoload kicks in to resume the game and when you get back to his chamber to finish him off this happens.

SamVanheer commented 1 year ago

Thanks for the video, it helped me to pinpoint the cause of the problem.

The bug was in the save game system. Due to an incorrect data type size (half of what it should be) it only checked the first half of the sphere array. When Nihilanth takes damage he absorbs the first sphere in the array. Once the first 10 are absorbed the save game system thinks the array is empty and doesn't save it at all.

It will still save the actual spheres so you end up with cosmetic spheres that never go away.

I've changed it so that it correctly checks the array.

This bug could also affect some other entities but not in any significant way. Nihilanth is affected more obviously because of the way the array is modified.

The Unified SDK doesn't have this bug because its save game system was overhauled to ensure correct handling of data.