Upcoming Events! Community Event Calendar
Social Media Follow us, or not!

Bugsmashers: Turret Trouble Written Wednesday 14th of June 2017 at 12:00pm by StormyWinters

As per usual, anything said during the show is subject to change by CIG and may not always be accurate at the time of posting. Also any mistakes you see that I may have missed, please let me know so I can correct them. Enjoy the show!

TL;DR (Too Long; Didn't Read)

  • New turret setup where adding components to the seat and when you get in you gain control of the seat but not the weapons or dashboard

  • Fix is adding tags to each component so when you sit down and take control you can get in and out and shoot the weapons as you like

Full Transcript

Mark Abent: Hey everyone, welcome to Bugsmashers, I’m your host Mark Abent and let’s take a look at some bugs. 

Hey everyone, we are here in the fun little test level for the SC Item 2.0 Constellation and what we see here is a list of all the items and their individual components. So, with Item 2.0 infrastructure, we can have some entity like my hand and it can be composed of physics. It can be composed of an item, it can be composed of a power plant, weapons system or even a seat. So all five of those components basically make our entity and in the case of this Constellation, we have a turret and this bad boy is composed of a bunch of components and this is our whole new Item 2.0… entity 2.0 system. Where we have our turret which is an item, it has these individual components, geometry, physics, animation and our actual item logic. 

So we have here a dashboard, this is the thing that you will see in front of you that has all the screens. It has TurretParams, this is the thing that you need to move and rotate this guy around. He has a seat, this is basically the interface to the ship saying ‘hey I am a person sitting in here, give me control of stuff’. Then finally we have the Weapon Controller, this allows you to be able to shoot stuff.    

So ideally when we plop one of these down into a ship, you can get in it, play some animations, gain control of some awesome weapons and let’s see what happens. So I’m going to sit down, fast forward all the animations and as you can see, some of this debug text is kind of turned a different colour. So we have another player which is basically in blue, that’s me, I just sat down in the seat and he’s gained control of… you can see right above the replace people, I’ve gained control of the seat, the turret and the weapon controller. So all these components I have in here, I’ve gained control of them except our weapon controller has not gained any weapons so where are our weapons. They should be… there they are, so we have this weapon gun that’s on the hard point of the turret but unfortunately we’re not getting control of anything. 

On the very far right we have turret right and turret left so what’s happening. Well, let’s take a look even further. So here’s our ship XML, this basically says ‘hey here’s everything you need to know about a ship’ and we have these things called ControllerDef blocks which basically define some set of parameters of who is going to control what. So for this seat when a user sits down, he’ll take control of the turret itself and then the turret will also take control over itself again. It’s kinda weird but the way the code is set up is this user def is basically the seat, so when the player sits down, he’ll gain control of the seat. Then this useable since the seat now says ‘hey this person has got in, what else can he control’, that’s the second block. Then he’ll be able to control his dashboard, his turret and even his weapon controller. That’s why it’s kinda set up this way.

 The reason it’s also set up this way is because, yes you could have these components all built in the item but you could actually separate them out and have them subcomponents underneath connected on item ports. So it’s kind of a weird set up because the system allows you to be very flexible and this turret has, go back to this guy, we have an item which has some item ports and those item ports… we could set up a gun and we could also set up another gun on the other item port. So on these item ports we have some weapons but unfortunately we’re not getting control over them, why? 

Well, let’s go back here as we’re saying we set up these priorities of who can gain control based on these things called controllable tags and when we snap these weapons on it, well we’re not gaining anything. As you can see we’re looking for these weapon guns but we only take control of them, so by default we have no control, unless they have the tag the lower turret tag. So we’ve assumed that these weapons that attach onto us will have the same tag as us unfortunately don’t. 

So let’s make sure that that happens and the reason we want to do that so that if we have the same turret copy and pasted in a few spots, all we have to do is set the tag here and then everything underneath gets it. So, in the code whenever we have this new component so we don’t do things entity level wise we do things componentwise. So when each of these gets attached we handle them independently so character on another entity or on this guy. We basically get the item port and get its tag and then we use that but as you can see the weapons are on… we have the weapons and then the turret that are attached onto it.   

So there’s nothing to describe what flags or tags these guys should have so what we can do is enable this bit of code and as recode runs what this will say is if we’re not directly attached to the ship that means we’re going to go all the way up to our parent and we’re going to get its tag and use that. So what this will allow us to do is those weapons that get attached, we use this tag so that the weapon controller can gain control over them. 

So we’ll let recode do it’s thing and I’ll sip some coffee. Aha, recode has done it’s thing. We’re going to snap out of the turret, fly it back up to the top, enter again, fast forward… now we gained control of everything again. Let’s see if we gained control… yep, and now we have gained control of our weapons so we can fire them as we please. Pew, pew, pew. Well, hope you guys enjoyed this sneak peek, til next time. 

So as you guys saw we had a fun little bug where we have these new setup with the turrets where they’re all mashed together and just adding a bunch of components. We slap it on the seat and we only get control of the seat, none of the weapons, can’t even get control of the dashboard. So we can’t get out. Simple as to make sure we add tags to each of those components so when we slap it on and sit down, we take control ourselves and then we can get in and out as we please, shoot all the weapons and have a good time. Hope you guys enjoyed, until next time.     

StormyWinters

Director of Fiction

Moonlighting as a writer in her spare time StormyWinters combines her passion for the written word and love of science fiction resulting in innumerable works of fiction. As the Director of Fiction, she works with a fantastic team of writers to bring you amazing stories that transport you to new places week after week.