075 - A Fledgling Game Editor

July 12, 2020

This week I released some smaller updates to various systems and aspects of the game, but no large new pieces of gameplay were deployed.

World screenshot A stroll through the world of Akigi.

I've been consistent with deploying at least one thing to the game everyday, but I still need to figure out how to maintain a cadence of releasing one larger piece of gameplay every week.

It's something on the top of my mind, but I don't have a solution just yet.

The Akigi Editor

In last week's journal entry I mentioned that I had begun laying some ground work for a game editor.

I made some good progress this week after fixing a number of issues and missing features within the renderer-metal crate in my Cargo workspace.

Now there is enough in place to be able to play the game from within the editor, even though it does render everything properly yet.

The game editor rendering the game twice. Once to a desktop size and again to a mobile screen-size. Unlike the WebGL renderer, the Metal renderer does not support vertex skinning yet. So T-poses galore. It also does not render text properly yet and leaves gaps between terrain chunks, among other issues. The game interface does not get laid out properly at mobile screen sizes yet (top-right).

I'm running the editor as a desktop application since that allows me to easily access the filesystem in order to save and load various game data files.

The editor is being designed to be able to be easily ported to the browser as a WebAssembly binary should I ever want to run it there, but for now I'd like to avoid needing to set up the plumping that would be required to modify the file system from the browser.

Pathfinding ain't cheap

I made what I thought was a harmless change of adding a dozen or so entities to the world and much to my surprise one of my integration tests started to fail.

It turned out that it was timing out because adding these entities made the game ticks run roughly 300x slower on average.

My hunch was that it was due to inefficient pathfinding, and that turned out to be the case.

After doing some benchmarking and looking at a few flamegraphs I managed to make a few changes to the game's pathfinding that make things perform well-enough for now.

There are some future performance optimizations to be made such as pre-calculating the cost of going from one tile to all other tiles within some radius and then using those pre-calculated costs for nearly-free pathfinding, but I'll explore this in the future whenever optimizing performance becomes pressing again.

There are also some unnecessary allocations to remove and some small loops that I'm not sure are being unrolled by the compiler, but, these are not currently pressing issues to fix.

Average tick duration After adding a handful of entities to the world the average game tick duration on the production 2-core server grew, while the maximum stayed roughly the same or even dropped a bit. I haven't looked into what leads to these tick duration anomalies - not currently pressing.

Other Notes / Progress

  • Fixed an edge case where entities would end their walk animation one tile before reaching their destination.

  • More progress on the Metal Graphics API renderer.

  • A few new models.

  • Gzipping the WebAssembly binary, reducing the size from 1.1 MB to 350 KB. Still need to add gzip compression to other assets such as meshes, armatures and fonts.

  • Made the asset compiler deterministic so that we weren't getting different asset hashes and invalidating the cache everytime we deployed.

  • Added support to specify that certain textures need to always be placed together when generating texture atlases, which fixed an issue where the multi-textured terrain sometimes did not have all of its textures in the same atlas.

  • Going through Adobe Illustrator tutorials which will help me with creating icons for the game.

Next Week

I've been saying this for a few weeks now, but I need to write and finish the Tutor of Science quest.

I realized that a potential issue has been that I deviated from how I had approached the other quests.

With the other quests I was writing tests as I wrote the quest dialogue. So I always had a test that I needed to get passing which helped me stay in the zone.

This time around, since I now have a good bit of automated smoke-testing in place for all game dialogue, I tried to write the entire quest and then circle back at the end to add any specific tests that are not covered by the smoke tests.

This was too much writing for me to do at once without a feeling of progress, which has led to not spending enough time on it.

So this week I'll be doing back to writing quest-specific assertions as I write the quest dialogue, which should hopefully be a more comfortable way for me to work.

I'll also continue to make more progress on the game editor. I have my mind on adding the ability to place scenery into the game using the game editor.


Cya next time!

- CFN