Gameplay | QA Programmer
Five itens at grocery store.
About
Five itens at grocery store is a project that I made to understend some systems and mechanics in video games.
In this project I work with state machine, save/load system, audio manager and Bundle Load.
Project Info
👤Role : Gameplay Programmer
👥Team Size: 1
⏳Time Frame: 3 week
⚙️ Engine: Unity (C#)
In Five Items at the Grocery Store, players take on the role of a ranger on a mission to collect five random items from a bustling grocery store. Each item has a predefined price, and the goal is to gather all five items and proceed to the cashier to complete the game. The gameplay is divided into two engaging minigames: a memory-based shelf interaction and a timing-based fishing minigame. The player is not penalized for failing minigames, making the experience relaxed and enjoyable. Once all items are collected, the player can head to the cashier to tally up their total cost and complete their mission.
Memory Minigame: Shelf Interaction
The memory minigame challenges players to recall the location of a specific item on a shelf. At the start of the minigame, all items on the shelf are briefly revealed for less than a second, giving the player a quick glimpse of their positions. The goal item is displayed above the shelf at all times, so the player always knows what they’re looking for. After the items are hidden, the player must select the correct item from the shelf based on their memory.
The shelf is represented as a 2D array, with each item mapped to a specific position. To keep the minigame fresh and challenging, a shuffle algorithm randomizes the positions of the items at the start of each round. If the player selects the correct item, it is added to their inventory. If they choose incorrectly, the minigame simply resets, allowing the player to try again without any penalties. This forgiving approach ensures the game remains accessible and fun for all players.
Fishing Minigame: Cooler Interaction
The fishing minigame tests the player’s timing and reflexes. In this minigame, the player must click at the right moment to "catch" an item from a cooler. A hook visual appears on the screen, and a trigger sound effect plays to signal the ideal moment to click.
The timing for the hook and sound effect is randomized within a set range to keep the minigame engaging.
If the player clicks within the correct timing window, they successfully catch the item, and it is added to their inventory. If they miss the timing window, the minigame resets, and they can try again without any penalties. A progress bar provides visual feedback to help players gauge the timing, making the minigame intuitive and satisfying to play.
Item Prices and Inventory System
Each item in the game has a predefined price, which is stored in its associated ScriptableObject. The inventory system tracks both the items collected and their total cost. Players can view their inventory at any time to see which items they’ve gathered.
Cashier Mechanic: Completing the Mission
Once the player has collected all five items, they can proceed to the cashier to complete the game. A "Go to the Cashier" button is available in the in-game menu, but it is only enabled when the player has all five items in their inventory. Clicking this button triggers the endgame sequence, where the game calculates the total cost of the collected items and displays it to the player on a summary screen. This screen also includes a congratulatory message, marking the successful completion of the mission. The cashier mechanic provides a satisfying conclusion to the gameplay loop, giving players a clear sense of accomplishment.
State Machine Architecture
The game’s flow is managed by a State Machine with four primary states:
-
Run State:
-
Handles player movement and exploration of the grocery store. The player navigates the environment using Unity’s Input System, interacting with shelves and coolers to start minigames.
-
-
Mini Game State:
-
Activates either the fishing or memory minigame based on player interaction. This state manages the minigame-specific logic and transitions back to the Run state upon completion.
-
-
Pause Menu State:
-
Freezes gameplay and displays a menu with options to resume, go to the cashier (if all items are collected), or load the last saved game.
-
-
End Game State:
-
Triggers when the player collects all five items and clicks the "Go to the Cashier" button. This state displays a summary screen with the total cost of the items and a congratulatory message, marking the end of the game.
-
Pause Menu Features
The Pause Menu offers three options to the player:
-
Resume:
-
Exits the pause menu and returns the player to the game.
-
-
Go to the Cashier:
-
This button is only enabled when the player has collected all five items. Clicking it triggers the endgame sequence, as described above.
-
-
Load Game:
-
Allows the player to load their last saved progress. Every time the player successfully collects an item, the game automatically saves their inventory. If the player closes the game and reopens it (resulting in an empty inventory), they can use the Load Game option to restore their progress from the last save.
-
-
Quit:
-
Allows the player to close the game.
-
ScriptableObjects for Items
All items in the game, such as bread, cheese, and lettuce, are created using ScriptableObjects. Each ScriptableObject contains metadata about the item, including its name, icon, price. This approach makes it easy to manage and expand the game’s item database, ensuring that new items can be added quickly and efficiently. ScriptableObjects also allow for consistent and organized data storage.
Audio Management with AudioPool
Sound effects and music are managed by a singleton AudioManager, which uses an audio pool to preload and reuse audio sources. This reduces runtime overhead and ensures smooth playback of sounds. Sound effects are triggered during specific events, like the hook sound in the fishing minigame or the item flip sound in the memory minigame. The audio pool ensures that sound effects are played efficiently, minimizing memory usage and improving performance.
Asset Loading with BundleLoader
To optimize performance and manage assets efficiently, I implemented a BundleLoader system. All items and audio files are packaged into asset bundles, which are loaded asynchronously at runtime. This approach reduces the game’s initial load time by ensuring that only the necessary assets are loaded into memory. The BundleLoader system also makes it easy to update or add new assets without requiring a full game rebuild, providing flexibility for future updates.
Challenges and Learnings
Developing Five Items at the Grocery Store was a rewarding experience that taught me a great deal about game design and Unity development. Using ScriptableObjects for items streamlined data management but required careful organization to avoid clutter. Implementing the BundleLoader system for asset loading was challenging but significantly improved performance. Balancing the difficulty of the minigames to ensure they were fun and engaging took several iterations, but the final result was well worth the effort.
The auto-save and load system added a layer of complexity but greatly enhanced the player experience by allowing them to resume their progress seamlessly. Every system, from the inventory tracking to the cashier mechanic, pushed me to think critically about design and implementation, resulting in a polished and enjoyable game.
Download and play Catch the Pigeons on itch.io or check out our repository at github.com



