Star Citizen: Bugsmashers - Shopping Interaction System
Transcript — every row opens the video at that moment
- 00:00:06
[Music] hello and welcome to this week's episode of bug slashers whoa slashers yeah slashers when I run the show its bug slasher smart I don't think so welcome to bug smashers Spence what kind of bug did you fix for me today so today we're gonna be looking at a shopping bug part of what I've been working on in the last month is adding the new interaction
- 00:00:54
system to our shopping experience so you can look at the shopping racks and buy your clothing buy your ship items and get the new highlighting and interactions however intentionally not all of these interactions work to begin with ship items worked but clothing and armor are entirely different beast and so today we talked about the physics of why that isn't working sounds like a fun little thing let's take a look hello people of the internet we've got a shopping bug today that I'd like to walk you through so let me start by showing it off if you've been watching any of our recent ATVs and you see me on here talking about shopping we've gotten a new shopping interaction system here so same old interaction system we've had for some of the things we've been introducing like carry ball crates and stuff we are now putting in
- 00:01:40
shops so you can walk up to these weapons on this play rack and you can inspect them and you can buy them so bring up over glass and i5u HD it sounds like a realistic price for this gun definitely not a test number or anything cool so you could buy these feature I've been working on recently but there has been a bug that we have just washed recently and I'd like to show you it so if we leave this shop and we're gonna go head over to casaba don't mind the guy in the floor there he's doing just fine okay so we're here in cassava and it should be immediately obvious that we're not getting the interaction highlighting in items we can't even bring up the different by or in Tryon prompts so this may be one of the rare or depending on
- 00:02:31
who you ask not so rare occasions of an intentional bug and I checked this code in knowing that the shirts and any of these clothing items were not going to work with the interactions to begin with there's a series of complicated reasons why that is the case and I'd like to start to break those down so I'm just gonna hop over into our test map real quickly so here we are in the code this little bit here is entity component shop so this is all of the stuff that exists on our actual shopping entity in the level and that's one function we're looking here spawn item on first available rack is where our issues begin so there are two reasons why we're having this no interaction bug here the the first and broader reason is all of
- 00:03:23
the items on our racks all of the guns all of the shirts and shoes anything you go into a physical store and you see on the rack is the actual item there so the gun that you see on the wall you could theoretically actually pick up and take up off the wall and start shooting it and this is very intentional because in the future if we ever want to add like stealing weapons off shop shelves and stuff like that it's really cool to have the actual weapon there whereas maybe in a different game you might see that there dummy items on the rack they're not really you know the actual item they just look like it that would simplify some things but all our designers have to go in and make dummy items for all the things you actually want to sell so we've chosen the route of using the actual items there on the shelves cool right so problem number two these items were not built by the designers intended
- 00:04:12
to be used as we're using them now on the shop shelves so they did not have not all of them's had a physics setup and not all of them had interaction points setup now the reason the weapons already worked with little to no effort is they hand both of those already but these shirts do not sow in our code here you see this one little bit here we're checking to see if this has an interaction component if it doesn't the item we're about to spawn we add an interaction component so what we actually need to do is do the same thing for the physics controller so I've already got a little bit of code here that I'm just gonna paste in I'm gonna uncomment this right so this is doing the same thing as this but we're
- 00:05:02
checking to see if there's an initializer for the physics controller now there's a set of complicated reasons why we need to do it this way but it's important that we set the parameters to have a physics controller initializer before we even spawn the object which is why we need to do it here right okay so this is the first bit here we've got physics great no problem right well now we run into another issue which you see in game development a lot because we're adding the physics before the object is actually spawned and we're doing it through code we run into a problem normally when the designer sets up physics and data Forge there is this physics component here and we choose what kind of physics that would have so rigid dummy static rigid to be like a
- 00:05:53
soccer ball static could be like a shelf something that doesn't move we select this as a way of sort of gating what kind of interactions you could have with this thing we want you to push it around it needs to be rigid if we don't it needs to be static the problem is this is sort of locked in data Forge these specific parameters for rigidness or static Ness is something we don't directly have access to in the code so we have a problem if we look in our entity physics controller there is something important going on here every physics controller has a physical Iser the the physics system is a very complicated system built on many different layers and several different moving parts working at the same time but a physical Iser is just a small key part of this and basically what it does
- 00:06:44
is you have a physics controller on the game code side of things and it uses a physical Iser to set up the physical entity in the physics side of the game code so we don't need to go into the details of why this happens like this but the short of it is until now we've always needed a physical Iser on objects and so you'll see bits of the code where if we don't have a physical Iser here if it's a null then we're just gonna fatal error just stop the game like we could never have gotten here and funnily enough mark abent happens to be the one who wrote this code so it's funny that I'm doing the bug smashers for it but we've decided that we're going to get rid of this we're still using the physical answer but we're going to get rid of the requirement that it is not null because
- 00:07:32
in actuality there's only one really specific point where it definitely needs to not be null and in the case here of the shop items we can ignore that so there's a couple lines of code that we're going to change here scroll up here okay so in the beginning in the initialization of our physics controller we check to see if we've got this physical either we know here that we don't have it so we would hit this code path where we fatal error we don't want that we're going to turn that off and one other small change that we're going to do in the event that we did have no we are just going to set our physical
- 00:08:24
ization mode to none just to be sure because as I said the code can cope with not having the physical Iser in most cases so long as it knows your physical ization modes not and then we're just gonna hop over to one other file here so now let's build these changes we made and while we're waiting for the build to happen when you just put this on screen this is printing out status of our build and while we're waiting for that to happen let me recap what we've just done I know I thrown a lot of at you of physical eyes ears and physical ization modes and it's all really nonsense here but remember the reason we're doing this is because these shop items that don't have interactions and the reason they don't have interactions because they don't have physics you need physics for the player to interact with things so
- 00:09:12
what we did was we ensured that if these shop items got spawned without these physics parameters that from dataforge because remember their spawn through code now if their responder code they don't have these physics data for its parameters that's okay they won't have a physical Iser we'll just ignore that and keep right on truckin and now we should be able to get interactions on these topics you know while we're waiting for this build I think I'm gonna help myself to some delicious snacks here don't don't mind me you deserve this mark abandoning bug smashers mmm delicious all right so we just got back on our
- 00:10:00
test map here and let's go see if the changes we made are gonna work maybe you try and buy some pants and hey all right we got some highlighting there we can buy we could try on whole nine yards and it's gonna work for clothing too so goodbye you can try on for our shirts over here anything anything except armor mm-hmm now there's a whole different reason why armor actually isn't working right now but that's a bug for a separate day you know what maybe I should go talk to mark about this one so today we saw how the physical eyes were can give the objects in star citizen physics and further how the shop needs to override this so the shop items don't have a physical eyes
- 00:10:48
err that way you can properly interact with them that was the way I slashed this book anyways hope you guys enjoyed this week's bug smashers until next time thank you for watching I'm out I'm gonna get some lunch it took forever Oh kind of filled up on snacks earlier but thank you for watching so if you want to keep up with the latest and greatest in star citizen and squadron 42 development please follow us on our social media channels see you soon you
Transcript from YouTube’s automatic captions — punctuation and Star Citizen jargon are approximate. The video itself is hosted by CIG on the official channel.

