Project: Dungeon Explorer (codename)
Goal: Develop and release first game
Initial Commit: 7 Aug 2019
Dev Hours Since Last Devblog: 14.11
Total Dev Hours Spent: 47.16
Allocated Dev Hours for Project: 160
At a Glance
This past week I spent time fixing the quest board so the game displayed all the available quests. My wife provided some updated sprites for the trap and puzzle encounters. I also researched the lore of the singleton and forearmed with that knowledge I created my Game Manager class. I found lots of conflicting and negative views exist about singletons in Unity, so in a future post I will explain why I chose to use one and why I designed it as a generic base class. Another good week of questing.
As I discussed in last week’s devblog, I had an issue with the game not running in the background. I fixed this issue in a few minutes on Sunday and then continued on to accomplish a total of 15 commits on 2 branches.
Starting and Finishing the Quest Board
I used the left side of the screen to display the quest board, the place where all active quests get listed for the player. Since I divided the game into 12 zones, each zone lists its own quests. I expected this code section to be harder than it was. In a few days I had all 12 zones created and tested the first zone, the Plains Zone, with over 25 quests at once. Everything worked as I wanted it too for alpha.
Puzzle and Trap Encounter Sprites
My wife finished rough sketches for the puzzle and trap encounters. I learned that if I updated the PNG file outside of Unity then Unity remembers all my sprite editor customizations and I don’t have to redo anything. Woot!
Starting the Game Manager
After I finished up with the Quest Board I moved on to the Game Manager (GM) code. Of course, finishing one piece of code and moving to another wouldn’t be complete without a useless side trek. I forgot to merge my QuestBoard branch onto master before I started on the GM code. D’oh! I skilled up in git that day and learned all about stashing.
I created the GM branch on 5 Sep, and while I made some progress I am in uncharted territory right now. I have read up on GMs and have some theory floating around in my head, but no practical experience. After fumbling around for a bit I finally made some headway by remembering my design patterns, specifically the singleton.
Initially, I implemented a basic singleton on my GM class and went about my way. Then I found myself face down in a common pit trap (luckily not a spiked pit trap). I had turned my GM class into a huge global variable. Ugh. I found my way clear of the trap and researched singletons in Unity. I found that a lot of people don’t like the singleton for exactly this reason, it’s to fall victim to the trap. I have never been a person to avoid a tool just because some (or most) people misuse it or don’t understand how to use it properly. I read up on the issue’s lore and decided on my course of action. I gutted my “global variable” mess and rebuilt from scratch, this time creating a
Singleton<T> class and deriving my GM from it. I also pushed all code responsibilities out to the lowest level object that could handle it. I will use the GM class to manage major functionality, e.g., saving, loading, resetting, etc, as well as other functionality as I discover them.
On a connected note, I found good sources for coding a singleton in Unity and I plan to write a separate post with specific code samples. Look for that in the next two weeks.
Keep On Questing
I won’t get much coding done next week, as I’m attending a board gaming con in Raleigh from Wednesday through Sunday. I still plan to get at least an hour of code in every day because that’s all part of my 100 Days of Code Challenge, however, most of my days I will play games such as Scythe, Hansa Teutonica, Viticulture: Tuscany, Pax Pamir, and many, many others.
Life’s an adventure – go questing!
Git Commit History
ae27573 – 2019.09.07 – Zone Names Come From Enum
3788367 – 2019.09.07 – Create Singleton\ and GameManager
aebd8db – 2019.09.07 – Fixed Missing Text in Plains Quest
8f4cf58 – 2019.09.06 – Worked on GameManager
7ea3b9a – 2019.09.05 – Started GameManager
2019.09.05 – created new branch GameManager-A
2019.09.05 – merged QuestBoard branch onto master
c0458cc – 2019.09.05 – Removed Test Quests
a011f7b – 2019.09.04 – Fixed Bug in ContentCounter
5f12984 – 2019.09.04 – Quest Zone Details Are Configurable
39e78f5 – 2019.09.04 – Added Scrollbar Functionality to QuestBoard Title
0121c10 – 2019.09.04 – Added All 12 Zones to Quest Board
b6a5ab5 – 2019.09.04 – Updated Encounter Sheet
bff7655 – 2019.09.03 – Created Quest Location Prefab
512c7c2 – 2019.09.02 – Turned ProgressBar Indicators On
09130fa – 2019.09.02 – Created QuestBoard Feature Branch
a2aeb9b – 2019.09.07 – Fixed Background Processing