This post is a transcript of BugSmashers – Episode 14, material that is the intellectual property of Cloud Imperium Games (CIG) and it’s subsidiaries. INN is a Star Citizen fansite and is not officially affiliated with CIG, but we reprint their materials with permission as a service to the community. INN edits our transcripts for the purpose of making the various show participants easier to understand in writing. Enjoy!
BugSmashers – Episode 14 – Transcripts
Hey everyone, welcome back to an exciting new episode of BugSmashers. Before we begin I heard some exciting news. We’re getting a new Star Trek! It’s going to be on CBS on-demand but it’s a new Star Trek! Hopefully, you know, the reboots all coming out and about, you know Star Wars and all that fun stuff, probably never going to get a Firefly but, we might get another seaQuest – ahhh yeah, that’s gonna be good. Don’t judge me Randy. seaQuest, out! Eh? Eh? No? Come on? Aw…
Hey everyone, we are here in our fancy-dancy… Mark’s test level, yay!
So I’m in a Retaliator and I am looking at a optimization that we can do with the HUD raytrace. Pretty much all the raytraces we’re doing with our ships. So let’s step into our fancy-dancy visor code, depending on where the player is looking, it will send out a trace to kind of see where to try to converge all your weapons all onto that point.
That’s if they have gimbals and this is our beautiful ray world intersection or raytrace test and we basically shoot it out every frame, like I said, to try to hit this little point with all your big-ass guns.
Now unfortunately, when I do this trace… so let’s hop back into the game. We have to send in something called a skip list. So what the skip list is, is basically we want to ignore certain physical things. So if this is my beautiful ship, and I’m a little sticky note of a player, when I’m shooting out my ray, I might be intersecting the ship a little bit and now my guns are going to try to point at the ship. We don’t want that, so instead, we have to send in that little skip list to say “hey, skip my vehicle and continue on.”
So that’s what this beautiful little thing does right here is we send in a bunch of physical entities to say “hey, skip this when you perform the trace and find other things,” and unfortunately our skip list has 121 things inside of it, which is not pretty good to do every frame since we have to rebuild the skip list, so let’s go… here we are.
So every frame we’re adding the ship’s physics, every actor, and every children. And these children are basically inside our Retaliator – we have, like, dozens of entities that control the doors opening, some brushes, a bunch of things to make it look beautiful and interact-able inside. Unfortunately, we’re adding all those, plus all the players, and as you saw, we’re at 121.
Unfortunately our limit is 128, and we don’t want to be sending all this stuff every frame where there’s dozens of other places that do the same test; it’s very, very expensive. So, what I have done, and what I’m going to do now, is we basically don’t need to skip these things; goodbye! And the player is another one, so we’re gonna get rid of that and the vehicle, and the player is actually going through all his item ports and adding his weapons and gear all into the skip list.
Thing is, those items don’t have physics, or if they do have physics, they’re part of the player physics, so we’re basically adding the player physics multiple times. So we don’t really need this part, and this is the only exception that we’ll need to have *burps* oh, excuse me. This is for if the player picks up something, we don’t want, you know, that thing to be in the test, so we’ll skip whatever he’s picking up. So the player should just skip his physics – so an actor, it will skip his physics and his ragdoll physics – that’s what both of these guys are – and ideally, the vehicle will just skip itself.
So let’s go back to our lovely visor code, and lucky for us, we already have this global grid setting on here. What this means is, we’re going to do the global grids, so here’s my ship, and out here is the global grid. So we’re going to ignore basically the innards of the ship, and we don’t care about its door inside because we said this is the global grid, we’re going to trace against the outside. In that case, we only need to trace against – er, I’m sorry – send in the skip list of the vehicle and the actor himself and nothing really else, and then now, we still get the same result.
So if I hit re-code… oh no! Re-code has failed us, so we have to do a regular code, compile, yay! Alright, there so that magical re-code button worked, so now I’m going to put my breakpoint on, and as you can see, we only have three things to skip: We have the vehicle physics, and my physics, and the ragdoll physics. So we have basically optimized a fun little raytrace – awesome!
There were some other things that I have done as well, which I can show you real quick. So that’s well and good, but there maybe some times where we have to trace for certain things, or if we want to skip certain things while we’re still in the grid. So we have that global grid setting which means we’ll just ignore everything but the — we’ll ignore the insides but we’ll get the outside. And what I have done too is, in the interiors and on the vehicles, I have added, basically… actually, where is it? I think I put it… let’s look for that bad boy.
There you are. So in some instances, we still wanna do the trace but we wanna do it locally to the grid and… but we may want to still ignore the inner collision, but we want to get things like, I don’t know, maybe another ship and a ship. So we could say, “hey we’re the vehicle perform in this trace, but I want to ignore the insides and all the players.” Or you could just say “I want to ignore – I’m the vehicle and I’ll ignore all the players.” Or maybe you want to keep all of them. The next thing you could do, is you could actually put in which grid you want to specify. So If I’m inside of here, we don’t need to necessarily test everything out here if I have, say, a weapon. I just want to test the insides so I can tell the ray world, “hey, just test for this grid.”
So we’ve done a lot of optimizations to our traces so it’s not all general – it’s more “what do you want to do, how do you want to do it” – work for that problem. If we make it too general, you’re going to have a problem, like, we’re adding everything into this big skip list, when we don’t need to do that. And, you know, performance-intense when we’re performing some of these rays per frame. So hope you guys enjoyed my fun little spaceship, and… cool!
So as you can see in this episode of Bugsmashers, we’re doing some optimization where raytraces finally got around to doing some of that stuff and this was pretty much what we call “Code Cleanup Fridays” where alright, we have some fun little code that’s not as good as it should be, so on Fridays, we’re tasked to go and clean up those little bits, and it comes into a little fun thing cause it’s like, “hey, I got this thing running for production, it’s not as best as I want, but on Code Cleanup Friday, I’m going to make it better because I get to have that time to do what I need to do.” I hope you guys enjoyed, and I’ll see you guys next time!
This video made possible by the ICC Stellar Surveyors and subscribers like you!