Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Progress Report: Integrating JSON and Loading a Level

In last week’s report, I was starting to figure out how to best configure a map editor so that I could have an easier time loading dungeon levels in The Dungeon Under My House, my non-violent, first-person role-playing game and my second Freshly Squeezed Entertainment project.

I started the week hoping to make up for the previous week’s lack of effort.

Sprint 2024-13: Level editor

Planned and incomplete:

  • Create level editor

While I was more productive this week, I was still struggling to make time for game development due to other obligations, plus dealing with an unusual amount of ennui.

My main goal was to get my map in Tiled, which is exported in JSON, into the game as my dungeon level data.

I decided to use nlohmann’s single-header JSON library, partly because I figured it would be easiest to integrate into my project.

The documentation mentions ways to integrate it into a build using CMake or other build tools, but I think that might be for more complex situations.

What’s nice is that I can easily use the JSON library to create in-memory JSON to use in unit tests, allowing me to test drive my DungeonLoader code. Then, once I’m satisfied that the code works, I can easily use the same JSON library to load the level JSON file, pass in the JSON data, and expect it to work perfectly.

I imagine if I had a few more hours to dedicate to it last week that I could have finished the loader code. Maybe this coming week I’ll be able to be more focused and productive.

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!

Categories
Game Design Game Development Games Geek / Technical Personal Development

Toy Factory Fixer Post-mortem: Game Development in an Hour a Day!

In 2020, despite having a day job and having limited time to work on game development, I set out to make a game in a month.

A year later, my first Freshly Squeezed Entertainment project, Toy Factory Fixer, got published.

How did I do it? Slowly but surely in an hour a day! Watch this video to learn more about it.

Also, here’s a link to the blog post of the Toy Factory Fixer post-mortem with more details about the game project itself: Freshly Squeezed Post-mortem #1: Toy Factory Fixer https://www.gbgames.com/2022/01/11/freshly-squeezed-post-mortem-1-toy-factory-fixer/

Want to learn about future Freshly Squeezed games I am creating? Sign up for the GBGames Curiosities newsletter, and download the full color Player’s Guides to Toy Factory Fixer and other games for free!

Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Progress Report: Inching Towards a Level Editor

Last week, I reported that I created a heavy, metal door that required the entire party to open it in The Dungeon Under My House, my non-violent, first-person role-playing game and my second Freshly Squeezed Entertainment project.

I had started work on learning Tiled so I could use it as a level creator/editor, and my goal was to get a simple level imported into the game.

Sprint 2024-12: Level editor

Planned and incomplete:

  • Create level editor

Ok, so I’m doing less “creating a level editor” and more “bending Tiled to my needs” but ultimately the end result is that creating the dungeon layout will be faster and easier with its existence.

Unfortunately, this past week I struggled to get much time to work on game development. It was one of my least productive weeks in terms of hours, partly due to obligations outside of my business, but also partly because I spent some time on non-routine things. And I was feeling pretty tired and found myself wanting to nap more.

What progress I did make was mainly involved in creating a custom tileset for the floor and ceiling and figuring out how I can represent things in Tiled that need custom data.

For example, in the game, there is a ladder. A ladder can take you back to the house from the dungeon, but a different ladder might take you to a different level. So in the game’s code, it’s treated as a Portal. I envision not only ladders but also stairways being implemented as Portals, and a Portal has an ID that represents where it takes the player’s party if they use it.

Normal tiles in Tiled don’t have such custom information available. Tiled does have a concept of an Object which does, but an Object isn’t placed as a tile. It just floats in an arbitrary location.

So it seems like I can place Portals as objects in my Tiled map, then when I import the map data, I’ll need to figure out which dungeon grid cell the object is located in.

It’s not complicated, but as I’m still learning Tiled, I wasn’t sure if it was the best way to go.

Meanwhile, I am also figuring out not only how to make the map but also how to import it into my game. My game already uses YAML to persist and load data, but Tiled doesn’t export to YAML.

It does, however, export to JSON, and I can integrate a JSON library into my code, or I could use one of those JSON to YAML convertors that exist out there.

I’m anticipating a much more normal level of productivity this coming week, so I’m looking forward to making much more progress on Tiled so I can have a much easier time creating the dungeon levels.

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!

Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Progress Report: Really Heavy Doors Are Hard to Open

In my last report, the player can now use the flashlight to light their way through The Dungeon Under My House, my non-violent, first-person role-playing game and my second Freshly Squeezed Entertainment project.

I had also started working on adding a special door that required the entire party to open.

Sprint 2024-11: Intro sequence game play

Planned and complete:

  • Door with beam requires minimum number of party members (or strength) to open

