Last time, I reported that I had finished the work of giving an item to another character and adding a trigger that produces an item in a furniture’s inventory in The Dungeon Under My House, my non-violent, first-person role-playing game and my second Freshly Squeezed Entertainment project.
I then wanted to make it possible to see such items when they are available.
Sprint 2024-29: Preview furniture in a location
Planned and complete:
- Show item on counter on actual counter in kitchen
Unplanned and complete:
- Defect: Crash when trying to add items to inventory after load
Unplanned and incomplete:
- Allow player to give/take arbitrary number of multi-quantity item
A Furniture object can have an Inventory, and when it comes to things like drawers and fridges, it makes sense that you have to open them before you can see what’s available.
But after you give the Pickle Jar to your parents in the kitchen, they make snacks and put them on the counter.
And after this past week’s efforts, I’m happy to say that you can now see what’s on the counter without having to open up the Kitchen Counter furniture view.
I created a FurniturePreview object, which renders on the screen whenever you are in a room with a Furniture object that has one associated with it.
While testing, I realized that I had some issues with persistence. First, I couldn’t figure out why the snacks weren’t appearing on the counter despite everything looking right, but debugging showed me that when I load the game from a save file, it wasn’t overwriting the default inventories but instead appending the saved ones after the default ones. So I addressed that issue.
But I also discovered that the snacks were disappearing once they were added to the counter if I immediately load the game afterwards. Basically, once an item gets added to a furniture, I needed to save the game. I decided to log the defect and address it after the work i was doing on multi-quantity items.
Before, moving items from one inventory slot to another was an all or nothing deal. It makes sense for single items like the Flashlight, but Snacks are quantified. So I added an interface to allow the player to choose a quantity.
The trick here is that I don’t have any real way to keep track of the transaction, so it comes to this interface, it is immediate. That is, if you decide to swap snacks with an inventory, the inventories update in real-time.
The interface for giving items to another character, however, is a bit different. Instead of immediately giving the item, it is a two-stage process.
First, you choose what you want to give. Then, you attempt to give the item, and if the other character has space in their inventory, they’ll accept it. Otherwise, the item stays in your inventory.
With non-quantified items, the item doesn’t actually leave the inventory of the party until after it is confirmed that the other character has room to receive it.
So I ended the week trying to figure out how to allow the player to choose to give an arbitrary number of a quantified item to another character in a way that is both intuitive for the player and isn’t ridiculous to code. Ultimately I decided to create a Give Item scratchpad inventory. That is, it is an inventory with the purpose of temporarily managing the giving of items.
Effectively, you are swapping immediately with this temporary inventory, then when the gift giving is confirmed, the other character receives it from the temporary inventory, but if the gift is rejected, then the party receives the temporary inventory back.
Of course, it is important to make sure it is returned to the correct character’s inventory slot, and now you can sorta see why game design can be challenging. B-)
Thanks for reading!
—
Want to learn when I release The Dungeon Under My House, or about future Freshly Squeezed games I am creating? Sign up for the GBGames Curiosities newsletter, and download the full color Player’s Guides to my existing and future games for free!
One reply on “Freshly Squeezed Progress Report: Seeing Snacks on the Counter”
[…] last week’s report, I made it possible to see furniture inventory previews such as Snacks on the Kitchen Counter and […]