Star Citizen: Bugsmashers - Episode 29
Transcript — every row opens the video at that moment
- 00:00:08
hey everyone welcome to bug Smashers uh I guess I have to finally smash bug I've been busy catching Pokemon and the good old asteroid builds of yellow but that's all done time to play some Pokemon oh fine we'll do a bug after this just one more okay two more hold on I got to go get one I got to right bug [Music] species hey everyone we are here in fancy Dan test level with all my debug textures oh no up and I fell off so what we have here is with our um lovely programming art for the interaction system yes this is totally programming art um so if I get back into
- 00:00:58
my ship with all the fun inner thought systems we have a situation where if we're normally in the cockpit we could use a bunch of these interactions which is pretty cool however when I put this ship in Flight ready and I begin to fly around and you can see the Shadows move so that indicates that I'm flying around um working on getting the HUD fixed in you'll notice that when I look at any of the interaction points uh it's they're not working I can't actually use anything and this is a fun little frame behind bug um what's happening is every
- 00:01:48
frame um we're shooting out a ray and we're trying to capture what we're hitting in the the vehicle um our interaction system uses actual physical location ation so you shoot a ray you hit the physics and you go is there an interaction point on this yes display all the interactions you could do open close restart you name it uh but unfortunately um our physics and our game code kind of run independent of each other in the way that physics is doing its own thing um and the game code does its own thing and once in a while they get into sync however um when we do this Ray Trace uh we are actually queuing it up on the game side and then dispatching it at a later time fortunately the time when we dispatch
- 00:02:38
the ray is when uh physics and the entity system are kind of in sync but unfortunately um because the game side caches all the information and you may get that Ray a frame or 10 later um our positions that we sent so if we go over to here um uh might be wrong so say I'm in the game code I'm doing something and it's time to fire ARR all right I get the player position get everything where he's at uh send up some Ray properties right here and I basically cue the ray which is cool except this position is behind as soon as um the queue decides to hey go hey I'm going to fire this off
- 00:03:26
so I could do an array wait 5 minutes it'll do it however the position is here and my ship is way back there now so what we're going to do is basically move all this code so undo all things we're going to put it into a new function and what this does is when our deferred Ray Caster is about to submit our Ray tracing information to the um the physics system um that's when we get our actual information and we could abort out in case things went wrong um so I want to do an array I tell the um what do you call it the the Ray Caster Hey whenever you're free let me know when it goes hey it's your time to
- 00:04:14
shine uh give me all your information and it sends it off now in theory this would be fine but then we have to deal with another problem where again with the physics system we we have the player and the vehicle and they're two independent things what that means is when the game code snaps the player onto the seat of the ship at this point in time they're they're one uh you could think of them being basically in the same area however um when physics starts simulating the player actually has no velocity or anything cuz his position is getting set to the seat but physics doesn't know that so he stays behind but the ship has velocity and acceleration so it
- 00:05:01
continues on so our poor player is stuck here until um the game code comes along and says you should be here uh kind of crappy but uh we have a solution for this called the zones or the grid system and ideally the ship would have a grid and when we stick the player in there when the ship moves the player moves uh cool however not all of our ships have a grid uh like our Legacy ships like the Hornet or basically the one-seater ships it's like do they need a grid do they not need a grid the bait's going back and forward maybe we need a grid because we want particles to fall down relative to you know you where you were at um but at the same time it's like is it worth the cost benefit so as the debate goes on between whether or
- 00:05:48
not we install a grid we have to support both systems so this bit of code Works nicely if you're in a Zone relative to the ship so what we have to do now it's kind of similar to the projectile fixed a long time ago where if the actor and the vehicle are not in the same grid basically this snazzy thing and the player is attached to a seat uh basically this snazzy thing we want to get we want to basically start rebuilding all the information so we know that the positions are off the world positions are off or the Zone positions but we know the local Transformations are correct so we know the player is going to snap to a seat and the seat's going to snap to uh the
- 00:06:37
vehicle so what we could do is build all of our local Transformations so this first part is basically this the distance between the seat and the player and then the rest of this is basically the seat to the vehicle or if the seats on another item within an item we can build the hierarchy once we have the local position basically where the player is is relative to the ship we could ask physics what the vehicle's current position and this will be the actual player position if we multiply by the local offset so we rebuild everything get the real vehicle position for where physics thinks it's at rebuild it and now we know the player is here and from that we know the player's eyes relative to him so we can use that same Matrix to basically rebuild our position
- 00:07:28
so that we're in the actual location and with that set up I could hit recode and wait all right recode's done so now I'm flying around let's get our shadows moving so you can see the movement there we go and when I look around if I let go of the mouse I'm still able to look at um the interaction point for the engines off same thing for the power on on and the open exterior so there you have it uh fixing all the fun things you have to deal with when you have multi-threaded systems and independent ordering and all this chaos hope you guys enjoyed until
- 00:08:15
next time we always have these fun little things when riding games where you know you have multiple systems and they work different which ways you know you have physics doing one thing the game code doing another thing they're working independently and then you have to find ways to um you know find the areas where they intersect so that you could do the right calculation at the right time then you also have updating you know when you when can you update in the game code pre post now later so you just have to find the right set of sequences so that if you're trying to do an interaction in a ship you're making sure that the player in the position is exactly where the physics thinks it is and where the game thinks it is so that you could up with a little text box saying hey open your canopy hope you guys enjoyed um until next time
- 00:09:27
woo
Transcript from YouTube’s automatic captions — punctuation and Star Citizen jargon are approximate. The video itself is hosted by CIG on the official channel.

