Virtual for bulletpuffs for deciding if hitscan hits

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: Developers

Virtual for bulletpuffs for deciding if hitscan hits

Postby Ghastly » Thu Feb 08, 2018 11:07 pm

Sort of like an analogue of CanCollideWith for other actors, a virtual function for bulletpuffs that takes an actor pointer (the thing it "hit") and returns a boolean that decides whether or not a hitscan or rail attack can hit/hurt a particular actor. With this, a modder can effectively make custom Thru flags for bulletpuffs like you can with other actors and projectiles. Before anyone says, CanCollideWith currently has no effect on hitscans.
User avatar
Ghastly
Rather ghastly
 
Joined: 06 Jul 2007

Re: Virtual for bulletpuffs for deciding if hitscan hits

Postby Rachael » Thu Feb 08, 2018 11:24 pm

The outlook on this one does not look good.

I haven't seen the hitscan code, myself, but from what I've seen other people say of it, the name is literal. Having a virtual function alongside it can potentially cause performance to tank, especially in situations where there are a lot of hitscans at once (just imagine if someone put 72 chaingunners on a single map...). Granted the virtual will only fire when the scan successfully hits an object, that can still cause problems along the line if the virtual continuously throws false positives.

I am not going to close this one, myself, maybe Graf might have a better solution for this, but this is what I know of it so far.

What makes this worse is that hitscan code is not used exclusively for gun blasts - it's also used for sight checks and explosive LOS testing. Depending on how the Doom code base is written that might not be an issue - but GZDoom has proven to be anything but an ideal world when it comes to adding complexity in certain other scenarios.
User avatar
Rachael
QZDoom + Webmaster
 
Joined: 13 Jan 2004

Re: Virtual for bulletpuffs for deciding if hitscan hits

Postby Apeirogon » Fri Feb 09, 2018 7:43 am

But hitscan still require something that can check/allow hitscan can hitscan hit target or no.
Because alongside with zscript one and a half flag for hitscan looks like stone hammer in between atomic-force microscope and nanorobots.
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: Virtual for bulletpuffs for deciding if hitscan hits

Postby ZzZombo » Fri Feb 09, 2018 11:43 am

It makes no sense to have a bullet puff (a post effect of an attack) dictate whether the attack hits in the first place. And frankly, why don't you just change whatever is attacking to filter unwanted targets out before firing, as it should be?
ZzZombo
 
Joined: 16 Jul 2012

Re: Virtual for bulletpuffs for deciding if hitscan hits

Postby Xaser » Fri Feb 09, 2018 12:24 pm

ZzZombo wrote:It makes no sense to have a bullet puff (a post effect of an attack) dictate whether the attack hits in the first place.

Where else would you specify this?
ZzZombo wrote:And frankly, why don't you just change whatever is attacking to filter unwanted targets out before firing, as it should be?

How else would you achieve something like a hitscan that passes through Monster A and hits Monster B directly behind them?
User avatar
Xaser
anarchivist
 
 
 
Joined: 20 Jul 2003

Re: Virtual for bulletpuffs for deciding if hitscan hits

Postby Graf Zahl » Fri Feb 09, 2018 1:36 pm

ZzZombo wrote:And frankly, why don't you just change whatever is attacking to filter unwanted targets out before firing, as it should be?


Because that'd amount to doing twice the work with no gain. The tracer just iterates through the blockmap and checking anything its path crosses.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Virtual for bulletpuffs for deciding if hitscan hits

Postby ZzZombo » Fri Feb 09, 2018 8:08 pm

On the hitscan attacks themselves would be best, I think?
ZzZombo
 
Joined: 16 Jul 2012

Re: Virtual for bulletpuffs for deciding if hitscan hits

Postby Rachael » Fri Feb 09, 2018 8:34 pm

If you are already so exceptionally sure how to implement it, pull requests are welcome.
User avatar
Rachael
QZDoom + Webmaster
 
Joined: 13 Jan 2004

Re: Virtual for bulletpuffs for deciding if hitscan hits

Postby Ghastly » Fri Feb 09, 2018 11:21 pm

ZzZombo wrote:On the hitscan attacks themselves would be best, I think?
There's no actor for the hitscan attack; the closest thing is the bulletpuff. Which is why a lot of flags and properties, such as +MThruSpecies, Decals and DamageType, are specified on the BulletPuff the hitscan attack spawns. Hence why I asked for Bulletpuffs, so it's consistent with everything else that modifies hitscans.
User avatar
Ghastly
Rather ghastly
 
Joined: 06 Jul 2007

Re: Virtual for bulletpuffs for deciding if hitscan hits

Postby ZzZombo » Sat Feb 10, 2018 12:52 am

There is, it's the one that performs the attack. However, I didn't mean that, I meant that hitscan attack functions should be the ones to change, like accepting a custom struct with a function to callback, in absence of function pointers.
ZzZombo
 
Joined: 16 Jul 2012

Re: Virtual for bulletpuffs for deciding if hitscan hits

Postby Graf Zahl » Sat Feb 10, 2018 3:15 am

Yes, in hindsight that should be the case, but let's not forget that the damaging code uses the inflictor for lots of stuff to decide. And due to lack of a better alternative, the puff is used here.
Changing that now would require duplication of the entire damage handling to use your structs. The entire thing had to fit into a very limited framework.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest