Railgun attack update
Moderator: GZDoom Developers
Re: Railgun attack update
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.
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.
Re: Railgun attack update
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.
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.
Re: Railgun attack update
Ok, here is new patch for latest svn revision.
- Attachments
-
railgun.zip
- (25.54 KiB) Downloaded 61 times
Re: Railgun attack update
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:
Anyhow, the patch:
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.
New Flags:
- RGF_FULLBRIGHT: Makes all spawned particles fullbright.
- 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.

Anyhow, the patch:
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.

- 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
Hooray! 

- DoomRater
- Posts: 8270
- Joined: Wed Jul 28, 2004 8:21 am
- Preferred Pronouns: He/Him
- Location: WATR HQ
- Contact:
Re: Railgun attack update
Sweet I can make a super ripping chainsaw now? One that'll cutthrough everything in front?
Re: Railgun attack update
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.
Re: Railgun attack update
Wow, a customizable railgun attack would be really kickass! Definitely looking forward to this.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49231
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Railgun attack update
Oh, I didn't even notice that finally a patch was available that works...
Added.
Added.