Star Citizen: Bugsmashers - Episode 38
Transcript — every row opens the video at that moment
- 00:00:06
[Music] hey everyone welcome to bug Smashers I'm your host Mark aent I'm a gameplay programmer here at cig Los Angeles and I take you behind the scenes of some crazy bugs and funny bugs that play our game and it's just a lot of fun to show you guys what's happening so let's take a look box species hey everyone we're here in my fancy dcy test level again and I have a little Hornet here uh just rotating freely and as you can see all the turrets on this guy are just spazzing out they're just going
- 00:00:55
bonkers and the funny thing is if um I actually rotate the turrets they're fine it's just as soon as you stop rotating they kind of snap back to the old position and they're just going crazy uh so what's happening well uh let's take a look at the code uh here we are in the turret code which hasn't been touched in quite a while and what we do is for all the axes you know pitch um yaah or even roll um we want to move uh those bones to try to aim towards a Target so if we have a point here we want the turret to rotate and look at it and if it's down here you know we want to rotate it there so uh we have for each of our axis a current angle and then we have this
- 00:01:45
thing called the original rotation so if this is the original rotation and we up here we move this way so we basically start here and then from our current angles we move any which way we need to go so that's what this bit of code right here does and since we're modifying a joint or a location on a skeleton um so there's these bones on a skeleton and that's what you use to move like my arm there would be a joint here so I can move it up and down same thing on a turret there's going to be a joint for pitch and a joint for um yaw and so after we do that calculation of how much we want to move it uh we now have to tell the skeleton to move to that location and and this um functionality right here basically says uh after we're
- 00:02:34
done animating we're going to inject this um rotation so the chir can animate you know deploy down you know it has animation maybe deploy down and then as it deploys um it'll play the animation for moving up and down and then we'll do our rotation uh this is some old code that we've used for a long time and all of a sudden it decided to break because in the back end uh for our animations we there was a lot of um steps to optimize it um buffer it so that the main thread could do something while the threaded thing could do something and then they're supposed to sink and in between that time uh this process kind of broke and the unfortunate thing about this guy is after the animation has done its
- 00:03:23
thing on a separate uh thread we then modify the pose on the main thread so it's actually a little bit taxing on the system now there's this new thing or this thing that's been supported for a while just we haven't used it is this thing called animation pose and what this thing allows us to do is in the actual thread that's where we modify the bones we'll actually apply the rotation so instead of updating this old Legacy thing which is now broken uh we have this uh new thing which we could act upon uh here it is our our aim uh pose and we could directly say all right here's the rotation that we want so whenever you do the animation
- 00:04:13
task um in the back or thread will assign the rotation and it will happen in the thread so even if this doesn't happen right away because maybe it's not visible or maybe it's you know Far Far Away um whenever it actually gets processed it will then remember the value it wanted and then go and process it so we're going to use this bad boy now and as you can see here is our actual implementation where we can inject position orientation and then um whenever uh the thread is getting ready we basically say all right we're going to switch over and then once the thread is in here we generate our task and compute the actual um rotation orientation or even both set by the
- 00:05:02
turret or some other system so let's activate this guy and disable the old system now we do want to keep this line which will allow um the rotation to happen even if it's not visible that's mostly for gameplay reasons so if you can't see the guy behind you you still want to know which way he's shooting instead of you know shooting out the wrong way so this will at least Force um those locations to be updated all right so let's hit the magic recode button that recode is finished before we go in I just want to show you uh this little bit because the bones can be actually on different um characters because of Legacy reasons we need to make sure that we only inject this pose modifier once per frame otherwise things
- 00:05:50
get funky anyway uh so now we're back in the game and I can move my turrets all the way around and if I let go of the mouse you'll see that they tend tend to stay in the location that they were last set except the top uh the turrets and the bottom turrets they're kinding to aim at the point that I last specified because they're trying to aim um where I am looking on the screen and as I rotate they tend to rotate as well but they everything fires okay and they're not twitching around like crazy everything's good to go hope you guys liked it so as you guys saw we had a little issue where the turrets were jiggery jagging all around and it was just because we're using an old outdated method that wasn't working with our new
- 00:06:39
streamlined um double buffered um command system for animations and because the two systems didn't play well instead of retrofitting the old system decided to use the actual new system which is these things called POS modifiers which when those animations happen we can um say that these specific joints you know arms or these turrets supposed to be doing some sort of action or rotation and because of that now when everything all animates our turrets rotate nice and smooth they're not doing that crazy Jitter everything looks gorgeous and it just looks that much awesome and we're using the whole new system in the thread so everything works out getting a little bit of performance hope you guys enjoyed until next time thank you for watching so if you
- 00:07:27
want to keep it with the latest and greatest and Star Citizen and the Squadron 42's development please follow us on our social media channels see you soon
Transcript from YouTube’s automatic captions — punctuation and Star Citizen jargon are approximate. The video itself is hosted by CIG on the official channel.

