Performance

I’ve reached a point where performance is something I have to start watching. I have an older laptop that I sometimes use for development and I’ve seen the frame rate drop to 15 or so at times. That’s partially because it’s an old and slow laptop, partially because Firefox released a new version that really slowed things down, and partially because there’s starting to be a lot going on in each frame.

I added a simple performance counter so that I can measure individual functions. As expected, the collision testing is the heaviest function I have. There were a couple of surprises, though, like a really short block of code that I use to track the mouse around the screen. All it does is convert the mouse’s 2D coordinates on the screen to 3D coordinates in the game’s world. It’s apparently so expensive that I’ll probably have to rewrite it, eventually.

My main concern about BabylonJS from the start has been performance. It’s a safe bet that a 3D engine running inside a web browser is going to be slower than more traditional engines like Unreal. But until these recent changes, BabylonJS has had no problem maintaining 60 FPS. I’m confident that I can keep the performance that high even when I start adding the graphics-intensive stuff like shaders. In fact, that seems to be the place where BabylonJS excels. If you look through their examples, even the really graphics-heavy examples run very smoothly, even on a modest laptop.

All I can do is write efficient code for the things that matter to gameplay, and hope BabylonJS can handle all the fancy visual stuff. The good news is that Ladon isn’t really about “looking cool” anymore. It was, back when I was using Unreal Engine. I was really focused on making it look like an AAA title, which was a little bit silly, given that there is a grand total of one developer on the project. Now, instead, I just want it to be fun to play. As far as the visual style, I just want it to be interesting, not perfect. Someone I once worked with used to remind me “not to let perfect be the enemy of good.” Wise.

Not a lot of gameplay changes in the latest version; mostly just performance measurement and some slight improvements. Play it here.

Leave a Reply

Your email address will not be published.