View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:47 am



Reply to topic  [ 13 posts ] 
 Everything pew pew 
Author Message

Joined: Mon Dec 27, 2010 3:45 am
Posts: 33
Reply with quote
Post Everything pew pew
I've just started modding and I was wondering if somebody could explain laser weapons, as in the ones that have no travel time such as Unitec's IC1 or W40k's various las weapons.

Many thanks.


Mon Jul 16, 2012 5:37 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Everything pew pew
Those are completely programmed in lua.

When firing the weapon casts a ray, if I'm not wrong, an ObstacleRay. Then, at the end of the ray, where it met the obstacle, it creates damaging particles (for example, AEmitters that explode when created).

For additional aesthetics, glowy pixels are placed on the vector.


Last edited by Asklar on Mon Jul 16, 2012 9:56 pm, edited 1 time in total.



Mon Jul 16, 2012 7:51 pm
Profile

Joined: Mon Dec 27, 2010 3:45 am
Posts: 33
Reply with quote
Post Re: Everything pew pew
Thanks a lot, at least I know where to look now, but it'll probably be a while until I can understand them :-(


Mon Jul 16, 2012 9:25 pm
Profile
User avatar

Joined: Fri Jul 27, 2012 5:37 pm
Posts: 23
Reply with quote
Post Re: Everything pew pew
Would this usually have a lot more graphical strain than a mock-up laser using particles and glows?
I know some ray-based lasers lag for me.


Mon Jul 30, 2012 4:38 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post Re: Everything pew pew
This generates some lag, but there are many optimized versions to reduce it as much as possible (like one Mehman coded which was very complex though nearly lagless).

You can, of course, do it the old way and create a laser rifle like the one in Base.rte, just a simple pixel fired at very high speeds with a huge trail. The only con of that is that it's very hard to get good glow effects on it.


Mon Jul 30, 2012 6:17 am
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Re: Everything pew pew
As far as I can tell, most of the slowdown stems from the amount of glows involved -- a single MORay or ObstacleRay trace to find a target is pretty simple and lightweight, relatively speaking.


Mon Jul 30, 2012 6:08 pm
Profile YIM

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Everything pew pew
Yeah, it's the sheer number of MOPixels that get generated; this is one of the many reasons we need a particle effect that doesn't actually interact with anything else :-)


Mon Jul 30, 2012 6:21 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Everything pew pew
Not pixels, glows. It's the glows that really lag out the business here in this instance.


Mon Jul 30, 2012 6:24 pm
Profile

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Everything pew pew
If that was true, then lasers emitting a lot of particles would cause very little lag off-screen. Test it out, I think you'll find that it's almost irrelevant whether they're on-screen or not.

Each glow does some alpha blending, but unless that was coded very poorly, it's usually not taking up enough screen to bother a modern GPU at all :-)


Mon Jul 30, 2012 6:52 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Everything pew pew
I'm not saying particles don't cause unecessary lag, I'm just saying that for lasers like this, the glows cause more on most machines.


Mon Jul 30, 2012 6:58 pm
Profile

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Everything pew pew
Hmm. They shouldn't, though; while alpha's not free, it's pretty cheap and we're not talking a lot of quads here, I'd think. This engine's really puzzling sometimes :-)


Mon Jul 30, 2012 7:14 pm
Profile
User avatar

Joined: Fri Feb 16, 2007 8:43 pm
Posts: 1695
Location: AH SHIT FUCK AUGH
Reply with quote
Post Re: Everything pew pew
I've found that it's primarily the glows causing excessive lag as well. Even running dozens of raycasts per frame doesn't do a whole lot in terms of frame rate, though obviously the spawning of hundreds of particles can and will cause a slowdown. This is only worsened if the particles glow as well, since i've optimized many of my super glowy weapons by... Well, removing the glow. It has a surprisingly large impact on frame rate.

A viable alternative in this case would be MOSParticles, since they're just sprites with the hitbox of a pixel, and generally don't cause much more lag than an MOPixel. They can't do partial transparency, however.


Mon Jul 30, 2012 7:15 pm
Profile WWW

Joined: Fri Dec 30, 2011 3:33 am
Posts: 276
Reply with quote
Post Re: Everything pew pew
Hmm, I'll have to try that out; was wanting to do some lightning weapons.


Mon Jul 30, 2012 7:25 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.052s | 13 Queries | GZIP : Off ]