Unplanned and incomplete:

  • Create level editor

To recap, my original intro sequence felt too long and boring.

There were unskippable scripts that explained that there was a new member getting inducted into the Explorer’s Club followed by the ceremony itself and then discussion about going on a Snack Quest, and it took too long before you felt like you were playing the game.

For some time I’ve been working on making the introduction more interactive and playable, introducing the main mechanics the player will use throughout the game as soon as possible, and I’m finally almost done with this entire sequence:

  1. The new member induction ceremony only starts once the player starts it, allowing the player to explore the bedroom and meet characters first if they so desire (Conversation mechanics, scripts, and flags)
  2. The Snack Quest starts either after talking to Pat after their induction ceremony or when trying to leave the room after the ceremony. (Quests aren’t yet an actual “thing” in the game, but mechanically this is just scripts and flags)
  3. The objective of getting the jar of pickles from the basement is added once the player enters the kitchen and talks to their parents. (Again, no quests, no objectives, just scripts and flags)
  4. The dungeon entrance is revealed after the player searches for pickles in the dungeon. (Flags and new art)
  5. The dungeon limits exploration without a flashlight. (Lighting, triggers, scripts)
  6. The flashlight can be found and acquired in the bedroom under the bed. (Added furniture, inventory, and items to the game)
  7. The flashlight allows the dungeon to be explored in the darkness. (Flags, scripts, and dynamic dungeon lighting)

The above has been more or less implemented, although I have some work to do to make the conversation mechanics more obvious and intuitive, plus I would like to make it more obvious how the secret door in the basement opens up. What was left to do for the intro sequence:

  1. The party finds a heavy, metal door at one end of the dark hallway, which requires a full party to open (flags, new door type)
  2. Once party opens door, they eventually find themselves in a wide open area with access to many parts of the dungeon.

My original idea for the door was that there would be a heavy beam acting as a drop bar that prevents the door from being opened. The only way to open it is to have a full party, as everyone will need to work together to move the drop bar.

It seems simple enough, but there were a lot of questions I had to answer:

  • Can I animate the beam moving, or should it just instantaneously be in a new position?
  • Where is the beam when it isn’t engaged? Lying on the floor? Leaning against an adjacent wall? Do I need to guarantee a wall is adjacent?
  • Should the player be able to re-engage the beam?

It seemed like a lot of work, and so I decided to just…not do it.

Instead, I decided to make doors have different weights. Normal doors are easy to open, but really heavy doors require more people.

The reason why I wanted a door to require a full party to open, whether it was with a heavy drop bar or just a heavy door, was that I wanted the player to have a reason to go back to the bedroom and get a full party together in case they decided to explore the dungeon early.

The Dungeon Under My House - door is too heavy

Basically, this intro sequence now teaches the player how to play the game: they have shown that they can talk to characters using the conversation system, collect items by interacting with inventories, navigate the darkness by using a portable light source in the form of a flashlight, and now add characters to their party.

So, now what? After the player opens the big heavy door at the end of the hallway, what happens then?

That’s when the rest of the game really starts.

But I of course need to create the next part of the dungeon that they would see.

Up until this point, I’ve been using my game’s code to create the dungeon, and it worked fine when I had a simple test dungeon of a few rooms and some doors, but it’s not terribly intuitive to work this way.

I knew that I wanted a GUI editor eventually, and in the past I looked into the Tiled map editor, but I decided it was time to look more seriously into it. I could create my own from scratch, which I imagine would be fun and all, but it would probably take me way too long to do, and I want to get the game finished sometime in my lifetime.

Thanks to eishiya in the Tiled Discord, I got some very direct help figuring out how to use Tiled to create the dungeon layout in a way that I can then use in my existing code.

The Dungeon Under My House - Using Tiled to create the dungeon layout

The above uses a tileset image that eishiya provided.

I still have some things to learn about how to use this tool, but I’m already figuring out some keyboard shortcuts and how to use layers. eishiya demonstrated how to use terrains to essentially paint the walls automatically, and I’m building up my own understanding of how to get there.

But besides figuring out how to use Tiled, my next main concern is to figure out how to import a simple map that I created, which should be straightforward although there is no Yaml export, and my existing code doesn’t have a JSON reader.

I am also interested in a custom exporter to make the map more directly related to how my code treats the dungeon levels.

Oh, and after a year of screenshots and videos, my wife alerted me to a typo that I have now fixed:

The Dungeon Under My House - FORWARD typo

The Dungeon Under My House - FORWARD typo fixed

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!

Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Progress Report: Lighting the Way

