Star Citizen: Bugsmashers - Episode 36
Transcript — every row opens the video at that moment
- 00:00:16
Hey everyone, welcome to Bug Smashers. I'm your host, Mark Abent. If you guys have never seen this before, it's pretty cool. I take you behind the scenes of both Star Citizen and Squadron 42 on how we develop and basically destroy these bugs. Uh you know, when we're developing things, things go haywire all the time, and I'm here to show you some bugs I get smashed. Yeah, let's smash some bugs. Bug Smashers! Hey everyone, we are here in my fancy dance test level. Um if you haven't seen this before, I like to play around and have a bunch of things in my level so I can test all sorts of things. And in this particular particular case, I broke grenades in multiplayer. So,
- 00:01:05
hop on top of the ship, and if I try to throw a grenade, it kind of just falls down, and then it does an explosion. Oh god, I'm going to die. Woo, I got away. So, the grenade should, when you throw them, you know, travel a some distance, not a football length, but you know, some distance. Oh, I fell. Unfortunately, when you throw a grenade, they just plop to the ground, and they just stay there, and then you they explode, and everyone around dies. So, what's happening? Well, an unfortunate case of serialization. um we've been moving a lot of stuff to these component device things where um instead of jamming all this logic into one block, we separate all this logic into different blocks, and then we could
- 00:01:52
take some of this logic this logic, stick it onto this item, stick it onto this item, and the designers could go crazy building these building blocks. Uh designers get these Lego sets. It's pretty cool. And one of these Lego sets is this thing called a physics controller. Uh the idea of this is it handles all the properties uh that a designer would need to do uh to set physics on an object. And these grenades are a type of physical thing called a rigid body. And how, when you throw this grenade, it's supposed to basically serialize all the information, the position, velocity, and all that fun over to all the other clients. So, the server will see it far away, and the client will get the network packet, and he will also see it far going far, far away. But unfortunately, that broke. Um what
- 00:02:42
happened was um earlier, we were getting some disconnects on Woo, this guy. The ship. Um whenever the ship got destroyed, it exploded and disconnected everybody. So, what I ended up doing was Woo, where did it go? Ah, there you are. Um we have this thing called a game object where it's like kind of the root legacy component system before we started doing our stuff. We're trying to get rid of it, but we're still stuck with it. And anytime physics or anything that uh syncs, it goes through basically this block. Um so, I added this little bit of code right here that tries to serialize um the state of the physics and handle it for items, vehicles, and all these
- 00:03:30
things that use this physics controller. Because prior to this, they were all doing it individually. It was a whole nightmare mess. So, I put it in one spot so that all of them could share the same bit of logic. But unfortunately, it never actually got in here for items because, due to legacy reasons, items have this thing called a capture profile manager. And in here, we have a profile manager, it doesn't run. Uh this profile manager, ideally, is if we change physics, we could change what stuff we serialize. Uh so, if we have a rigid body, we could serialize position, velocity, all that jazz. If we have something that's static, we just need a position. But the network needs a constant flow of information. So, if we're a rigid body,
- 00:04:18
we have to always serialize that position and velocity. If we miss velocity, we'll get disconnected. If we're static, we always have to do veloc- uh position. If we do any more or any less, we get disconnected. Um so, the profiles is kind of a way to say, "Hey, now we're in this state, and now we're in this state." So, we could serialize the right information. And the server was setting up the rigid body, uh so, it's sending position and velocity, but the client wasn't expecting anything. So, when the client got the packet, it was like, "What the heck? I don't know what to do. You get disconnected." So, with that fun jazz, I was hoping to solve it with this. However, I didn't take into account this silly profile manager. So, the fun fix is to actually strip out that fun block and put it
- 00:05:09
before um because we don't want this code to run anyway if we have a physics controller, whether or not we have that profile manager. We always want to serialize it into here. Because this old way would disconnect you if you weren't the right type, while this guy will serialize it if you're in the incorrect type or not. So, if we do send the rigid body, but we're still stuck in um some other type of physics, it will actually uh handle the information by doing this thing called a garbage snapshot where it even though we're in this state and we expect just position, it will also just read in that velocity or position just to say, "All right, we're not in sync yet, but we will be soon." And so, this guy handles all that. So, we make sure the game rules or I'm sorry, the game object goes through this
- 00:05:57
path, so everything will be fine and dandy. Uh the next thing we have to do is get rid of this capture profile manager on the item itself and the vehicle, and I already did that for you. And move it into uh the physics controller, so he takes care of all of the profiles. All right. So, unfortunately, we have to restart the whole game. All right. So, the magic of recoding and editing has finished. Uh we're now in back into my test level, and we're going to go kill Bob here with my grenade. So, I'm going to stand back here, throw my grenade at him. Oh, there he go. Oh, I missed him. Let's try again. No! I hit my hand. I'm going to die. Ah. Uh things never work out as you want them in game development, but as you can
- 00:06:45
see, when I throw grenades, they actually move now, even if they hit my hand. Uh good times. All right. Hope you guys like that bug. Uh the wonders of game design. You know, I try to fix one thing where if you're in a ship and you get disconnected, I'm like, "Ah, here's a good solution." And then I get an email saying I broke grenades. Uh good times. You know, we're still dealing with these legacy systems as we bring on our new systems, and it's just a constant battle to make the two in balance until we're finally able to say, "Hey, old system, go away. New system, take over control." Uh so, fun little thing with the net serialize, uh everything got sorted. Our vehicles now serialize correctly, our grenades now serialize correctly. No one gets disconnected, and I can throw grenades at Bob, and he explodes in the glory.
- 00:07:33
Uh good times. Well, hope you guys enjoyed. Uh this was Bug Smashers. I'm Mark Abent at gameplay programmer here at Cloud Imperium Games in good old Los Angeles. Hope you guys enjoyed. Until next time. Thank you for watching. So, if you want to keep up with the latest and greatest in the Star Citizen and Squadron 42 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.

