carrotcake Blog 🍃


official devlog for carrotcake written by Louis Durrant

Alpha Report: First the test, now the rest.

Posted on Apr 30, 2020

The Garden Path dropped its first alpha release to testers last week, and a second release is being tested today.

The first alpha test went down a treat, and was even more valuable than I could have hoped. Not only did we unearth new strange bugs, but the testing also helped me begin cataloging and prioritizing bugs I was already aware of, but had maybe needed a reminder of.

Indeed, just as important as discovering what didn’t work was discovering what did work. It’s an incredibly satisfying payoff when, after all the hard work, things go according to plan. Hearing that testers were able to gather nuts and seeds, discovering a traveling NPC, and then make a successful trade with them, was remarkably reassuring.

But we’re still early days — things didn’t always go off without a hitch.

Generally stability and performance were highlighted as focuses, which was my focus for the week.

One bug, known now as the ‘bug of death’ crashes the game with no warning. The console leaves a cryptic message that could not be solved with either google or the debug.

The game, despite being a lot smoother than before, still stutters when the player is moving through the world. Some stutter inevitable, and to be expected, but in an ideal world we want things as smooth as possible.

In this second release, the way objects are loaded and unloaded has been entirely rebuilt. Now, rather than each of the many thousands of Spawn Points issuing their own loading commands, a central script now queues and manages all of the loading for them — the Spawn Points simply make the requests.

This way, the engine isn’t being bombarded all at once, it’s less like holding a glass bottle upside down, and more like pouring it gently. Things don’t come out as quick, but we all benefit from it. Each prop in the garden path is very simple, but there’s a lot of them. While loading them takes no time at all, things can get a little stuck when they’re loaded all at once. This way, should the player enter the loading zone for multiple props at once, they’ll still be loaded in a neat order.

I also discovered a trick in Godot of using ‘call deferred’. By ‘deferring’ different functions, they are given less priority, and run during idle frames. This not only seems to reduce the number of complications, as things are only processing when safe, but prevents more stuttering by, again, not overloading the engine.

With those two tricks, it seems as though the bug of death is no more. In fact, for the first time since I can remember, The Garden Path runs with no reported scripting errors in the debugger — masterclass!

Alas, one sacrifice had to made. While Godot can handle thousands of nodes on screen, the dream of having each leaf on each tree rendered individually was proving to be a pipe dream. While it ran fine with ten, maybe even twenty trees on scene, frame rates began dropping hard once the garden got more dense.

It simply wasn’t worth it for such a simple effect that’s hardly noticeable. And, with the new shader that adds a subtle sway to all foliage in the game, it’s difficult to tell the difference.

Now we can have attractive, densely populated forests, at a fraction of the performance loss. Just think, rather than all of those thousands of leaves rendering, we can spend those resources on filling the world with interesting flora and vegetation.

Not to mention, it’s infinitely easier to build trees when the artwork is a single sprite. It offers vastly more control over the colour and shape of foliage, and takes much less time now that I’m not placing each individual leaf on the tree (I wish I joking). My seemingly endless attempts of syncing the foliage position to the position of each tree matters no more.

It’s shaping up to be a pretty stable little package now, I think. Which, it should be, the game is too simple for things to be falling over.

Most of the bugs are from systems from some years ago when I was still learning code. That stuff’s invaluable, it’s messy and it hardly works, but it got me to my place of understanding today.

If this test goes all well, the next release will be focused on new content, rather than plugging holes.

That’ll be more fun for all parties.

Follow me on Twitter, or maybe even Mastodon.