109 - Editor Undo Redo

March 7, 2021

This week I got undo and redo working in the editor.

Pressing `Ctrl + Z` in the editor to undo terrain displacement painting.

This was important to get in place sooner rather than later so that I didn't build up a large number of edit operations that I would later have to implement undo operations for after the fact.

I'm happy with how the undo redo architecture turned out and continue to remain excited for the long term potential of the editor.

Runtime Texture Allocator

The ak dist game-asset CLI command prepares all of the game's assets. This includes work such as exporting meshes from Blender or rendering icons for items.

Part of this asset preparation process assembles the game's textures into one of several texture atlases that the game later downloads at run time.

This is a flawed approach since in order to get access to one texture you have to download an entire atlas that might contain textures that you don't currently need. Texture memory is a finite resource, so this waste can show itself quickly, especially on mobile devices.

I'm moving towards a different approach where individual textures are downloaded as needed at run-time and inserted into GPU textures in a location determined by a CPU side runtime texture allocator.

For now this allocator is just wrapping rectangle-pack, but in the future I can imagine having an enum of a few different allocators that I can choose from based on the different trade-offs.

This is a work in progress. I don't plan to implement de-allocation until some future time, so I should be able to slot rectangle-pack in as it exists today. In the future, though, I'll need to give rectangle-pack support for re-introducing free space back into a bin so that it can be used to handle de-allocations.

Other Notes / Progress

Switched to using a g4ad 4x large on demand EC2 instance to power the linux portion of my GitHub Actions CI.

This is because the asset compilation process now uses wgpu-rs in CI when generating icons for textures, which means that I needed the CI instance to have a GPU.

wgpu-rs is using Vulkan under the hood on Linux, so I had to fiddle a bit with installing Vulkan drivers.

I also needed to ditch Docker in CI since I couldn't find a way to interface with the host machine's AMD GPU from within a Docker instance.

I keep the instance shutdown when I am not using it since it costs over $300/month to leave online at all times.

Since it's almost always off I should only end up paying around $5/mo or less for it.

Monthly Finances

The finances for February 2021 were:

itemcost / earning
revenue+ $4.99
Stripe fees- $0.44
aws- $234.66
adobe substance- $19.90
GitHub- $9.00
adobe photoshop- $10.65
adobe illustrator cancellation fee- $44.76
Datadog Inc- $7.87
total- $322.29

Next Journal Entry

March 8th if the five year anniversary of the first commit to the Akigi codebase.

I'll be reflecting on that in next week's journal entry.

I will be back next week. Goodbye for now.