Data Realms Fan Forums http://forums.datarealms.com/ |
|
Everything pew pew http://forums.datarealms.com/viewtopic.php?f=1&t=31454 |
Page 1 of 1 |
Author: | god froggy [ Mon Jul 16, 2012 5:37 pm ] |
Post subject: | 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. |
Author: | Asklar [ Mon Jul 16, 2012 7:51 pm ] |
Post subject: | 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. |
Author: | god froggy [ Mon Jul 16, 2012 9:25 pm ] |
Post subject: | 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 ![]() |
Author: | Denninja [ Mon Jul 30, 2012 4:38 am ] |
Post subject: | 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. |
Author: | Asklar [ Mon Jul 30, 2012 6:17 am ] |
Post subject: | 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. |
Author: | Arcalane [ Mon Jul 30, 2012 6:08 pm ] |
Post subject: | 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. |
Author: | xenoargh [ Mon Jul 30, 2012 6:21 pm ] |
Post subject: | 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 ![]() |
Author: | Roast Veg [ Mon Jul 30, 2012 6:24 pm ] |
Post subject: | Re: Everything pew pew |
Not pixels, glows. It's the glows that really lag out the business here in this instance. |
Author: | xenoargh [ Mon Jul 30, 2012 6:52 pm ] |
Post subject: | 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 ![]() |
Author: | Roast Veg [ Mon Jul 30, 2012 6:58 pm ] |
Post subject: | 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. |
Author: | xenoargh [ Mon Jul 30, 2012 7:14 pm ] |
Post subject: | 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 ![]() |
Author: | Shook [ Mon Jul 30, 2012 7:15 pm ] |
Post subject: | 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. |
Author: | xenoargh [ Mon Jul 30, 2012 7:25 pm ] |
Post subject: | Re: Everything pew pew |
Hmm, I'll have to try that out; was wanting to do some lightning weapons. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |