Project: Dungeon Explorer (codename)
Goal: Develop and release first game
Initial Commit: 7 Aug 2019
Dev Hours Since Last Devblog: 13.61
Total Dev Hours Spent: 33.05
Allocated Dev Hours for Project: 160
At a Glance
I made good progress on my weekly quests even if I made a major blunder with my code. Apparently an idle game should run in the background, who knew? 🙂 I added in some combat encounter sprites, tallied experience points for completed encounters and gave the quest a goal and measured progress against it. All-in-all a good week of game dev.
On the technical side I improved my git usage to make it easier to journal my 100 Days of Code challenge. I changed how I use Trello (affiliate link) to keep me on track and not go off on tangents. I started replacing the
Find(…) calls with referenced member variables. Learning has occurred.
Since I started the 100 Days of Code challenge I have spent more time coding each week. I spent over 13.5 hours working on game dev and learned lots of things that I did right and several I did wrong. I started this quest for exactly this reason to make mistakes and learn from them to make better games in the future.
An Idle Game MUST Run In The Background
I might as well start with my blunder. I made an idle game that only ran when it had the focus. I created two quests for testing, when I completed encounters on quest 1 everything worked fine. When I completed encounters on quest 2, again, everything worked fine. However, when I switched back to quest 1 I realized it had stopped processing once it lost the focus. I switched back to quest 2 to see if it was a fluke. Nope. I spent my time developing an idle game that didn’t run when idle. D’oh!
See over the past week, I realized my initial plans encumbered my game. Rather than redesign everything and start over I decided to keep it and learn from it. I imposed a 160 hour limit for the project so why spend time crafting the “perfect code” (as if such a thing exists, haha). However, when I stumbled upon this failed code my first thought was that I needed to do just that, redesign it all. It was late so I committed everything, tweeted my journal entry, and slept on it. That was Saturday, the last day of my questing week (I count my weeks from Sunday to Saturday).
On Sunday, I had an hour to kill so why not get started on fixing it. At this point, I “knew” it would take most of a day to fix, so I had zero expectations. I think it took roughly 5 whole minutes for me to realize I had 6 lines of code in the wrong Update() method. D’oh!! I moved the code to the correct spot and BAM it worked perfectly. Don’t get me wrong, my code is still complete hack ‘n slash, and I could do a complete overhaul, however, I am no longer forced to do it. Woot!
Combat Encounter Sprites
My wife finished rough sketches for the combat encounters, so I dropped them into the game. Now we get to figure out good ways to update sprite sheets without redefining every sprite already assigned in the game. I also added learning about Sprite Atlases to my learning list.
The Experience Earned
I completed the always important income section, I mean you can’t play an incremental game without some sort of currency to spend on things. For Dungeon Explorer we use experience points (XP) as the main currency. Each encounter completed grants a certain income per second, that you spend to complete more and different encounters providing more and more XP per second, and so on.
I coded up a simple script to assess if the player can complete a quest based upon available XP. The button turns green if you can complete it, otherwise it stays red.
When Are You Done With a Quest?
I want that sense of accomplishment when I go questing. I created a goal of needing a set amount of income to finish the quest. So far I tested several values: 10, 25, 50, 1250 XP, and they all work as expected. If the quest progress is less than 100% the button displays red, once the progress is 100% or greater it turns green.
This past week I used git extensively to track my progress with almost all commits were atomic. I improved my commit messages so I can insert them directly in my 100 Days of Code log.
I developed a system for staying on track with my goals and not chasing side quests that sound interesting. In Trello, I created one card for each feature, on that card I created three checklists, 1) Alpha Phase, 2) Beta Phase, and 3) Gamma Phase. I am currently in the alpha phase so I work those items, as I think of improvements (or scope creep), I add them to the next checklist. So far I like the way it works, I still have lots of room for improvement, however, the 160 hour limit keeps me focused. This also helped me not get analysis paralysis and try to think of every task all up front. I only needed a few tasks on the alpha list to get started, then as I discovered I needed more I added them to the correct checklist.
I started last week with lots of
GameObject.Find(…) calls, though only in
Start methods so that’s something. As the week progressed I realized in most cases it’s better to create a member and then drag and drop the needed control. I don’t like public member variables, encapsulation and all that, so I used
[SerializeField] private Sprite _mySprite = default; for my members.
Keep On Questing
Overall, the quest area took much longer than I anticipated, however, I made a bunch of mistakes and grew from them. Before I started writing this blog I started on the next feature, the Quest Board. The player selects the quest to do from a potentially large list of available quests. If I had tried to create this piece first it would have taken much longer than the 3 hours it did, and I still made mistakes and had to scrap a whole section and start over.
My main quests for this week include starting and finishing the Quest Board feature and moving into the Game Manager and Sound Manager features. Once I finish those items I will have a viable incremental game. It’s gonna be a fun week.
Life’s an adventure – go questing!
Git Commit History
a0efc86 2019-08-31 Goal Assessment Implemented
fc9ecc8 2019-08-30 Buy Encounter Done & Button Highlighting Coded
f414054 2019-08-29 Basic Purchase Almost Complete
d463fe1 2019-08-29 Update Encounter Sprites
bc56c4b 2019-08-28 Saved the Scene
7d789de 2019-08-28 Created Income Display Prefab
9710a58 2019-08-28 Fixed a Bug in DisplayQuest
d11e8e2 2019-08-28 Encounter Button Completes the Encounter
9cdc91f 2019-08-27 Minor Tweak To Encounter Button Setup
a5a5ce3 2019-08-27 Wired up Encounter Buttons
c14071c 2019-08-26 Fixed Bug in Encounter Action Text
da53411 2019-08-26 Changed Encount Button to ButtonProgressBar
e62b2a9 2019-08-25 Added ButtonProgressBar Code
d54da40 2019-08-25 Fixed ProgressBar OnCompleted Not Firing
f09e890 2019-08-25 Updated ProgressBar code