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:
Alpha 6:
>Revolutionary new technique: By checking the distance from the puff to the firing actor, and using +THRUACTORS, I have fixed the melee issue once and for all. Now all weapons will only fire as far as they should have in the first place...
>...and alongside that, there is now a bullet speed slider! The bullets can now go as fast or as slow as you like.
Alpha 5:
>Fixed an issue that broke logic which relied on checking the firing monster's target.
Alpha 4 Turbo:
>Added WW-Cola3 to the list of Crude Decorate Hax included in the mod.
Alpha 4:
>Fixed the chainsaw-shoots-bullets bug in a less breakable way. Now the saw simply only shoots bullets if it would actually hit something. No more hacky distance limits.
Alpha 3.14:
>The walls are no longer alive.
Alpha 3:
+Dead Marine support added.
>Fixed a bug where firing at a skybox caused bullets to not appear.
Alpha 2:
+SmoothDoom support built in, using the magic of DECORATE inheriting from ZScript.
>Fixed the chainsaw-shoots-bullets bug.
Alpha 1: Initial release!
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.
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)
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)?
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.
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'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?
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
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.
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.
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?