Recounting the 2022 GMTK Game Jam (Part 2)


Last time I recounted day 1 of the jam. In summary, I came up with a set of rules for the game, but the game loop itself wasn't entirely clear. I also managed to implement drag and drop.

A day of yak-shaving

It turns out that I had cut some corners to implement drag and drop. Basically I had made the board (where you drop the dice) its own unique thing with its own unique logic, rather than sharing any code with other entities. This bothered me because if I continued in this fashion I would have to write a lot of the same code for each new type of thing I implemented (e.g. cards, buttons) and it would be harder to change the board in the future. So I decided to rewrite the board logic so that it would behave like any other object. This would be important for having centralized logic for hit testing (i.e. checking whether the mouse pointer is inside the bounding box of the object) as well as rendering. To the outside observer, this would look like a step back. However, my gut told me that this would make things easier for me for the remainder of the jam. My gut is often wrong, but there was no one around to tell me no, so I followed it. Looking back, I think this was a good move. Good job, gut.

I had also created a scary spaghetti ball of state to manually move the dragged entity around with the movement of the mouse cursor. Then I realized that I could simplify this code with the entity tree system (which I initially devised only for the dice and board) by simply creating an entity for the mouse cursor and parenting the dragged entity to the cursor entity.

Finally, I wanted to model the board in a way that was conducive to moving not just individual dice, but stacks of dice. I considered at least 2 different approaches. Initially I thought about modeling the board as a grid. Then when I grab a dice at the bottom of a stack, in addition to parenting the grabbed dice to the cursor, the game would check for any dice above and parent those to the cursor as well. Then when I drop those dice, I would need to check where each of those dice should end up based on their current position. The complexity of this solution bothered me, so I considered another approach. I would again leverage the entity tree system by making the dice stacked on top children of the dice on the bottom. This naturally handles the positioning of the dice on top of the held dice, and the logic for placing a stack of dice becomes equivalent to the logic for placing a single dice. This feels cool. The downside is that the board has to be structured primarily as a tree rather than a grid, which would complicate the process of checking for horizontal rows of n-of-a-kind. I actually almost finished implementing the first solution before deciding I would switch to the second one, so I definitely backtracked again a good bit here. On the surface it probably looked like I was spending a long time on the seemingly simple task of moving a stack of dice.

Morale is low

At this point, my morale is in the gutter. Demonstrable progress is slow, I haven't been able to properly sit down and get a feel for the game flow yet, I had no art or sound effects to speak of, and as the game was taking shape, it was starting to occur to me that my game was not terribly compelling. I took two naps, one in the afternoon and one in the late evening. At around the mid-afternoon of the second day, this is what I had. 

After I woke up from my second nap, it was around midnight, 10 hours before submission hour. "I'm not even close. I should quit," I thought. I nearly did quit. But I had just woken up from a 2+ hour nap, so I wasn't tired. So I just laid on my couch and thought about what I should do next. I didn't realize it at the time, but I was about to work furiously for the next 12 hours straight, stopping only once to shower.

... but that's a story for another post. That was the end of day 2! A very technical day that felt like a slog, but probably served as an important foundation for what was to come. At least that's what I'll tell myself.

Get Dice Attack!

Leave a comment

Log in with itch.io to leave a comment.