Subliminal
Bugsmashers

Star Citizen: Bugsmashers - Ships Always Updating

8 November 201700:13:28228 linesWatch on YouTube ↗

Transcript — every row opens the video at that moment

  1. 00:00:06

    [Music] everyone welcome to bug smashers and back in action to show you guys a fun book let's take a look everyone we are here in the awesome PU level and this week we're taking a look at the fun issue of performance yay and a broken ship so this is our fun little Cutlass and it's cool let's spawn a few more because why not do we spawn a few cut cuts they're all freaking out like crazy

  2. 00:00:56

    because they're all smiling the right spot why not cool um now that actually looks pretty nifty now when you expect before mins fun we're hearing part all the star and well there's a bunch of ships here and they they're all flying around chittering about you expect well yeah they should update but if I traverse all the way to once I find all these fun console commands let's go to or yella like hype whoo if you notice on the top left all of those cutlasses that I spawn are still updating even though it's miles and miles and miles and miles away that's a problem because if we want to have a bunch of players in the good old server

  3. 00:01:44

    we don't need them to update for me when they're far far away I don't care about an EM 50 or Cutlass battling across the galaxy they're eating my CPU cycles and damn it I want my CPU cycles so let's fix that let's stop the game because I won't be able to recode that Shazam the first thing we're gonna do is here's our component for the movement flight movement it's very basic all it does is has an initializer and then we update you get the vehicle and then we start updating ifcs on this batch update in the specific frame of the entity system and in the update we basically batch a bunch of updates and they all get spawned and get processed as many processors as you have so during the

  4. 00:02:33

    frame we're like hey everything go update and we just go crazy the benefit is that instead of having one pass and going one at a time if you go like sixteen twenty hundred updates in a row quite efficient but this guy is set to always update that means if he's far away he's gonna update no matter what we have a whole slew of updates but the one that we care about is actually this thing called in range in range is basically it's not necessarily invisible but if it's potentially visible that could be able to be behind me side left right it will get an update so if I'm battling some guy the guy in front of me and he goes behind me he'll still update because well we need him to continue

  5. 00:03:21

    flying now that's good gone BAM cool but that's gonna cause some problems and IFC especially since we do some Network tix that no longer happened so what we want to do is let me copy pasta some functions that's some awesome functions in here we want to know specifically when we go in and range and out of range so that we could tell ifcs hey once you've gone out of range stop moving go and then tell physics to go to sleep then when we come back we want to reset the network tick so that we snap to the latest information so I'm gonna add these two fun little functions Sam these little functions allowing my

  6. 00:04:14

    component to register for certain events and when I get the event I could do some fun magic so let's add these fun little functions Shazaam forgot my functions now I need to register for some events so let's go find the magical events we have a whole slew of them - that we want or enter range and in range now the coolest thing about the inter ranging and leave range is if on a client if something the range is basically where Mike where I am so I

  7. 00:05:05

    don't have to care about the m50 far away but the in range on the server is where all the players are so technically if I'm all the way over here and there's another play over here both the stuff in these areas will update on the server but only the one where I am will update on my client kind of a nifty thing that allows the game code to work specifically for the things that we care about things that aren't in range or don't need an update shouldn't get an update get our CPU cycles back through so we registered for in range and out of range so let's process those get my vehicle tell the vehicle

  8. 00:06:02

    we went our vehicle know that hey we've entered the range that's a new function on rain change we'll just have a truth we've gone in and then we'll have a false floor I don't know we've got out of the range now this doesn't exist so we have to add it to fun old interfaces cool what's to use the longest variable has done on range diggity Doo yay so if this is true we are in range and we should start processing now let's add it to our

  9. 00:06:54

    spaceship magical spaceship our spaceship this is our movement for the spaceship he has all the fun stuff for ifcs and updating where the ship should go so we need to forward this information well to the spaceship or ifcs magical wonder of ifcs what we have to go into us yes oh the fun of programming one thing said something has a long chain this is what we do all day every day this is the easy part ok so now we have our flight and if we are in range

  10. 00:07:50

    we basically want to reset ifcs I should say the network that and then here we want to disable basically physics and go to sleeps so first thing we need to do is make sure that we have let's let's turn in let's make a go to sleep first so we need the physical entity this is the physics the rigidbody this would be like the cup or with spaceships on it so we need to tell physics piece ship physics this is where are you do owner get me the physics owner is this ship we

  11. 00:08:43

    want to tell the ship to action where are you since velocity you want to clear the linear velocity zero that out later the angular velocity aha so linear angular type piece ship physics go to sad never said action no it's an action there it is go to bed this will clear the velocity and now we need to tell to

  12. 00:09:39

    go to sleep cram position I am this position sim class we are gonna go to Pam cool so this basically tells the ship to go to bed another thing we need to do is that should be fine now once we have gone to sleep if a ship comes into range we now need to wake him

  13. 00:10:29

    up so for the server its reset this will reset the network and we need to reset our prediction what this does is if the server gets into a state where the ship comes back into view a reset this network state and everyone will snap and then on the clients we set this prediction so it snaps to either the client or server latest information so let's compile see the wonderful errors that we get back with some magical code compiling and I spun myself a cutlass my spawn a few more just for fun we always spawn inside each other but

  14. 00:11:18

    Shazaam so there's the cutlasses they're updating moving around like crazy ifcs is doing their thing on top left we are getting our fun updates now let's check out the code in action if i teleport to yellow they should no longer update oh they don't update there's no debug text I get my CPU cycles back everyone's happy FPS is high today's a good day and what's great is the server's not updating those until teleport over there till I go over there now if there was another client over here and then I teleport away that server would update them because well they need to move because they are controlled by good old server guys enjoy that's today's fun optimization alright so as you guys saw

  15. 00:12:10

    we had a fun little performance issue as we try to cram more and more players into the server we're constantly debugging profiling trying to find out all the things that are taking most time on the server and we're nailing those out so we could add more and more for more players to the the game and unfortunately the ships they've been in the game for a long long time because it's well spaced game and you know there was not so many optimizations in there cuz we were just like getting you know get it up and running cool but when you start adding more players we don't need to do all these updates so guys way way out on oblivion we don't need to be updating ifcs because well they're light-years away from you so we had a little bit of code in there to make sure that those guys far away kind of go into this little hibernation mode until they

  16. 00:12:57

    get within range and then BAM they're up and running and you're able to dogfight with them hope you guys enjoyed until next time thank you for watching so if you want to keep up with the latest and greatest in star citizen the 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.

Squadron 42

LiveSQ42 Launch Subathon

$2,094of $3,000

Getting Sub to Manchester for the Squadron 42 launch

Next giveawaySubscriber Store pick
$6.27to go