Star Citizen: Bugsmashers - Episode 37
Transcript — every row opens the video at that moment
- 00:00:06
[Music] hey everyone welcome to bug Smashers my name is Mark aent I'm gameplay programmer here at Cloud Imperium games Los Angeles and if you guys never seen this before it's pretty cool I take you behind the scenes of some fancy bugs that disrupt you know your guys' playtime and even some designers or even our stuff and you know it's pretty cool to see what happens and why and I give you a quick breakdown of what's happening and the fix well hope you guys enjoy let's take a look box bashes hey everyone we're here in my fancy dance test level and Bob here is
- 00:00:56
annoying me so I'm going to get rid of him goodbye Bob all right so we're here to test out a fun crash bug when certain entities get destroyed um if Bob goes away he may crash but to speed up this process we are going to spawn fun constellation constellation I'm going to shoot the crap out of it and hopefully we can get a crash that QA was reporting so apparently uh with this bug when you destroy and delete things we're getting a crash with some corrupt memory so let's see if we could replicate that everything is dancing ah and crash excellent so what's happening here well uh when we try to remove these entities
- 00:01:45
uh we get this thing called an event done and this gets dispatched to all sorts of systems to say hey clean up we're about to delete this entity and unfortunately there's some kind of memory corruption happening because um in this particular area it's supposed to stream out what uh I put some debug code in here to see what's actually getting deleted and unfortunately the information we're getting out of this is just pure garbage um what's happening after some intense fun debugging uh we have two competing systems Racing for um the event done listening we have this thing called an item Port which is uh if I have keys I could attach the item or I should say these Keys onto the ship and the ship could fly away and it has keys
- 00:02:33
or guns or whatever and we have this thing called a physics controller so when this Keys um goes onto the item Port it will lose its physics but then physicalize onto the ship basically the physics become one with the ship so when the ship gets hit we know which item gets hit it's some clever magic and unfortunately when they both register for this event done um depending on the order of which these components were created the physics controller may get it first or the item Port controller gets it first and if the itm port controller gets it first it will actually uh detach these keys and say all right you're done and the physics controller will then get informed that these Keys have been detached so it should basically now own its own physics um but if the physical
- 00:03:25
controller gets it first it will DET it will think is detached and then it will physicalize itself so now it has physics on the ship and it has physics on itself but unfortunately um it only is aware of one at a time so it gets rid of the one on the ship but the ship still thinks it has it and this is where the issue lies so the now this thing has its own physics and it still attached and when the item Port gets the event it tells it to detach and ref physicalize but the ship still thinks it has the ownership of the physics so it now tries to clean up to rebuild it and since it's now pointing to an old point in memory it will touch and corrupt anything and that was in that memory position and then
- 00:04:15
things just go Haywire you start crashing in random positions so the correct fix is actually to get rid of um the events listener we don't really need for the physics controller to listen for these events because we have the item Port system to do it for us this was just an extra set of precaution that we don't really need in fact it's causing a lot of harm so this is one of those simple cases where um extra safety actually caused us harm since we don't really need it so the fix is actually just to gut out the um the system so it doesn't listen for those and instead it listens it gets told by the ad and Port system so I'm going to gut all the location where it registers itself and then clean up the listener
- 00:05:08
set oh there we go goodbye listeners and there it is there it is so as you can see if the physics got it first it would pretend that it was released even though it was still attached it was just the safety measure in case the item Port system was um not reliable but item Port system is reliable uh so we could just get this old Cod path all right let's rebuild and through the magic of editing we be done now so we're back in the fun little level Bob's twitching out so let's take
- 00:05:57
care of his misery and made ship go boom excellent ah game design so we're now going to spawn uh that fun constellation and let's see if we crash where is it spawning there you are where'd it go there you are he moved so let's shoot this thing and before you say the pistol is destroying every single thing I may have a developer gun that lets me destroy things oh that looks awesome all when this thing goes away that should be the vehicle it shouldn't crash hey it didn't crashh so um thanks to my little debug you could see um when that event got dispatched the radar the Su flow graph and physics uh that's kythera all got
- 00:06:48
information that's not physics controller just yeah labeled differently so everything cleaned up heck we even got the item Port stuff there so a couple thing got item ports so now when the item Port gets the message it will detach the thing the physics controller will learn about it and then it will send it off and everyone goes off their merry way no more memory corruption no more crashes everyone's having a good time now we can play without getting disconnected from a crash woo hope you guys enjoyed so we had a very exciting bug uh you know when you're in multiplayer and you shoot some random thing when the entity goes away boom crash now your game's gone and you have to restart all over to play again not too fun so took a quick look at it and
- 00:07:37
it was just an issue with the physics control trying to do an extra step of protection uh we had that in there originally because our component system wasn't as robust as when it was originally imp implemented many many many months ago but now we have a much more robust system so the flow and expectations of when things could happen are more reliable so didn't need that extra step of protection now we don't have that memory corruption everything now works as expected no more crashes everyone's good to go hope you guys enjoyed and remember praise be the lamp thank you for watching so if you want to keep up with the latest and greatest and Star Citizen of 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.

