Giter Club home page Giter Club logo

Comments (9)

SamVanheer avatar SamVanheer commented on August 17, 2024

Monsters with the fade on death spawnflag set will fade on death. Monsters spawned by monstermaker entities fade if the number of monsters spawned is not 1.

This is to prevent out of edicts errors and performance issues due to large numbers of corpses.

Relevant code:
https://github.com/SamVanheer/halflife-updated/blob/1fc0ed79c862e22383a2affb84d2afc0a6f746bf/dlls/monstermaker.cpp#L281-L290
https://github.com/SamVanheer/halflife-updated/blob/12d410785b9e07a9e2e122ca28d75c90c4eb6c3e/dlls/combat.cpp#L607-L612
https://github.com/SamVanheer/halflife-updated/blob/1fc0ed79c862e22383a2affb84d2afc0a6f746bf/dlls/monsters.cpp#L3444-L3451

See references to ShouldFadeOnDeath for where the fading is handled.

You can disable this behavior entirely but just like making shells stay longer this risks hitting engine limits.

from halflife-bs-updated.

Ronin4862 avatar Ronin4862 commented on August 17, 2024

Thanks Sam,
I'll give it a go!

from halflife-bs-updated.

Ronin4862 avatar Ronin4862 commented on August 17, 2024

I commented out this line and it works great 99.9% of the times.
(https://github.com/SamVanheer/halflife-updated/blob/1fc0ed79c862e22383a2affb84d2afc0a6f746bf/dlls/monsters.cpp#L3448)

In this map all soldiers but one should fadeout after they die. With what I've modified it is the other way around: only one fades out and the rest stay and I can't quite understand why...
In all other maps I've tried all the corpses stay :D
https://youtu.be/bgZ7-BHCa7g

If the corpses are treated like bullets (i.e. a discrete entity) than I think all is good as there will never be that much enemies in one scene.

from halflife-bs-updated.

Ronin4862 avatar Ronin4862 commented on August 17, 2024

My bad, I did not pay attention. By doing what I did I just reversed the situation; corpses that should fade don't fade but also those that are not supposed to fade, fade :)))
I found that by commenting out this line, everything works fine:
https://github.com/SamVanheer/halflife-updated/blob/1fc0ed79c862e22383a2affb84d2afc0a6f746bf/dlls/schedule.cpp#L470

from halflife-bs-updated.

Ronin4862 avatar Ronin4862 commented on August 17, 2024

Hmmm...I was afraid of this...
In the first video I count 14 Vortigaunts. In the second 18.
https://youtu.be/vDtV62AZvp4
https://youtu.be/4QuGRjhsFIA
It seems the last four are created AFTER the previous corpse has FADED away. Is it possible to modify this? To ALWAYS generate monsters after previous ones have been killed but NOT faded away?

P.S. Gibbing has the same effect as fading away. The monstermaker will generate a new monster just the same after the previous corpse is either gibbed or has faded away so that all 18 Vortigaunts will be spawned.
https://youtu.be/c9VfDTbgTAM

from halflife-bs-updated.

Ronin4862 avatar Ronin4862 commented on August 17, 2024

It seems it has something to do with UTIL_EntitiesInBox. The monstermaker will generate a new monster when "the box" is empty. That's what gibbing and fade out do practically.
By disabling this line all 18 Vortigaunts are properly spawned but I'm left with a stack of monsters, as they are put on top of each other.
https://github.com/SamVanheer/halflife-updated/blob/1fc0ed79c862e22383a2affb84d2afc0a6f746bf/dlls/monstermaker.cpp#L190

In practice is not that bad, but I wish there's a better way. My coding skills are crap...
Sam, some help would be greatly appreciated :D !!!
https://youtu.be/1n8OFpLgd9g

from halflife-bs-updated.

SamVanheer avatar SamVanheer commented on August 17, 2024

You could keep UTIL_EntitiesInBox and have it ignore corpses (is pev->deadflag == DEAD_DEAD) but that could still get them stuck if the corpse is solid.

Unfortunately with how messy this code is there's no one place you can change to have everything work just right, some NPCs have their own copy of the same code so you'll need to change that as well.

For future questions i'd suggest asking on the TWHL Discord server, there are plenty of programmers who can help you out there.

from halflife-bs-updated.

Ronin4862 avatar Ronin4862 commented on August 17, 2024

You could keep UTIL_EntitiesInBox and have it ignore corpses (is pev->deadflag == DEAD_DEAD) but that could still get them stuck if the corpse is solid.

But they don't get stuck. The spawned Vortigaunts walk out of the stack just fine and then attack me if I don't kill them quickly enough.

For future questions i'd suggest asking on the TWHL Discord server, there are plenty of programmers who can help you out there.

But they're not as smart as you :)

from halflife-bs-updated.

SamVanheer avatar SamVanheer commented on August 17, 2024

But they don't get stuck. The spawned Vortigaunts walk out of the stack just fine and then attack me if I don't kill them quickly enough.

UTIL_EntitiesInBox will find any entity in the box, regardless of whether the spawned NPC will get stuck in them or not. You have to expand on the test to ignore non-solid entities. I'd create an overload that uses a callback to filter entities, then you can ignore those types of entities.

If you need help then please ask on the TWHL Discord server. This issue tracker is for bug reports, feature requests (within scope) and improvements.

from halflife-bs-updated.

Related Issues (10)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.