Railgun attack using sprites

Moderator: GZDoom Developers

Post Reply
User avatar
Z86
Posts: 101
Joined: Mon Jan 24, 2011 5:22 pm

Railgun attack using sprites

Post by Z86 »

How to make a railgun attack that is similar to Unreal 1 shock rifle or Shadow Warrior railgun?

Solution 1: you have to make the railgun particles invisible, and add a fast missile with the proper projectile type (little circles in case of Unreal SR, spirally animated stuff in case of SW railgun) and no damage and pain (and +RIPPER if the railgun is to penetrate targets).

What's the problem with this?
- Fast missile has to have collision box, ore else it goes through most walls. If it has collision box, in narrow spaces it may land into a wall where the invisible railgun attack passes on, misleading the user into thinking the shot hit the wall.
- The fast missile can be dodged despite the railgun hitting, again misleading the user
- On long distances the "speed difference" between the non-hitscan missile and the hitscan rail attack becomes apparent. Railguns are long ranged weapons, so this problem is quite usual.
- Extremely fast missiles even when they are the special fast projectile type tend to go through walls in certain conditions

Solution 2: drop the railgun attack, and use only the fast projectile.

What's the problem with this?
- It's not hitscan.
- It needs to have collision box, therefore it tends to hit walls more often than hitscans.
- If it needs to be target penetrating, you have to use the +RIPPER flag. It creates erratic damage behaviour due to it being dependent on the size of the enemy (an Arachnotron will receive a lot more damage than a Baron, also if you shoot at angles, it will deal sqrt(2) times more damage). Damage also becomes projectile speed dependant.

What i think would be a good solution:

Either a new function that adds an attack behaviour that is the mix of a railgun and a fast projectile: it is a hitscan that can penetrate, but leaves a sprite with the proper direction (like the newer version of fast projectile) every X distance.
Something like this:

Code: Select all

SPRT A 1 A_SpriteRailgun(<Damage>,<Sprite actor leave>,<spawnoffset>,blah...)
Or add a flag + property on the original railgun attack that does the same.

Code: Select all

SPRT A 1 A_RailAttack(<Damage>,<Spawnoffset>,<Useammo>,<Ringcolor>,<Corecolor>,RGF_SPRITETRAIL, <maxdiff>, <pufftype>, <spreadxy>, <spreadz>, <Sprite actor type>)
By the way it'd be also nice if somehow you could set the distance between sprite actors left behind by this or fastprojectile.
When one is specified, several (at least eight) are spawned every tic in the projectile's wake, as a trail. The greater the speed, and the smallest (yet non-null) the radius, the more numerous the steps.
The wiki says this, but what i found is quite different. I tried using moderate to extreme values on both end of the spectrum (both speed and radius), yet for some reason the distance between them remained the same.
User avatar
InsanityBringer
Posts: 3392
Joined: Thu Jul 05, 2007 4:53 pm
Location: opening the forbidden box

Re: Railgun attack using sprites

Post by InsanityBringer »

Solution 3: I have made some laser code which allows for arbritary particles to be applied to a hitscan attack. It's not very hard with a bit of ACS but native support wouldn't be bad in any case.

Also, if you watch the Unreal ASMD closely, you'll realize that the trail is just a medium-speed projectile that goes to where the hitscan hit.
User avatar
Salad Viking
Posts: 752
Joined: Tue Apr 20, 2010 8:58 pm
Location: In high orbit

Re: Railgun attack using sprites

Post by Salad Viking »

InsanityBringer wrote:Also, if you watch the Unreal ASMD closely, you'll realize that the trail is just a medium-speed projectile that goes to where the hitscan hit.
Same for the shock rifle in UT.

So it seems there are already solutions to your query. There's no need to add any new features.
User avatar
Z86
Posts: 101
Joined: Mon Jan 24, 2011 5:22 pm

Re: Railgun attack using sprites

Post by Z86 »

Hmm just looked up some videos, and Unreal 1 ASMD is really two staged (although it never does things like the projectile trail missing into a wall and the hitscan not), but i could bring on any other example (i actually did with Shadow Warrior railgun, which is hitscan and uses 8 side rotated sprites for vapor trail). Other example would be a Quake3 like railgun, that leaves a center line (could be the core particles) and some discs at certain distances with a single hitscan attack.
User avatar
Salad Viking
Posts: 752
Joined: Tue Apr 20, 2010 8:58 pm
Location: In high orbit

Re: Railgun attack using sprites

Post by Salad Viking »

kgsws-CZ, in the thread [url=http://forum.zdoom.org/posting.php?mode=quote&f=34&p=548502]Railgun attack update[/url] wrote:New flags:
RGF_FULLBRIGHT - makes all particles bright at dark, requested here
RGF_FLASHPARTICLES - makes all particles last only very short while, usefull for flashes

RGF_SPAWNACTOR - instead of particles spawn "puff" actor each maxdiff unit, requested here
Well, it looks like your request was answered. This will be really handy; a lot easier than using FastProjectiles.
User avatar
rollingcrow
Posts: 733
Joined: Tue Mar 02, 2010 8:30 pm
Graphics Processor: nVidia with Vulkan support

Re: Railgun attack using sprites

Post by rollingcrow »

So this could be possibly used to make bullet tracers?
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Railgun attack using sprites

Post by NeuralStunner »

Se7eNytes wrote:So this could be possibly used to make bullet tracers?
Don't see why not. Generate the random angles beforehand, then pass them to each function along with flags to use a set angle.
User avatar
Salad Viking
Posts: 752
Joined: Tue Apr 20, 2010 8:58 pm
Location: In high orbit

Re: Railgun attack using sprites

Post by Salad Viking »

Se7eNytes wrote:So this could be possibly used to make bullet tracers?
I don't think so. This behaves just like a railgun, i.e. the whole trail is instantly there, but what you're looking for is a moving projectile. Just do the shock rifle thing and fire a tracer projectile at the precalculated angle of the hitscan attack.
User avatar
Z86
Posts: 101
Joined: Mon Jan 24, 2011 5:22 pm

Re: Railgun attack using sprites

Post by Z86 »

Hmm, glad to hear it has a good chance of getting in.

Tracer is probably better with the FastProjectile, or depends on what look you're aiming at with the effect.

I found another good use of this: lightning gun like weapons, they can now enjoy all the goodness of being hitscan.
User avatar
pieceofpiesoftware
Posts: 66
Joined: Sat Feb 05, 2011 2:17 pm
Location: United Kingdom

Re: Railgun attack using sprites

Post by pieceofpiesoftware »

I would have a laser sprite going fast as the main projectile, having a puff that is identicle sprite tracing behind it with 1 less speed and so forth.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”