Last time, I reported that I was replacing my test dungeon with the first actual locations for The Dungeon Under My House, my second Freshly Squeezed Entertainment project.
I set out to allow the player to interact with the new environment.
Sprint 2024-6: Pre-production and initialization
Planned and complete:
- Prevent player navigation if dungeon area is pitch black
Unplanned and incomplete:
- Party member can carry items
Last week started out quite productive, and I was able to knock out a feature that impacts the player’s navigation through the dungeon. If you are trying to move into a grid cell that is too dark, the game stops you from proceeding.
The way it does so is by treating the darkness as an obstacle, much a wall or closed doorway that prevents movement and tells you why.
And in this case, it hints at the next set of features I need to implement. You need a flashlight to proceed, and that means the characters need to be able to carry items, which means the game needs an inventory system.
I created an inventory system that allowed for two different types of items: individual items that take up an entire slot, and items that represent quantities.
So a Flashlight exists as an individual item. If you get a second Flashlight, it takes up a second slot.
But a Pickle Jar represents not just a jar but also the contents of the jar. Maybe you eat some of the pickles but not all of them at once. The original Legend of Zelda game had two kinds of potions, and one of them was basically “you can use it twice.”
I like the idea that using up all of the pickles results in an Empty Pickle Jar, which can come in handy.
But that can come later.
I spent a little bit of time trying to figure out how complex adding items to the player’s inventory should be. What if you have get a second jar of pickles? Does it add to the quantity of the original jar, or do you just get two jars, each with a set quantity? Most games do the former, but practically speaking, who wants to merge pickle jars together? Ew.
But I decided that such design decisions can come later when I need to decide them. For now, I created a simple Inventory which I can assign to entities in the game. So I did, and my next job was to ensure that inventories can get persisted when the player saves.
Which did not work, and it was incredibly bizarre because the code looked like it should. Yet running the tests was telling me that it wasn’t.
So I ended the week by losing productivity because I had accidentally introduced a bug that was manifesting in weird ways. I had one unit test that kept insisting that as soon as I added an item to an inventory that the inventory was still empty, and other seemingly unrelated tests would inconsistently take up a ton of memory on the system, seeming to lock everything up for minutes at a time.
Ultimately what was happening was that I was initializing my inventory’s internal std::vector and the internal integer that initializes its size in the wrong order, which meant, well, most likely it is undefined what happens, but it includes in the realm of possibilities initializing the size of the vector of Items with a very, very large value.
Once I figured it out, partially due to lots of logging statements and mostly thanks to the amazing tool valgrind highlighting the exact problematic code (and thanks to my Past Self for having high standards so that there wasn’t a lot of other noisy output due to other problems to wade through), I corrected the mistake, but by that point, it was a few precious hours of development later.
Never code tired.
Anyway, this coming week I anticipate finally adding the ability for the player to inspect the inventory of a particular party member as well as find items in other parts of the game, such as the bedroom where the flashlight will be.
And once the player can acquire a flashlight, being able to light the way in the darkest areas of the dungeon comes next.
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!
2 replies on “Freshly Squeezed Progress Report: Dungeon’s Too Dark, Can’t Proceed”
[…] Here’s the companion video for Monday’s Freshly Squeezed Progress Report: Dungeon’s Too Dark, Can’t Proceed: […]
[…] my last report, I prevented player navigation in the dark, then started working on the inventory system for The […]