In this lovely farming game I was one of two programmers as well as the Game Designer and UI Artist. I worked in a team with Nick Alves and while he created the gameplay relevant code, I created everything from the items to the inventory, a dialogue system and took care of the sound implementation with Wwise.

The Inventory System
For the base of the inventory system I utilised the buttons Unity provides. The reasoning behind this was that they are already animated and I don’t have to write the navigation in the inventory.



With the navigation out of the way, I could concentrate on the more important parts of the inventory: storing and updating the data.
There are two components that make up the inventory: the inventory controller and the inventory space. The controller manages the incoming and outgoing data so the spaces may only hold the data of what they contain and what image and number to show when the inventory is opened.

public void UpdateSelf()
	{
		Image[] images = GetComponentsInChildren<Image>();
		if (m_ItemQuantity == 0)
		{
			m_HeldItem = null;
			for (int increment = 0; increment < images.Length; increment++)
			{
				if (images[increment].gameObject.GetComponent<Button>())
				{
					images.SetValue(null, increment);
				}
				if (images[increment])
				{
					images[increment].sprite = null;
					images[increment].color = new Color(255, 255, 255, 0);
					GetComponentInChildren<TextMeshProUGUI>().text = "";
				}
			}
		}
		if (m_ItemQuantity > 0)
		{
			for (int increment = 0; increment < images.Length; increment++)
			{
				if (images[increment].gameObject.GetComponent<Button>())
				{
					images.SetValue(null, increment);
				}

				if (images[increment])
				{
					images[increment].color = new Color(255, 255, 255, 255);
					images[increment].sprite = m_HeldItem.sprite;

					GetComponentInChildren<TextMeshProUGUI>().text = m_HeldItem.isStackable ? m_ItemQuantity.ToString() : "";
				}
			}
		}
	}

Every time the inventory space gets a new item the function above is called. First it searches for the images of the inventory space. Due to the way the spaces are build in engine, they have two images which are searched by GetComponentsInChildren();. Now, if the item quantity reached 0 since the last update, the image and the item held by the space gets reset.
If the quantity is above 0 the image gets set to the image that is predefined in the item data stored in a scriptable object. Furthermore, the text gets set to the quantity within the item. Except for when the item is not stackable. Then it only sets the image.

The Dialogue System
Our team wanted to have dialogue within the game to tell the story and give the player a reason to progress within it. We decided to have the dialogue triggered whenever the player leaves the house after a night of sleep. However due to time constraints the dialogue was only used for the tutorial.

To give the writer the ability to implement the dialogue themselves the system is build to have an interface within the inspector. It holds the information for a full dialogue within and can be triggered when different steps of potato growth are finished. Sprites and names of the speakers can be added to give the player an indication of who is speaking. Furthermore, an object could be spawned into the game world at a certain location that has to be predefined. You can see the whole code here.

Game Design
During my time in the project I was tasked to do the game design together with Nick Alves. We managed to work out an interesting assortment of crops for the player to grow and decided which features we were going to use and which ones not. Of course at some point in development we had a rich feature list which we ultimately sacrificed due to time constraints.

Drawing
Besides being a passionate programmer, I like to draw comics in my free time. So, I have been tasked with drawing the UI elements you see in the game.

loading
×