Railgun attack update

Moderator: GZDoom Developers

User avatar
FDARI
Posts: 1097
Joined: Tue Nov 03, 2009 9:19 am

Re: Railgun attack update

Post by FDARI »

The hard bit is getting to know the code. However, a good way to find out where various bits of code are, and how they work, might be to look at patches from code submissions (pending and processed); they contain file names, line references, and description of their effects.

I haven't tried that approach myself. I just did my best to locate the entrypoint, find out where the game was running, and get a feel for the general flow of code, then to browse for relevant filenames and generally follow the flow of the code. For advanced stuff, you might need familiarity with both, but most of what you'd do is so standardised that you will not necessarily have to understand exactly how it works. Understanding, however, is very useful when you try to verify your own code.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: Railgun attack update

Post by Gez »

I'm a big fan of Shift-Ctrl-F, personally.

A lot of code in ZDoom is macrofied. Trying to understand how the macros work exactly is sometimes a bit hard (especially when they call other macros which call other macros...) but is not necessary. What matter is to understand what they do and look how they're used. Generally, just looking at the existing examples is enough. The point which might still be obscure is the DEFINE_PROPERTY args format string (e.g. the "Iii" in "DEFINE_PROPERTY(poisondamage, Iii, Actor)"
or the "ZF" in "DEFINE_PROPERTY(damagefactor, ZF, Actor)"); to understand how it works you have to look at ParsePropertyParams() in thingdef_parse.cpp.
kgsws-CZ
Posts: 70
Joined: Sun Jul 19, 2009 9:50 pm

Re: Railgun attack update

Post by kgsws-CZ »

Ok, here is new patch for latest svn revision.
Attachments
railgun.zip
(25.54 KiB) Downloaded 61 times
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Railgun attack update

Post by Xaser »

So, I decided to flex my coding muscle and finish up this feature. It's got a few changes from the original version and some new additions since, so I'll go ahead and list all the stuff the patch adds:

New Flags:
  • RGF_FULLBRIGHT: Makes all spawned particles fullbright.
New A_RailAttack/A_CustomRailgun Parameters:
  • range: Maximum distance (in map units, as fixed-point) the rail shot will travel before vanishing.
  • duration: Lifetime of spawned particles, in tics. Default is 35, and a value of '0' means "use default."
  • sparsity: Distance between individial particles. Implemented as a float multiplier, with 1.0 as the default.
  • driftspeed: Speed at which particles "drift" away from their initial spawn point. Implemented as a float multiplier, with 1.0 as the default.
  • spawnclass: Actor to spawn in place of trail particles. If non-null, the specified actor will be spaced sparsity units apart instead of the usual trail. Particle-specific properties such as duration, driftspeed, and rail color are naturally ignored in such a case.
There's still one thing missing: actor spawning doesn't yet respect maxdiff yet, but I haven't added that yet because I first want to play around with improving maxdiff's behavior a bit (which I see as a separate code submission altogether). Otherwise, this should be submit-worthy, parameter names subject to change of course. I've also cleaned up the code a bit since kg's patch, so there's no more passing the entire Flags variable to P_RailAttack or hiding the fullbright information in the color attribute of particle_t (it has its own variable in the struct now). ;)

Anyhow, the patch:
xa-rails.zip
Railgun upgrade. See xa-rails.txt for test wad documentation.
(28.06 KiB) Downloaded 72 times
The zip contains a TortoiseSVN .patch along with a test wad for the curious (based on kgsws's work). Let me know if there are any issues with it -- first time making a patch here but Tortoise makes it easy enough to hopefully be Xaserproof.

Thanks for kickstarting this, kgsws. Something I've been wanting to see for a while, myself. :P
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 update

Post by NeuralStunner »

Hooray! =:)
User avatar
DoomRater
Posts: 8270
Joined: Wed Jul 28, 2004 8:21 am
Preferred Pronouns: He/Him
Location: WATR HQ
Contact:

Re: Railgun attack update

Post by DoomRater »

Sweet I can make a super ripping chainsaw now? One that'll cutthrough everything in front?
User avatar
Enjay
 
 
Posts: 27067
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Railgun attack update

Post by Enjay »

Very much looking forward to being able to use additional flexibility with the railgun. I really like the possibility of being able to have a fullbright rail and the new enhancements all sound very nice.
User avatar
hfc2x
Posts: 646
Joined: Mon Aug 17, 2009 11:37 am
Location: Chule

Re: Railgun attack update

Post by hfc2x »

Wow, a customizable railgun attack would be really kickass! Definitely looking forward to this.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49231
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Railgun attack update

Post by Graf Zahl »

Oh, I didn't even notice that finally a patch was available that works...


Added.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”