Last time, I reported that the player can now obtain items from furniture and that I was planning out how the flashlight will work in The Dungeon Under My House, my non-violent, first-person role-playing game and my second Freshly Squeezed Entertainment project.

I implemented a working flashlight and proceeded to work on the next in-game obstacle for the player.

Sprint 2024-10: Intro sequence game play

Planned and complete:

  • Flashlight automatically lights up dark dungeon

Unplanned and incomplete:

  • Door with beam requires minimum number of party members (or strength) to open

Now that the party can acquire a flashlight from under the bed, they can return to the dungeon to light their way through the darkness.

As I said in the previous report:

I think requiring the player to manually turn the flashlight on and off would be tedious.

Instead, I’d like the flashlight to turn on and off based on the current light conditions. So if the player is entering an area that is getting darker, then the portable light source turns on automatically, and once the player enters an area with getting brighter, the portable light source turns off automatically.

I figured a decent way to make it obvious that the flashlight’s status was changing was by popping up a piece of scripted dialogue.
The Dungeon Under My House - turning on the flashlight automatically

The Dungeon Under My House - turning off the flashlight automatically

I created two light thresholds, one for when it was getting too dark and you needed to use your portable light source, and one for when it is getting bright enough that the light wasn’t needed anymore. I figured that with two separate thresholds instead of a single boundary, the scripts wouldn’t pop up too frequently if the player decided to move back and forth between two grid cells.

The somewhat tricky part was the actual dynamic lighting of the dungeon. I was worried that the raycasted dungeon rendering code would be slowed down, but with only a handful of light levels being modified, it turned out that it wasn’t a big hit to performance.

Otherwise, it turned out to be straightforward to project out from the party’s current position and modify light levels on the fly, and as the party turns to the side, you can see that part of the dungeon gets lit up as they turn.

The Dungeon Under My House - dynamic lighting

I’m not entirely happy with it, as it seems to lighting up more intuitively when turning one way but not as much the other, but on the other hand, it’s a quick turn and the player might not see much anyway.

Another issue is that I think the way the lighting works is functional enough, but I wish it looked more like a flashlight, with a rounded illumination. But maybe I’ll come back to it in the future.

But one thing I want to address sooner than later is that it feels weird. The light projects out in a straight line, so you can see the cells directly in front of you, but the cells to either side are left at their default light levels, which can be pitch black. But instead of looking like you are walking in a dark hallway with a flashlight, it looks like the walls on each side are just super dark.

The Dungeon Under My House - dynamic lighting

Strangely and counterintuitively, to make it feel more correct, I might need to light up the cells to the sides a little.

But in the meantime, one more step in the intro’s game play is completed: the player can navigate a space that was originally too dark to proceed through.

I next started working on what the player would find at the end of the dark hallway. My plan was for it to be a door with a heavy beam across it. In order to open the door, the party would first need to remove the drop bar, and it would require a full party of three members working together to do so.

Currently, the only doors in the game can open and close, so adding a barrier and/or a lock was a future task, and the future is now.

It made me think about the need to persist the state of doors and how I might rearrange the data structures in a way that make it easier to save and load those states.

I’ve also been watching videos about level design, which got me thinking about this intro hallway. My original plan was to have one main way forward and one non-obvious and secret way into a different part of the dungeon. Now I am considering adding a third or even a fourth path, allowing a player who decided not to get the flashlight or not get a full party to proceed anyway. I’m considering how much freedom I want to allow the player to have this early and wondering if I should keep the intro sequence more direct and allow that freedom later.

But first, I need to work on the door, and that work should happen this coming week.

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!

Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Video Progress Report: Grabbing the Flashlight from Under the Bed

Here’s the companion video for Monday’s Freshly Squeezed Progress Report: Grabbing the Flashlight from Under the Bed:

Enjoy! And let me know what you think by replying below!

Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Progress Report: Grabbing the Flashlight from Under the Bed

In my last report from three weeks ago, I created inventory slots visible on the screen for the player’s party and created furniture with its own inventory for The Dungeon Under My House, my second Freshly Squeezed Entertainment project.

Since then, I have not been terribly productive. Between preparing for my tax appointment, grieving over my cat Gizmo passing away, producing updated versions of my leaf-raking business game Toytles: Leaf Raking for the Spring Sale, dealing with a minor cold, and participating in various family outings and obligations, forward motion on this project took a pause.

But I am slowly getting back into the game dev habit.

Sprints 2024-8 and 2024-9: Intro sequence game play

Planned and complete:

  • Allow player to search objects in room

Unplanned and incomplete:

  • Flashlight automatically lights up dark dungeon

As I predicted, viewing the furniture’s inventory was straightforward, but interacting with it took some effort.

