It’s time for BugSmashers with Mark Abent! Lets see what he squashed today.
Transcript by CanadianSyrup
The Bug: Ship item entity’s remained in the game instead of being deleted when the rest of the ship disappeared and causing building and eventually performance degradation.
The first of two bugs was when ships that were spawned by players got destroyed, they still remained in the instance. This was fixed, but they noticed there was something else going on with the item entities
During some code changes to move stuff over from being handled by the client to the server they missed a check that is supposed to clean up the item entities attached to ship debris such as ammo, weapons, radar, etc.
The fix itself was quite simple and involved making sure the code was correctly being deleted by the server as before it was done by the client.
Sometimes during a big change you can miss something that’s small, but it can have large consequences to the overall performance or stability of the game.
Mark Abent (AB): Hey everyone. Welcome to BugSmashers, today I’m going to show you an awesome bug so let’s get started.
Hey everyone. We are here in Port Olisar. I really want to say Alistar, but we’re in Olisar, Ololar, we’re in a port. Here in our fancy dancy port we were tracking down some fun bugs in 2.3. Where the server after while just goes completely bonkers, has low FPS and players get weird things like when you tap a button, maybe you don’t start shooting because the servers are taking their sweet time.
We’re here in this fun little fun Alistar map and as we’re debugging to figure out why the servers were having such low FPS; we discovered two horrible horrible things. One, ships that get spawned in by players and destroyed outside of the green zone weren’t getting cleaned up and they were still there in the levels and the same thing was happening with items. So we’ve fixed the issue with the ships no longer… or as I should say ships always getting stuck there in level and now they get properly cleaned up, but we noticed something where our items would actually stick around and on the screen you actually see all the items that are currently in the level and how many instances. So we have a couple ammo crates, couple pistols, and couple of repair beams. This is a fresh map, I’m the only player inside and these are the items that just so happen to be there because a designer added them, but if we spawn a fun little ship… lets spawn a Hornet, oops I have debugging on, you’ll see that a bunch of items just appeared on the list, cool!
Let’s go to.. Where is my ship… Let’s go to my ship, I’m going to go through all the levels because I don’t feel like walking. Weee. I’m now going to enter my ship and I’m going to blow it up.
So this might take a little bit to kill myself. Weee. I’m turning on my ship and…. Bam, alright. So now once the hud initializes I am going to destroy my fun little ship weee. So I blew up my ship and on the top you’ll see that it says my Hornet because it’s telling me it’s destroyed and that the items are still there. So if we wait a moment… There is goes, the ship went away and if you noticed not all of our items disappeared. We still have our debris piece which has some ammo boxes or radar and our laser guns.
So we’re going to wait for the debris. Let’s see… So we still have some debris, it takes about 60 seconds for it to go away. So wait for it go bye bye… We still have eight instances, Oh all the debris pieces just vanished and if you noticed, we still have all these hud items on the bottom. We have let’s see some counter measures, we have a radar, we have missiles, we have the self destruct; some thrusters, and some weapons, not good.
So basically if you spawn a bunch of ships and they all die and we take our items and attach to our debris, they never get cleaned up. So after awhile of playing we build up all these items and these items and these items and that’s a lot of crap and unfortunately they get stacked so much they become a burden on the networking and on client and server performance.
So what’s happening… If we go to our lovely debris item, way back when. When our debris or I should say, what a debris item is any time you smack into something or your wing breaks off, we take the geometry of the vehicle, stick it to this entity called the vehicle item debris and we attach all the weapons and gizmo’s and stuff onto that item and that controls the geometry and all the items from them before. It used to be that this was all client side so when it got cleaned up we just hid the item on it because the server still owned the item and it would get deleted when the ship got deleted because the item was still technically attached to the ship, we just did some magic to put it onto the debris piece. However as time went on we were slowly moving this debris piece over to be server and client.
So client and versions would just have geometry, server versions would have the actual items and when we actually move the items over, now the debris item would own the item and no longer in the vehicle. So if the vehicle went away, the debris piece own the item, if it went away and never deleted up it’s items you would still have all these items that you see in that fun little list.
So all we have to do is when this debris piece goes away, we have to make sure to clean up all the items that it owns and that’s literally all we have to do. It’s just one of those things that we forgot to do when we moved the debris piece over to server control with all these items on it. So what we’re going to do is build again and restart the level and see what happens.
Alright so we’re back into our lovely level in the port. Lets try this fix. We shall spawn another Hornet and see what happens. Oops still have fly mode, where did I go? There we are! Haha. Alright let’s spawn ourselves another F7-C. Spawned it and we got a bunch of items in our list, so let’s go smash this Hornet, Woo! While that happens we are going to cheat… oops… Cause 60 seconds is way too long, we’re going to delete our debris in five seconds.
Alright so recode just finished and now our debris is set to five seconds so let’s smash this ship to smithereens. Weeee. Boom, so our ship is still dead up on top and all the items from the debris just went away and once our Hornet goes bye bye we should now see everything go back down. Yup! There we go! So when our vehicle goes away, all the items it owns get removed and now when our debris pieces get removed, all the items it owns now goes away. So we’re no longer leaking items and everyone can have a fun fun day when the 30 pirates spawn and they kill them all, woo! Hope you guys enjoyed
Hey everyone. As you guys saw we had a little bug with our items where after you kill a ship and it spawns the debris pieces, the debris goes away, the vehicle goes away, they all they cleaned up, but our items get stuck there. So if you have a big battle like we have all those pirates spawning, those 30 some pirates which is another bug, go and kill them, all their items get stuck and stay in the level and after awhile they build up and build up and build up and the client and server performance just goes bad. Had to clean that up, fixed it. As you can see it’s just a by product of us moving debris from client authoritative to server authoritative so that we can sync what goes to what and you always forget one thing and that one thing can have severe consequences. So we figured it out, solved it and onto the next bugs. Hope you guys enjoyed, see you next time!