Page 1 of 3

BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 1:07 am
by dawnbreez
Did you just say universal?

This .pk3--this ridiculously small .pk3--will replace all hitscans with projectiles. Right now it works with Doom 1/2 and Freedoom 1/2, and adding support for other hitscans should be easy, as all you need to do is add a new puff replacer that replaces any nonstandard bullet puffs and extends from BulletZPuff.

How does it work?

It's pretty simple. Using the power of ZScript, I have replaced the standard BulletPuff actor with an actor which tracks its "owner", the actor who fired it. It then sets its owner's target to itself (to simulate the spread that would have happened with the original hitscan attack) and calls A_SpawnProjectile from the owner. This causes the owner to fire a projectile toward where the hitscan landed. Finally, the bulletpuff itself has a damage type with a default damage factor of 0, meaning that the puff simply won't damage anything on its own. The result is that the bulletpuff is, for all intents and purposes, replaced with a projectile!

Screenshots?
Spoiler:
Download?

Here's the current download! Now with Smooth Doom support and a fix for the chainsaw's bullet barf.
Download!

Changelog:
Spoiler:

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 2:31 am
by silentw
This is very interesting!
Do you have any data on execution time increases when using this? I know one of the reasons that some people have been shying away from ZScript is its speed compared to DECORATE, ACS, and native code.

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 2:46 am
by phantombeta
silentw wrote:I know one of the reasons that some people have been shying away from ZScript is its speed compared to DECORATE, ACS, and native code.
ACS is probably slower, and DECORATE runs in the exact same VM as ZScript, so it has the exact same speed - in fact, all that changes between ZScript and DECORATE is the compiler frontend AFAIK. The code-generation step is the exact same, so DECORATE will have the same performance as ZScript. (or even worse performance than ZScript, since you have to rely on slow hacks in DECORATE)

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 4:29 am
by jckfrbn
Can't wait to try this

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 4:46 am
by m8f
Cool concept!
You say "this pk3", but there is no download link. Is it not ready yet?

If I understand this right, if someone wants only decorative bullet tracers he can set bulletpuff's damage to non-zero, and projectile's to 0, and have tracers that land exactly where hitscan hits (unlike current tracers implementation in Beautiful Doom)?

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 10:14 am
by dawnbreez
WHOOPS! I forgot to actually upload it! Edited the original post, but here's the link:
https://www.dropbox.com/s/zinqgqq49ggfq ... z.pk3?dl=0

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 10:16 am
by dawnbreez
silentw wrote:This is very interesting!
Do you have any data on execution time increases when using this? I know one of the reasons that some people have been shying away from ZScript is its speed compared to DECORATE, ACS, and native code.
It does not have any noticeable slowdown. I can't think of a way to do it in DECORATE--maybe with ACS hackery--but it'd probably run just as smoothly. It's essentially just tacking on an A_SpawnProjectile after every A_CustomBullet.

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 6:59 pm
by snarkel
Holy crud this is amazing! Might even throw this in my autoloads! I've noticed two things though, the pistol sound plays from every projectile, and the chaingunner pretty much fires like a zombieman now.

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 7:10 pm
by Mikk-
This would be interesting if paired with Denis Belmondo's ZTracers: viewtopic.php?f=37&t=56821

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 9:04 pm
by Spaceman333
I'm all for universal addons/mutators and this excites me, though I'm a bit unsure how to use it.

If I read the OP right its a bit semi-universal? Like, for each seperate mod that I want to play this with, I would still need to create a patch or edit the mod itself to have special cases for each bullet type with a BulletZPuff definition?

And what about variable speed between projectiles? Like there being a difference between a pistol and a railgun, where the latter would have a much higher projectile speed in comparison. Are all projectiles going to travel at the same speed or is there a way to have some go slower or faster?

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Thu Feb 15, 2018 11:07 pm
by dawnbreez
snarkel wrote:Holy crud this is amazing! Might even throw this in my autoloads! I've noticed two things though, the pistol sound plays from every projectile, and the chaingunner pretty much fires like a zombieman now.
I've removed the pistol sound from the projectile. That was an oopsie on my part; I wasn't sure if I needed to play the sound from the projectile, and was working off the DoomImpBall (which *does* play a sound at spawn) as an example.
Spaceman333 wrote:I'm all for universal addons/mutators and this excites me, though I'm a bit unsure how to use it.

If I read the OP right its a bit semi-universal? Like, for each seperate mod that I want to play this with, I would still need to create a patch or edit the mod itself to have special cases for each bullet type with a BulletZPuff definition?

And what about variable speed between projectiles? Like there being a difference between a pistol and a railgun, where the latter would have a much higher projectile speed in comparison. Are all projectiles going to travel at the same speed or is there a way to have some go slower or faster?
It should be compatible with anything that does not replace the standard bullet puff, and does not use special bullet puffs. However, like you said, all you'd need to do is add a new class that replaces the new bullet puff--I've already worked Smooth Doom compatibility into the next update, for instance. As for making some kinds of shots slower or faster, I'm not sure--it depends on whether or not railguns use different puffs. Research is needed. I'll probably try to add a setting for making the projectiles faster or slower, though. May have to 'borrow' something from Sun Damage Overdrive for that :wink:
Mikk- wrote:This would be interesting if paired with Denis Belmondo's ZTracers: viewtopic.php?f=37&t=56821
I would be happy if Belmondo used my code to make ZTracers replace hitscans more universally. However, I still need to come up with a fix for the melee bug. It wouldn't be good if my code caused his mod to give all fists bullet-punching powers. I think I have a fix for that, though.

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Fri Feb 16, 2018 10:11 am
by dawnbreez
New version of BulletZ, this time with Smooth Doom support and a bugfix for the chainsaw trying to impersonate the Chaingun.

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Fri Feb 16, 2018 10:47 am
by dawnbreez
Quick fix for an issue where firing into the sky would not fire a bullet. Also, support for Dead Marine! And now things bleed when hit! And sometimes walls if you hit them at the right angle with the chainsaw. I'm working on that.

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Fri Feb 16, 2018 10:58 am
by dawnbreez
And another quick fix: Walls are not alive, they should not bleed. Should not. Probably.

EDIT: And another! I left a debug print in there. My bad.

Re: BulletZ: Proof-of-concept universal hitscan replacement

Posted: Fri Feb 16, 2018 6:11 pm
by Trusty McLegit
dawnbreez wrote:I would be happy if Belmondo used my code to make ZTracers replace hitscans more universally. However, I still need to come up with a fix for the melee bug. It wouldn't be good if my code caused his mod to give all fists bullet-punching powers. I think I have a fix for that, though.
I think he meant for you to add ztracers to this mod. Maybe as a cvar?