Homegrown: Inventory and Old Code

This week saw a rework of Homegrown's inventory system and the beginning of a rework of its U.I aesthetic. The U.I. system needed to improve for the title screen and inventory window, and the inventory system needed to adjust to store player models and be accessible for both inventory viewing and block placement and removal.


Though inventories could already store blocks, there was no way to store any other kind of data in a player's inventory. Now, models (and, potentially, other kinds of items) can be stored in the inventory as well. Relatedly, there's now back-end code to support “trashing” models (to decompose them into the blocks they're made of and put those blocks into the trasher's inventory) and picking models up (to put them in a player's inventory).

The data structure for the player's inventory was originally very simple: it was a dictionary consisting of item IDs and quantities stored with the player object. As more kinds of data need to be stored in the inventory, and as the data within that inventory needs to be accessed from more locations (like a GUI), it is becoming increasingly clear that the inventory is an entity distinct from the player object, and while it is convenient for the server to only have one object of reference for players, this creates a very bloated object with confusing, difficult-to-maintain code. Soon, the inventory and the player object will need to be separated.

U.I. Redesign

Work on U.I. had slowed dramatically until this week. When you're improving and learning, it's easy to look back on things you've made in the past and become disgusted. I realized I had become so frustrated with the way I thought I had written the U.I. code and with U.I.'s overall appearance that I hated the idea of even touching it. This week, I finally took a stab at redesigning this old, messy system. To my surprise, though, it was not as bad as I thought: there were certainly a few cobwebs here and there, like tightly-coupled G.U.I. and logic code, and a few inheritance inconsistencies, but there's nothing that can't be reasonably fixed. A complete redesign of the system would likely be a waste of valuable time.

Part of my frustration likely also stemmed from the overall look and feel of the U.I. The game has changed somewhat since its initial design, from a cartoonish and cheerful aesthetic to a slightly more serious one. With this in mind, I implemented a few changes: firstly, the U.I.'s bouncy animations were replaced with simple open-and-close with a slower, fading background; there is no longer a delay in showing the requested content. This makes the U.I. much nicer to deal with. Secondly, I replaced the light colors, thick borders and Quicksand font with a darker color scheme, no borders, and a font pairing with El Messiri for headings and Work Sans for other text and any player input. While I'm not committed to these fonts yet, these changes altogether lend the U.I. some professionalism while still allowing it to feel like a comfortable game.


Next week, look out for a post on struggles with the visual aspects of the game (including U.I. and other artwork) and the concept of the vertical slice, and how that might relate to Homegrown.

If you're interested in keeping an eye on Homegrown as it develops, subscribe!

#Homegrown #Gamedev