BulletZ: Proof-of-concept universal hitscan replacement

Projects that alter game functions but do not include new maps belong here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
User avatar
dawnbreez
Posts: 199
Joined: Wed Jul 08, 2015 12:29 pm

BulletZ: Proof-of-concept universal hitscan replacement

Post 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:
Last edited by dawnbreez on Fri Jun 15, 2018 2:22 pm, edited 9 times in total.
User avatar
silentw
Posts: 48
Joined: Fri May 20, 2016 1:47 pm

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

Post 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.
User avatar
phantombeta
Posts: 2084
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

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

Post 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)
User avatar
jckfrbn
Posts: 36
Joined: Mon Jul 18, 2016 6:26 am

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

Post by jckfrbn »

Can't wait to try this
User avatar
m8f
 
 
Posts: 1445
Joined: Fri Dec 29, 2017 4:15 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Manjaro Linux
Location: Siberia (UTC+7)
Contact:

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

Post 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)?
User avatar
dawnbreez
Posts: 199
Joined: Wed Jul 08, 2015 12:29 pm

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

Post 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
User avatar
dawnbreez
Posts: 199
Joined: Wed Jul 08, 2015 12:29 pm

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

Post 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.
User avatar
snarkel
Posts: 139
Joined: Wed Aug 06, 2014 9:02 pm
Preferred Pronouns: He/Him

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

Post 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.
User avatar
Mikk-
Posts: 2274
Joined: Tue Jun 30, 2009 1:31 pm
Location: Somewhere off Kanagawa

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

Post by Mikk- »

This would be interesting if paired with Denis Belmondo's ZTracers: viewtopic.php?f=37&t=56821
User avatar
Spaceman333
Posts: 622
Joined: Thu Oct 13, 2016 8:40 pm

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

Post 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?
User avatar
dawnbreez
Posts: 199
Joined: Wed Jul 08, 2015 12:29 pm

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

Post 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.
User avatar
dawnbreez
Posts: 199
Joined: Wed Jul 08, 2015 12:29 pm

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

Post by dawnbreez »

New version of BulletZ, this time with Smooth Doom support and a bugfix for the chainsaw trying to impersonate the Chaingun.
User avatar
dawnbreez
Posts: 199
Joined: Wed Jul 08, 2015 12:29 pm

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

Post 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.
User avatar
dawnbreez
Posts: 199
Joined: Wed Jul 08, 2015 12:29 pm

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

Post 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.
User avatar
Trusty McLegit
Posts: 264
Joined: Sun Feb 07, 2016 8:42 pm

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

Post 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?
Post Reply

Return to “Gameplay Mods”