This post is a transcription of Bugsmashers 40, 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 and transcribe their materials with permission as a service to the community. Enjoy!
Hello everyone and welcome to bug smashers!
I’m your host Marc Abent, and I’m a gameplay programmer here at CSG Los Angeles and I’m here to show you behind the scenes at some bugs and how we smash them. Let’s take a look. Bugsmashers!
We’re here in my fancy-dancy test-level and we have a fun UI problem with the mobiglas. As you can see I always use a weird screen resolution and it always tends to make the HUD go funky. You can kind of see it with the visor right now and when you pop up the mobiglas as you can see the edges tend to get offset and cut. If I make my resolution a little bit wider I’d be able to see the actual extent of Moby glass. So the UI guys were like well we can’t have this we need to work well pretty much all resolution so that scales correctly on the screen and so that’s what the good old UI folks in UK office have done.
So here’s our original code for our mobiglas instance and we have a standard scale that designer have setup, which for all intents and purposes worked for the scale that they were look -working in and their resolution however doesn’t work in this crazy resolution that I have of 1280 x 960 because I’m weird. I like to see my code on my left and right side and it causes all sorts of fun problems such as this resolution shenanigan.
So what the UI guys have done is, based on the renderer resolution, or aspect, they will scale it, so it will scale down or up depending upon how crazy your screen width and height are. So let’s activate that code to see what happens. Bam! So we take our original scale and we get the rendering and we scale it based on the renderer width and height so that if the aspect is slightly wider or slightly taller it will try to focus it more onto the center of the screen.
Alright, let’s hit the magic recode button and see what that does.
Alright as you can see recode is finished and our scaling has worked pretty nicely. In my crazy resolution it actually shrinks it down so that I can see the whole thing of mobi-glass. The only other problem that exists is where’s the close button? As you can see it’s not highlighting because I have to move it down a bit…Where is it…Where is it?
Somewhere around here…There it is. So as you can see there’s quite a bit offset from here to here. Let’s see what they did to fix that.
So here, in flash UI element this is where it takes the mouse input and sends it off to our flash elements. In this specific region of code it’s getting our mouse coordinates and it’s getting the viewport of the render and the flash and it’s trying to see where it should send the mouse inputs. As you can see we have for x & y we’re taking into account the width and the height but we’re not taking account the viewport offset which is the x and the y. So if that button was at 0-0, way up on the top, would be able to click it because there was no x y offset. However, we have an x and y offset for where we are to where this button is and we’re not taking account of that offset. So let’s do that and
see what happens.
This recode should go back pretty quickly but if we have a little box and we have another…Let’s see…Here we go…Box and we have another, we can use that square here. Our mouse input for that is it, we should say for this position is going to be this X offset and that will be that position for this position. Right, here it’s going to be this X offset + this size and what this code was doing is just taking account this position and not this offset. So we do both of these and now we can click here.
All right the recode has been done and we should be able to, well Voila! Click on the magical button. So now everything scales correctly and I could click on buttons as you would expect because, well, we’re taking into account all the offsets.
Hope you guys enjoyed. Wew!
So today’s bug was something to do with the mobiglas. You pop it up and if you have a crazy resolution the mobiglas right in your face and you can’t see on this side or this side because it’s clipping or it’s like really, really, really, small. It was just an issue with not scaling the thing based on your resolution so the good old you a UI programmers in the UK made it so that scales depending upon your resolution and now it looks pretty great even if you do some crazy high resolution or some lower resolution. It’s not all your face or really, really tiny. Then the other thing that they fixed was they had a little button and if you click on the button it when you work because it was actually offset and it was just a small little thing to take into account the position change of the flash so that it offset correctly so when you hit the button is actually right here instead of down here and hope you guys enjoyed until next time thank you for watching.