The first avatar created by the new codebase.

This past couple of weeks haven’t been super productive, and graphically not much has changed, but I’ve been playing with creating object pools to get around the slow speed of GameObject instantiation in Unity.

If you don’t know the term, then pooling is when you create a large number of objects, like health bars or characters, when you first start the game (or level). You can then just use one of the now, pre-existing objects instead of having to instantiate a new one. When you’re done with it, you disable it and flag it as unused again.

This is particularly useful when doing special effects like particle effects or blood splatter, as you can set a maximum number of items in the pool and then just re-use the oldest one. Most first-person shooters do this with bullet hole decals. You can see it by using an automatic weapon to try and write your name on a wall. In most of them you’ll see the start of your name disappear before you get to the end.

Anyway, the image above shows the player’s image and health bar being pulled from separate pools, and built to a requested spec. This is the first step to having all of the characters being built from a config file so each level can be created easily.

Next up will probably be finishing this off for both player and enemy characters, and then maybe even dealing with collisions properly.