May 4

BugSmashers: Episode 24

This post is a transcript of BugSmashers: Episode 24,  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 24 – Full Transcript

Mark Abent (MA): Hey everyone, welcome back to BugSmasher [Cough]… Wow that was bad.

Alright. Hey everyone, we’re here in my fancy dancy test level with physics debug on. I’ve got a fun little bug that I supposively broke the physics when items such as this gun down here gets attached to ships. As you can see, all the little grey stuff, that’s all the physics meshes and on the weapons and landing gear it’s not working. Yay!

So the reason why, I was told this was my bug was we started, I should say, we started splitting up a lot of our entity logic into these things called components. Originally with CryEngine you really just had an entity and then something called a game object extension and you have like all your logic in there and if you wanted to do the same thing in another entity over another, you usually copy and pasted it because that’s just how the engine was. Now we have this component system where we can build this little bit of logic here that can be used by this entity, this entity, this entity, any entity we want. So we had our vehicles and our old items, they had a special way of physicalizing or getting physics and doing you know, becoming a rigid body moving around and about. However, I had to convert those over to our new physics controller which will handle that for anything uses it, but it also allows other components to directly read the physics information and we needed that for the interaction system and especially for 2.4. So that way we could query, we call them interactions so that you could select certain things, but that’s for a future thing. For now I needed to convert everything over to a physics controller and that will handle all the physics the same for every entity that uses it and unfortunately…

[Cell phone rings]

Phone call. Seriously business.

So unfortunately after I checked all it in, thought everything was working, I get a fun call from Andrew our QA and he has the most evil laugh there is and as soon as I checked in the code he was like, “Hey I have this bug” and I’m like, “Of course you do”.

So here’s our good old weapon and here’s our good old ship. Normally the weapon will have its own physics, but when we attach it to something it actually becomes physics of the ship. So the physics controller actually handles that, so when you’re on your own and then when you get attached, it makes sure it goes through the appropriate areas.

Unfortunately it had nothing to do with my specific physics controller, it actually had to do something else which is an attachable component and for the longest time we had special code for things you attach to item ports, but because we want to be more generic and we want to attach anything to an item port, we created this thing called an attachable component. If an entity has this, it could basically attach to things.

So now we could have ships attached to item ports and a hangar, we could have players attached to an item port in a vehicle, you could have a clothing thing attached to an item port on a ship, you name it and unfortunately this attachable object expects another component called geometry resource which is another component which handles all the asset creation for how it looks. So you have a CGA which is our ship which has bones and stuff so it can animate or it could be a pure geometry or skin, but either way geometry resource is the component to handle that and unfortunately, since I made the item and the vehicle have a physical controller so it can use the interaction system, it also now has this attachable component.

This area right here, get these flags, we search for it… do do do.. So when an attachable component gets attached onto the ship or hangar, whatever and there’s a thing called an attachment, we set certain flags and if there’s no flags set like it’s not visible, then we actually clear the physics because you can see it, why have physics, it just saves on performance. This is for things like you’re very far away you can really see or if we hide an entity you don’t want to crash into a random thing and unfortunately it’s returning no visibility and since our item vehicle aren’t using this component yet, we’re always getting zero because this would be null.

So what I did is used the fault visibility and what this says if we’re in third person, first person, or doing the shadow pass  this thing is visible, it should have physics. So now if I compile this bad boy, recode… Hope into the game, once recodes done its thing.

Aha! Recode! So we don’t have physics yet, but once I go to AI physics mode, BAM! Look at that, physics, right there and right here. Oh snap, because it’s visible we have physics.

If we move this guy away so he can animate or fall down, you can see that the physics moved with it. Wooo, having fun with physics.

So as you can see we had a fun little problem when we’re trying to componentize our logic and when I added that physics controller and interaction thing, we had no physics so when I got a bug, everyone thought it was that big whole change because I sent out an email. Turns out it was something completely different, but it was still related to a component and all it was just the fault flags getting missed because we didn’t have a certain component vehicle item.

So that got resolved and everything’s going good and we’re going to continue splitting all of our logic into these sub components so that you can have a generic entity and slap on whatever kind of logic you want. The other benefit of our components is going to be the ability to multithread all of our updates which is huge especially since we want hundreds if not thousands of players on a server. You don’t want to update the people far over there, but you want to update the people close by, so you have to be able to decide who gets what updates, when, how and maybe we could update them all at one time. So componentizing everything, good thing, just makes the game faster, makes the game awesome, hope you guys enjoyed. See you next time.

 

About the Author:

Leave a Reply

*