I did some fun math to dynamically create the grid for a furniture’s inventory. The bed has 4 inventory slots, and other furniture might have a different number. The more slots available, the smaller they can be, but with fewer slots, the slots themselves can take up more real estate on the screen.

The Dungeon Under My House - furniture inventory view

I liked the way it becomes obvious that it is the focus of the current screen’s interaction.

As for actually interacting with the furniture’s inventory slots, what I decided to do was allow the player to select two different inventory slots to swap them.

This decision nicely solves the problem of what to do when a character’s inventory is full, as the act of dropping something to make room for it becomes a natural part of the interaction.

At least, it does for individual items such as a Flashlight. I haven’t addressed what should happen if the item has a quantity, but that’s for Future Me to worry about.

Also, Future Me, when you read this, don’t forget that we’ll need to figure out how the player should interact with the party’s inventory when not actively viewing furniture inventory. Thanks, you’re the best!

The Dungeon Under My House - furniture inventory interaction

The Dungeon Under My House - furniture inventory interaction

Once I had the ability to acquire items from furniture, another key part of the intro game play was completed: the party can get a Flashlight to illuminate the darkest parts of the newly discovered dungeon.

An obvious game play thing to do is to allow the player to interact with the item, and in this case, toggle the flashlight on and off at will. Then I can introduce the need to conserve the flashlight’s batteries and provide a means of replenishment of those batteries, either by recharging or replacement.

But while those mechanics sound kind of neat, and maybe in a different game they would be interesting to play with, in this game? I think requiring the player to manually turn the flashlight on and off would be tedious.

Instead, I’d like the flashlight to turn on and off based on the current light conditions. So if the player is entering an area that is getting darker, then the portable light source turns on automatically, and once the player enters an area with getting brighter, the portable light source turns off automatically.

And to avoid the tedium of having the light flicker on and off when crossing over a single light boundary, I think it would make sense to have two different thresholds. So the light turns on when entering a dungeon cell that is starting to become quite dark, but if you immediately leave that cell, the light doesn’t turn back off right away. You have to enter into a slightly brighter area before that light turns off.

But I’ll playtest it to see if it feels weird.

And naturally, the biggest concern is that if the flashlight is on, then the player should be able to advance into the darkest areas of the dungeon because they won’t be dark anymore. Which means rendering the dungeon by incorporating this temporary light level.

While the regular light levels spread out to adjacent cells, I think the effect of the flashlight on the light levels of the dungeon grid cells should mimic what a flashlight does. It will be a directional light, so the only cells affected are directly in front of the party.

Of course, what happens when the player turns to the left or right? I am sure I can mimic the arc of light that would occur naturally, but it might be a bit tricky.

But by the end of the week, most of this work was only on paper, so expect to see how I actually implemented it in my next sprint report.

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!

Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Video Progress Report: Items & Inventory

Here’s the companion video for Monday’s Freshly Squeezed Progress Report: Items & Inventory:

Enjoy! And let me know what you think by replying below!

Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Progress Report: Items & Inventory

In my last report, I prevented player navigation in the dark, then started working on the inventory system for The Dungeon Under My House, my second Freshly Squeezed Entertainment project.

I continued the inventory work this past week.

Sprint 2024-7: Intro sequence game play

Planned and complete:

  • Party member can carry items

Unplanned and incomplete:

  • Allow player to search objects in room

I started the week my rendering the inventory slots for individual party members. For now, each party member can have three items in their inventory, and you can see it in the HUD.

The Dungeon Under My House - inventory slots

And I created a sprite for the Flashlight and made sure that it displayed in those slots if a party member had it in their inventory.

The Dungeon Under My House - inventory slots

That worked when I temporarily coded it in, but the next thing was to have furniture in the room that the player could search and find items such as the Flashlight.

So I created the concept of Furniture. Right now, everything in the room is just drawn as part of the background, but now you can click on something such as the bed in the bedroom and get a description.

The Dungeon Under My House - furniture

Now the other interesting thing about Furniture is that it can have its own Inventory. I had trouble getting things to persist properly until I simplified my code and data structures a bit, unfortunately.

So by the end of the week, I still needed a way for the player to view a given furniture’s inventory slots, then allow the player to take items and put them into their own inventory.

I imagine that this week I’ll find the former is straightforward but the latter will require some effort to handle edge cases and user interface issues.

For examples of things I anticipate needing to worry about, how should the game respond if the player’s inventory is full? Can the player transfer items to the furniture as well? Can I create an interface that allows someone to either use the mouse or a keyboard?

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!

Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Video 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:

Enjoy! And let me know what you think by replying below!