Back to search

The Orion mining ship has a larger laser for dissecting asteroids into smaller chunks. How do you implement a continuous beam weapon like that? Is it mostly animation while using an ultra high rate of fire and ultra low DPS? Or is it an actual beam?asked by Duke Dirty Work

TL;DRA beam weapon would be done by raycasting every few milliseconds and stretching the effect's vertices to the ray length, not a continuous rate of fire; the game code is nearly done and only the visual effect is still needed.

This is actually a really really good question. This comes up a lot in games where you're gonna have a pulsed laser that's really just a glorified machine gun or if you have a beam laser weapon and as everyone knows we don't have a beam weapon within Star Citizen yet. We solved this problem on an earlier project that I had worked on, a little modding project called Mechwarrior: Living Legends. They weren't continuous beams but they were there for quite some times so the problem you've got to solve is not necessarily having a long beam because we have different levels of ray casting we can do.

But continuous segments where you know where to break the beam so you know where it stops when raycasting hits its location.

Exactly. That's right because we've gotta show it somehow. We've gotta be able to one off the geometry so it looks good and second we've got to be able to change the length of that geometry. Now does it make sense to have one piece of geometry...

That just draws until it hits a distance.

That's two kilometers long well think of the bounding box of something like this right? So that's gonna cut out when you look away so that doesn't work really well. So what we did on the Mech Warrior project is we had segments of lasers that would just be[Draws lines with his hands that stack on top of each other]

That just kept stacking on top throughout and then leaving and stoppedST: Stacked on top, but then you've got other problems with that, that comes to do with draw calls so you've got one object, two draw calls, another object, two draw calls.

What happens if they're all one meter?

Two objects, another draw call and if you've got 2000 meters of that.

Kilometers or something, what happens.

Exactly. So the best way to do something like this is not necessarily to have a continuous rate of fire, is to do that raycast, you do that ray check every couple seconds, every couple milliseconds, not every frame because there's no reason to do it every frame, but to actually extend those verts you control the verts on the effect itself so it does the exact same length of that ray and then you grab those few verts and if you move it back, move it forward, move it back, move it forward.

Just kind of already how our projectile system works currently. For those that don't know, in the original trailer I made a bunch of particle effects and then I gave them damage and physics and all that stuff, but once we actually came out with Arena Commander and needed a more sophisticated solution to support networking and all this stuff right. We decided to switch from just a particle effect over to a cylinder, a capsule and then that capsule that would draw and shrink depending on its velocity and all these effects and then we would attach a particle effect on top of that including with an additional glow shader. So we rendered the capsules as type of glow which we have all these shader effects on it, then we can also attach a particle effect on top of that for additional effects and then the verts actually can move and stuff.That's gonna be a super fun gameplay trick, I'm really looking forward to that.

It's gonna be a neat effect yeah and actually what's really cool is we already got all the actual weapon fire, weapon type, we've got that all in place, all the code in place and it's really a matter of having the visuals that come alongside it. There'll be cool things like when we have scrap or when you're trying to pull out minerals and things like that from a ship.

When you're trying to get... We're calling it scrap or something like this?

YeahST: But we're gonna need a beam weapon for that.

We're gonna need some sort of beam for repair. We're gonna need some sort of beam for mining, so we need this beams anyways and again the game code is pretty much done for that, we just need a nice effect so that's kind of next up for some of the VFX guys.

Yup, alright. So that's gonna be... I'm looking forward to what the team comes up with that one because we're getting close I think.

10 for the Developers›Episode 08·
Published on this date.3 May 2016