Railgun CVars for Better Performance

Moderator: GZDoom Developers

Post Reply
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Railgun CVars for Better Performance

Post by Spleen »

Hi everyone, this is my first code submission, so please don't murder me if I did something wrong! I will be happy to go back and fix it if I did.

I added 2 cvars for the rails (shot by both humans and monsters) to improve performance for people who are experiencing large frame rate drops when rail shots are spammed. This happens a lot in GZDoom's GL renderer but I am guessing it would also happen for people with old computers who are playing with the software renderer, so I submitted it here and not there.

-r_rail_sparsity - Increases the "sparsity" or decreases the density of the rail particles, the higher you set this. This works like a quotient, so 2 will halve, 3 will divide the amount of particles by three, and so on. Default is 1, and values below 0 do nothing. The spiral starts looking ugly if you have this set to 4 or higher, but you can turn it off :) However a value of 2 won't change the appearance too much, but will probably double performance =P
-r_rail_spiral - Toggles the railgun spiral. Default is "true", and "false" forces the outer spiral off to improve performance.

Only p_effect.cpp is modified by this change.


[edit: Oh yes and I forgot to mention that this will allow you to see more railgun shots with the same amount of maxparticles!]


[edit: updated! look at last post!]
Last edited by Spleen on Sun Dec 28, 2008 5:57 pm, edited 3 times in total.
User avatar
Cutmanmike
Posts: 11354
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Re: Railgun CVars for Better Performance

Post by Cutmanmike »

Spleen wrote:-r_rail_spiral - Toggles the railgun spiral. Default is "true", and "false" forces the outer spiral off to improve performance.
Is that true? I didn't think it would have any performance nags.
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: Railgun CVars for Better Performance

Post by Spleen »

Cutmanmike wrote:
Spleen wrote:-r_rail_spiral - Toggles the railgun spiral. Default is "true", and "false" forces the outer spiral off to improve performance.
Is that true? I didn't think it would have any performance nags.
Forcing it off will greatly decrease the number of particles, so I assume it would improve performance.. :? Also it looks less ugly without the spiral if you set the sparsity to say, 6 :P
Last edited by Spleen on Mon Dec 22, 2008 10:50 am, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49237
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Railgun CVars for Better Performance

Post by Graf Zahl »

Only on really, really old computers... :mrgreen:
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: Railgun CVars for Better Performance

Post by Spleen »

Graf Zahl wrote:Only on really, really old computers... :mrgreen:
And laptops :P My computer is a 1.5 year old laptop with a discrete graphics card, and my FPS drops if railgun shots are being spammed (in the GL renderer). Imagine laptop people with integrated graphics! :D
User avatar
bagheadspidey
Posts: 1490
Joined: Sat Oct 20, 2007 10:31 pm
Contact:

Re: Railgun CVars for Better Performance

Post by bagheadspidey »

Spleen wrote:Imagine laptop people with integrated graphics! :D
<_<
User avatar
Enjay
 
 
Posts: 27136
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Railgun CVars for Better Performance

Post by Enjay »

It's a real shame that Intel persist with, and is getting away with, making those shoddy, sub-standard integrated graphics chips that seem to come with most laptops. I'm surprised there hasn't been more pressure put on them to improve. I guess most laptop owners don't care enough about that kind of graphics performance for it to be a big enough issue to make Intel change. :shrug:
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: Railgun CVars for Better Performance

Post by Spleen »

bagheadspidey wrote:
Spleen wrote:Imagine laptop people with integrated graphics! :D
<_<
???



Enjay wrote:It's a real shame that Intel persist with, and is getting away with, making those shoddy, sub-standard integrated graphics chips that seem to come with most laptops. I'm surprised there hasn't been more pressure put on them to improve. I guess most laptop owners don't care enough about that kind of graphics performance for it to be a big enough issue to make Intel change. :shrug:
Dedicated graphics produce more heat, so I'm not really surprised, considering fans take up space and weight and many laptops are already prone to overheating.

Anyways what exists in terms of hardware is what exists, and these 2 addition to the code are there to help these people have a more playable experience (lowering the resolution doesn't always help too much with particle spam frame rate drops in GL mode, dunno about software).
User avatar
edward850
Posts: 5890
Joined: Tue Jul 19, 2005 9:06 pm
Location: New Zealand
Contact:

Re: Railgun CVars for Better Performance

Post by edward850 »

Spleen wrote:-r_rail_spiral
Problem. If the rail shot was made to only have an outside spiral, this (set to true) will make the shot invisible.
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: Railgun CVars for Better Performance

Post by Spleen »

edward850 wrote:
Spleen wrote:-r_rail_spiral
Problem. If the rail shot was made to only have an outside spiral, this (set to true) will make the shot invisible.
What kind of rail shot would have only an outside spiral??

But I can try to add in an r_rail_spiral 2 option which disables the outer spiral only if there is an inner rail to be drawn.
User avatar
Enjay
 
 
Posts: 27136
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland
Contact:

Re: Railgun CVars for Better Performance

Post by Enjay »

Spleen wrote:What kind of rail shot would have only an outside spiral??
I'm pretty sure that it is possible to set it up that way, and I'm even pretty sure I've seen mods use it that way. Just because it's called a railgun, it doesn't mean it has to be getting used as a railgun. It could be for a magical attack or whatever. ;)

As an aside, I'm still quite surprised that the railgun makes such a difference to frame rate. You said that the problem was mainly in GZdoom. In GZdoom, there are a few (3 I think) options for how to render particles. Do these make any difference to the frame rate drop?
User avatar
Spleen
Posts: 497
Joined: Fri Nov 28, 2008 7:07 pm

Re: Railgun CVars for Better Performance

Post by Spleen »

Enjay wrote:You said that the problem was mainly in GZdoom. In GZdoom, there are a few (3 I think) options for how to render particles. Do these make any difference to the frame rate drop?
It only makes a slight difference. The slowest are the smooth ones, squares are in the middle, and the fastest are the round ones, but only about 10-20% faster than the smooth ones. I should actually try this modified railgun in GZDoom and see if I get the performance increase of several fold that I'm expecting :P Unfortunately I don't have a slow computer to test ZDoom software mode with.


edit: I made an improved version which solves Edward's issue and allows you to control rail and trail sparsity seperately

r_rail_smartspiral - set to 1 to turn off spiral ONLY if there is no inner trail (that is, if inner trail color == -1) - this solves Edward's complaint =P (default 0)
r_rail_spiralsparsity - 0 or below turns off spiral, otherwise controls just spiral sparsity (default 1)
r_rail_trailsparsity - 0 or below turns off trail, otherwise controls just trail sparsity (default 1)

Set spiral sparsity to 2 and trail sparsity to 4 for better performance without it looking reallly bad. :ugeek:
Attachments
p_effect.cpp
(17.05 KiB) Downloaded 41 times
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49237
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Railgun CVars for Better Performance

Post by Graf Zahl »

added
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”