088 - Generic Asset Compilation

October 11, 2020

This last week saw me getting settled in and productive after dealing with moving out of my apartment at the end of September.

I had two main work streams over the last week.

One was continuing to work on the tool for placing initial entity spawn points within the game editor.

The other was spending a couple of days making a plan for finishing and releasing a first version of Akigi.

Placing Initial Entity Spawns

There are a few different ways to spawn entities in Akigi, each catering to a different use case.

The one that the editor leans on is an approach where I use an enum to describe how to spawn an entity.

This approach makes it easy to add multiple instances of some set of components without needing to repeatedly list out all of those components. When deciding how to spawn the entity a function matches on the enum variant and uses that to initialize the entity's components.

When we need more variety for how an entity can be spawned we can add fields to a descriptor variant, or just add a new variant.

Here is how the EntityToSpawnDescriptor looks for Akigi.

/// Describes how to spawn an entity
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize, Serialize)]
#[allow(missing_docs)]
pub enum EntityToSpawnDescriptor {
    // ...
    AnnattoJar { quantity: u32 },
    // ...
    Mosquitos { wander: TileBoxName },
    Rocks { quantity: u32 },
    Snail,
    SnailBody { quantity: u32 },
    SquashedMosquito { quantity: u32 },
    // ...
    ViciousCatClay,
    Capuchin,
}

The bulk of this week went to some of the work that surrounds placing entities in the editor. This work is not yet completed but should be completed by the next journal entry.

The editor displays entity spawns by rendering the entity that is being spawned.

In order to do this, the editor needs to be able to loading assets and buffer them onto the GPU.

This requirement led to me working on the some of the engine's asset management code to make it more generalized.

The asset management code was previously largely coupled to Akigi's expectations, but I've made it more general.

The typetag library came in handy for this workstream, allowing me to define an Asset trait and then serialize and deserialize trait objects for different assets.

I also started moving towards a plugin system for asset compilation.

The asset compiler now reads a configuration file from the project that is being worked on in order to find the locations of dynamic libraries that expose implementations of an AssetCompiler trait.

Now projects can support arbitrary assets.

Planning Retreat

In 087 I mentioned that I was going to do a bit of planning for Akigi.

I spent a couple of days at a hotel writing out my plans in a notebook.

I still need to type them up - but I have a much better sense of my path forwards now.

Other Notes / Progress

  • Chatted with Forest Anderson from the Veloren team to get some advice on AWS. Was a fun chat.

Next Week

By the next journal entry I plan to finish up the tooling for adding initial entities into the world so that I can get started on the first skill in the game.


Cya next time!

- CFN