Project: Dungeon Explorer (codename)
Goal: Develop and release first game
Initial Commit: 7 Aug 2019

Dev Hours Since Last Devblog: 23.05
Total Dev Hours Spent: 70.21
Allocated Dev Hours for Project: 160

At a Glance

In the last two weeks I made a far amount of progress on my quest, even though I attended a 5 day board gaming convention in Raleigh – so much fun! I managed to finish my singleton GameManager class to oversee the major pieces of the game. I implemented basic saving/loading/resetting game functions. That was fun. 😄 However, the best thing I did was to finish the core mechanic of the game. That’s right I can create a quest, do encounters to achieve the quest’s goal, complete the quest, receive rewards, and create a new quest in the same zone and get a map fragment for the next higher zone. Woot! My code is hack n slashers dream come true but it works. ⚔️😆

Quest Progress

Game Manager and Quest Zones

I tweaked my GameManager class a bit more to improve the singleton aspect of it. I plan on starting a tutorial series in the next month or two and will do one on singletons.

I continued to refactor my code and assign responsibilities to better suited object. After my refactorings, each quest zone (Plains, Rivers, Swamps, etc.) managed its own quests. It created them, tracked their progress, and allowed for their completion. I created a Quest Location prefab so I could easily generate them in code.

WIP Quest Board with Plains and Rivers Quests

Saving/Loading

While working on saving/loading I realized I haven’t touched C# serialization in well over a decade, and I only remembered the basics and add to that Unity puts a spin on it and it was a fun few days. While I coded this part I also attended a 5 day board gaming convention. I wanted to continue participating in my 100 Days of Code challenge and I wanted to play lots of board games. Every morning, I set aside an hour or two and worked on my game, the rest of the day went to board games.

It really worked well for me as over the course of 3 or 4 days (amount to about 3-6 hours) I laid the groundwork for saving and loading files. I, unknowingly, introduced a bug one day which I found and fixed the next day. I don’t plan on working on the saving/loading feature again until I get to the beta phase and the data structures have stablized more. Right now I’m happy with knowing I can make it work when I come back to it.

Completeing Quests

This brings me to my best accomplishment so far, I completed the core mechanic of the game. I can start a quest, complete encounters, accomplish the quest’s goal, get rewarded for completing the quest, create another quest (if in the Plains zone) or get a map fragment for the next zone. This last week I ran the game testing it various scenarios, refactored large sections of code, and most importantly I resisted the urge to completely rewrite the code from the ground up. Haha

Let me tell you, this code smells bad. I hacked n slashed my way through it, and yet, I don’t mind that much. I recently started reading Martin Fowler’s Refactoring 2nd edition and he reminded me that software development comes in waves, as long as you let it each wave builds on the previous, otherwise, it all crashes down like a sandcastle at high tide.

With refactoring, the balance of work changes. I found that design, rather than occurring all up front, occurs continuously during development. As I build the system, I learn how to improve the design. The result of this interaction is a program whose design stays good as development continues.

Martin Fowler, Refactoring 2nd edition Preface

I relearned a valuable lesson, I need to plan, design, code, test, rinse and repeat. I don’t need all of that for the whole the game before I start, instead I need enough to get me through 2 or 3 features, then I need to rinse and repeat for the next 2 or 3 features, and so on until I finish my project. It seems so simple as I write it out, yet I often find myself forgetting it as I get swept up in coding.

I learned a new skill, prefab variants. About a year ago Unity introduced prefab variants that allow a developer to create a set of predefined variations of a prefab. I had the perfect scenario, I created a generalized Quest Location prefab and want to make specialized prefabs for each zone. Volia! I created a Plains Quest prefab variant, and another for each zone. And why did I need variants, to show off the map sprites my wife made.

Of course, every major forward step comes with a misstep somewhere along the wayand damn if I didn’t have a big one. Right now, I have to complete 6 Plains quest to get a River quest, and 6 River quests to get a Swamp quest, and so on. So I ran out the math and figured I needed 362,797,056 Plains quests (zone 1) to create 1 Dungeon quest (zone 12). Yup, I told Unity to instantiate over 362 MILLION quests on game start. D’oh!! I had to kill the Unity process and then reboot my laptop to clear up all the memory and return to a stable environment again. I would like to say it was late or that I was tired but in reality I just didn’t think it though. Later I realized I could create any number of quests I want in any zone I want, so I could have easily tested all the zones without crashing Unity.

Keep On Questing

Before I started this project I had no idea what I could do in 160 hours, it seemed like lots of time, wow not now. I am almost halfway through my allocated time, however, I am not even close to halfway done with the game. I have learned a tremendous amount over the course of the project so far. However, now I have to make some decisions. Do I reduce my scope? Do I increase my hours? Do a do a bit of both? What would you do?

Life’s an adventure – start a quest!

Git Commit History

For more details check out my #100DaysOfCode log on github.
commit 0c3f380 – Started Testing, Found Bugs, Fixed Some, Created More
commit b177add – Updated Goal Code
commit 1516075 – Created Prefab Variants For Each Quest Zone
commit 9321186 – Added Reward To CompleteQuest
commit 8b20d6f – Coded Out Initial Quest Classes
commit 1e85715 – Fixed Display Default Quest, Started Switching To Working Quest
commit e0688be – Updated GameFile With New Features
commit d2f0469 – Finished Quest Completion and Basic Rewards
commit 08524d0 – Working on Completing a Quest And Starting a New One
commit 19fea8a – Started Wiring Up Quest Completion And Rewards
commit 07b9183 – Fixed Bug In Saving/Loading
commit 5502696 – Basic Load Game Functionality Implemented
commit e50c13d – Renamed SaveZoneData To SaveData
commit 3ea9161 – Saving/Loading From File Works
commit 386cb5f – Working On Saving Data
commit 0b931f7 – Working On Serializing Classes
commit 062ac91 – Starting the Save/Load Game Changes
commit 02e5ce1 – Code Ability To Instantiate Quests
commit 13d25ca – Improving QuestZoneDetails To Manage Each Zone
commit 46cb3da – Improved Singleton and GameManager

4 Comments »

Send a Missive

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.