This post is a transcript of BugSmashers: Episode 21, 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 21 – Full Transcript
Mark Abent (MA:) Hey everyone welcome back to BugSmashers. As you can see I got myself a nice little haircut and you know why. I’m preparing myself for the new movie barbershop three, that fancy cut. I know it’s nice cut, but I like fancy better.
Hey everyone, we’re here in my fancy dancy Freelancer. I can put some posters up here sometime, it’s a little bit bare, but regardless of that. We’re checking out a little bug here that you guys may have saw during the PTU where when you leave your space and go out into the world, you’re leaving our little zone and entering the world zone and during that transition the player velocity tends to go insane.
Sometimes it will push you down and you would instantly die or you’d fly all the way across the map or the best case scenario which you’ll probably see here is you’ll stop dead on. So I’m going to hold down the W key and as I exit, I immediately stopped. I can keep flying now, but when I transition out I stop and then my velocity gets wonky and as you can see I’m going in a completely different direction.
If I fly back in, weee… The same thing will occur. I should stop, yup I stopped, things get wonky and now I’m back in the right spot. So transitioning from our interior grid to our world grid, there’s some wonkiness going on and we’re going to take a look at some of the fixes. There were quite a few that went into 2.2.
Let me move my fancy dancy game over on the side and we have here the command buffer. This is basically the area where all the joints get updated and the skeleton or the player skeleton of the bones, they get animated, they move around and we also have this thing called the physics location which is the point where basically the skeleton is. So the skeleton is here and all the bones move around.
This little bad boy here updates the physics position so if I move my bone or if I move it away, it has to update that and unfortunately this physics position could be in zone space or world space because you were transitioning to and from and it doesn’t handle that very well. So Ivo in the Frankfurt office… let me put back his code, did this little trick to make sure that the physics position in this part of the code is always in the world space.
Basically if we have an owning entity which will be usually the entity that the skeleton owns like me the player, we check to see what zone it’s in and this bad boy right here… since players are always in the zone, he’s either in the world zone or the zone of the ship, it will get the transformation and then it’ll get the world space transformation so if our physics position is in the zone or if it’s in the world space, we have to make sure we transform that to world space.
So this bad boy will be like, “Alright if you’re in the zone and doesn’t matter where you are, we’re going to transform you into world space”. So now these physics locations are always in world space and mostly because this code relied on everything being in world space and it’s a lot easier to just let it do it’s world space calculations. Then when it’s time to talk to physics which is this fun bad boy here, we’re gonna make sure that, let’s see… In this part of the code, it gets the character physics and it reassigns the grid, but there could be an instance where the physics is behind and the entities and new grid and just haven’t synced yet, so if we’re going to transform those positions into our physics now, there world space currently, but we have to convert them to the zone that the physics is in.
So the first thing we want to do is make sure that our physics is going to be in the proper zone that our entity is in. So I’m doing this bit of code. What this does is we added a… I should say Ivo added current grid to this function and what this does is when this function gets called we actually get the entity grid of the player so that we immediately know the correct grid we should be in and so now our physics goes in the correct grid and we add this little flag here saying, “Hey we’ve done a grid change, check to make sure the physics should update my position or velocity values based off that grid”. So before they were over here in world space and now they’re in this Freelancer, they’ll move all of our position information to be relative to that grid.
Finally, this is where we used those physics positions from the command buffer as you guys saw here. Since now they’re guaranteed to be in world space these are going to be world space coordinates however it might be in the grid of some other thing like the Freelancer. So now we’re feeding in world space coordinates to a completely different zone, that’s not going to work.
So, I’m doing some more fun code, there we go. We have this queue transition which is basically what we’ve done back here but we do it in reverse. So we get whatever zone we’re in, we get the inverted ness transformation so now we transform our world space difference into zone space and then we divide it by time. Basically, getting our differences in our physics coordinates and applying that as velocity but since the world space, we transform it using this inverted matrix to zone space and then divide it by our time and that gets us our velocity.
Now our positions are guaranteed to be world space so it can do its calculations so when we send it back to physics we make sure we’re in the correct zone, the entity is in and then we take those world space coordinates and convert them to the proper zone space so we can apply our push velocity on the skeleton physics. So recode just finished now, we’re going to pop back into the game if I fly out, woo look at that, I keep flying out.
So, I maintain my momentum instead of just stopping and when I come back in, weee, he maintains his velocity except when he hits the bottom he gets friction as he kind of slows down but jumping out I maintain my velocity, woohoo. Zones… and as you can see there’s kind of a camera glitchiness, there’s still some other parts we have to fix up too but we’re slowly making it there and I hope you guys enjoyed.
So, as you guys saw here we’re having some fun issues with our world space to inner ship… going to and from making sure we keep our velocities, our positions, our angle rotations and everything perfect so when you go from one to the other you don’t notice it. There is still some issues and we’re working them, it’s a difficult problem especially when you have a zone, within a zone, within a zone and you want to make sure you go through them.
Like you’re in a Hornet and you get out of and then you’re in a big ship, in a big ship, in a big ship, you have to make sure those transformations all look and feel correct and it’s a big challenge especially syncing up our physics from our game codes since they’re, you know, in two different threads running at different times, keeping those in sync at different points is very, very hard but we have people in Frankfurt, the UK and even here working on it to make sure your experience is better. Thanks to you guys for posting those bugs especially when we had the PTU, they helped out quite tremendously, hope you guys enjoyed and I’ll see you guys next time.