- Published on
Devlog #51 - Super Gangster Optimization
Well that 2 week sprint went by way too fast. Once again a lot got done but I didn't finish everything I thought I would finish. Don't worry though, things are coming together nicely on both the quest and party front.
I spent about 1/2 the time during this sprint optimizing a lot of code that gets called every time a frame is rendered. It's amazing how slow Javascript actually is and how a few if statements in tight loops can cripple performance. It's also amazing how much Garbage Collection still plagues real-time applications.
What is Garbage Collection?
https://en.wikipedia.org/wiki/Garbage_collection_(computer_science)
It's automatic memory management that the developer can't control. Essentially every time you create a new object it allocates memory. If you then stop referencing that object it becomes garbage. The Garbage Collector periodically reclaims all the garbage your code has created and that's where small hiccups in performance can happen from time to time.
This screenshot shows Chrome's developer performance profiler. I've highlighted one of the spikes in processing and as you can see There are several CPP GC and a Major GC. GC of course stands for Garbage Collection. So while I've removed a ton of garbage creation in the last week, I still have a ways to go before the GC spikes are smoothed out and not noticeable while playing.
One major source of garbage is within the BabylonJS GUI codebase. Thankfully Javascript let's you completely replace functions through Object prototypes. And that's exactly what I'm doing in the screenshot above. By looking through the results of the Chrome performance profiler I was able to find several BabylonJS functions that had extra code that FO2 doesn't need and it was also creating garbage every frame! So I ripped out the bad code and kept the good and voila we've got some really nice performance gains.
Chrome also has a really nice memory profiler. In the screenshot above I've just discovered that BabylonJS mouse events are creating a bunch of garbage so that is next on my list for optimization.
Possibly the biggest source of garbage though is sending and receiving data through web sockets in SmartfoxServer. The screenshot above shows web socket data coming through as "value" and creating a ton of garbage. Most of that web socket garbage is unavoidable but it may be possible to put that code on another thread with web workers so I'll be investigating that soon as well.
Outfit weapon and off-hand slots are working and their nudes are now available.
The classic Gangster Box Set has returned and is available at Gemster's Gem Shop in CC.
Dino has finished v1 of Forgotten Wasteland. It holds a lot of new surprises.
There are 10+ new quests in MC. The undead cooks and chefs also have new 1/1000 drop chance hats. They are outfit items. 20+ more quests coming to MC. I'm slow with quests.
Teleport skills and skill books are in. Which is annoying because I don't have multiple skill bars implemented yet. I need to get sidetracked and implement that.
Pre-Early Access Steam Keys for Super Supporter Club Members
The Super Supporter Club has returned. Two SSC's are already in the game.
Patch Notes #47 - Cave of Despair Pt. 2
CoD has all of its enemies and 90% of it's drops in. Quests will be the next phase for CoD.
Look at the top right hand corner of the screenshot above. macOS switches the Steam version of FO2 into "Game Mode" when you click the fullscreen button. Fancy.
Steam builds for Windows, macOS, and Linux are already available directly from Steam. A few people including SSC members already have FO2 in their Steam library. As you can see, we are still working on the logo and graphics for Steam.
Over the next two weeks I'll be continuing to add quests to MC, continue to work on party code, optimize away garbage, and other random work. Perseus is now working on the Spring Battle Pass. Dino will continue to refine FW.
The Touchdown Topper, Astronaut Box, and Frozen Crab Hat will be leaving Gemster's Gem Shop sometime this week, so grab those while you can. It will be at least a year before any of them return.
See you next patch notes!
Have Fun & Keep Gaming!