Social Media
Follow us, or not!

As per usual, anything said during the show is subject to change by CIG and may not always be accurate at the time of posting. Also any mistakes you see that I may have missed, please let me know so I can correct them. Enjoy the show!

TL;DR (Too Long; Didn't Read)

In Star Marine when you have all your weapons fully loaded out, so no more slots and you walk up to another weapon while looking down the ironsights and hit the use key to pick it up, you get thrown out of the universe.

This was caused by a glitch in the FOV when you transition to the player’s FOV to the ironsight FOV and it resulting in zero FOV

Full Transcript

Hey everyone, we have quite an interesting bug today. I’m going to actually show you guys the video before I even get into the game, I think you guys might like this one. So, oh let’s pause it. What’s happening is in Star Marine if you have all your weapons fully loaded out so you have no more slots and then you zoom in, you walk up to another weapon and you hit the use key to pick it up, this is what happens. Wham, he’s going up to it, use it and zoom. Now he has an out of body experience.

Apparently using the weapon takes you out of the universe, let’s do that again cause that is awesome. Play… gonna use the weapon and I’m out of there. Good fun time, now let’s start up the editor and unfortunately this bug really depends on your CPU and whether or not you hit it. It’ll either get this crazy out of body experience or your helmet will just get really close and looks kinda weird. As the editor loads, I can show you the offending bits of code.

So, in the actor or the player we have this view component which is in charge of how the camera is affecting him FOV, distance, location and etc. When it comes into this little beauty it supposed to take the FOV and move the camera back a certain distance based on that and when you have zero FOV it’s supposed to just have no offset. It’s just where you are but as you get closer and closer to zero… it’s going to just drastically go insane because of this beautiful bit right here. Actually I’m sorry, this beautiful bit right here, a little combination of these two.

So we take our FOV, we do tangent and tangent is zero going to give it zero but as you get closer and closer to zero, it’s going to get zero but this is basically going to be a really, really small number. Something larger than zero but less than one and when you divide by a number it’s just going to grow and I can prove that for you. If I have that value 13 if I divide by 1, I get 1. If I divide by a really small value I get a huge, huge value and as you can tell the smaller and smaller I get, the large the value I’m going to get.

So when we have our FOV and our Iron sight and all that fun stuff. What’s going to happen is we’re going to warp between the value you want to and the value we want to go to. So, if we have 55, and we want to go to 0 it’s going warp in between that, So between 1 and 0 you’re going to get this exploding value that just goes bonkers. If you have a fast CPU, you might go from 1 to 0 instantly. If you have a slow CPU, you might from 1.8, 0.5, 0.3, 0.2 and etc.

So unfortunately this bit of code right here will just explode and with iron sight, beautiful iron sight we have an endzoomFOVscale which sets it by default zero. So when you’re in iron sight and you get out, it transitions to zero and if you’re on an FOV that you want to get to. I don’t know, you’re on 55 now this thing is telling you to go to zero you’re going to do that warp and then it’s going to be a big expansion.

So, let’s hop into the fancy, dancy test level of mine. We’re going to plop down some beautiful weapons. We’ll plop down… where’d it go, give ourselves a rifle, give ourselves an energy weapon and do two of those. Change our loadout… so we already have weapons. So now we have some weapons, we’re going to zoom in and grab something. Let’s try grabbing another guy, come on, you know you want to break, nooo.

So, as you can see I’m not able to really get the issue because my machine just so happens to be special but if I were to have the issue, it would be this beautiful longevity thing. So all right, what is the fix, simple. Our FOV scale should actually default to 1 and in here we should really be checking to see if we are less than 1 because anything less than one FOV doesn’t really make sense here. If we’re 1 we should just return… might want this 13 offset because that looks like the default, nah we’ll just keep it as 0 offset. I mean if we ever get to 1, we should not be exploding the camera.

So, we’ll hit recode, in theory we should never have that FOV but because of this endzoomscale it was modifying the FOV to 1 over 0 and that caused everything to go bonkers and if you recode, everything will work out fine. We have to watch it again, I’m sorry, this is just great. It’s one of those bugs you don’t want to fix but you have to. All right, so now we have the safety check so if we’re less than 1 it’ll just keep the camera there and you won’t zoom out. The FOV will still be a little bit bonkers, if anything we should probably add an assert and the iron sight will no longer cause the FOV to be 0 because we now default to scale. Hope you guys enjoyed, til next time.

So, as you guys saw we had a pretty crazy bug there where you go pick up a weapon and the player just shoots off into space because his FOV goes to near zero and everything just goes bonkers. It was a pretty easy change to make sure that the FOV, if it gets too low we don’t run some code to stretch out the length of the camera and everything worked out good and I hope you guys enjoyed, til next time.

Moonlighting as a writer in her spare time StormyWinters combines her passion for the written word and love of science fiction resulting in innumerable works of fiction. As the Director of Fiction, she works with a fantastic team of writers to bring you amazing stories that transport you to new places week after week.