Project: Treasure Hunter
Codename: Dungeon Explorer
Goal: Develop and release first game
Initial Commit: 7 Aug 2019
Devlog: 9 (see previous one)
Dev Hours Since Last Devlog: 9.84
Total Dev Hours: 161.11
Allocated Dev Hours: 160
At a Glance
Over the course of the past week I finished the research feature for Treasure Hunter. Woot! I created 5 working researches which is enough to move to alpha. Let’s crack open those books.
Research Working
Last week I wrote about how I completed the research items, and since then I put in the time to finish my research code. That’s right I can purchase research and display each zone’s research tree, which are kinda important before I move to alpha release.
It turned out that coding the buying of research was easy, just two simple changes. The first was a new property in my base ResearchItem class that returns true/false depending on the research cost relative to the total research points available for that zone. And yes I use my GameManager (a singleton) track all my exploration zones. 🙂
public bool CanBuy => Cost <= GameManager.Instance.Zones[(int)ZoneType].ResearchTree.Points.Value;
The second change I made in the script attached to the prefab I used to display the research on the screen. I added a CanBuy check on my CompleteResearch() method and then subtracted the cost from the available research points.
public void CompleteResearch()
{
if (ResearchItem.CanBuy)
{
GameManager.Instance.Zones[(int)ResearchItem.ZoneType].ResearchTree.Points.BaseValue -= ResearchItem.Cost;
ResearchItem.CompleteResearch();
UpdateResearchDisplay();
}
}
Each exploration zone has its own research tree, making the player optimize each zone for faster play. I’ll be honest this kicked me in the ass for quite a while. I easily spent 3 hours banging my head against the wall. I had to walk away for the night. The next day I sat down with a clear head and 30 minutes later I had the first draft coded. It turned out that I had made it waaaay more convoluted then it needed to be. In the side-by-side picture below you can see that the Plains research tree has the Increase Concurrent Quests item and the Rivers tree doesn’t.
Keep On Questing
The only coding thing I have left before alpha is to implement a save/load system. It would really suck to spend minutes or hours playing a game only to have it all wiped away because it couldn’t save. On the non-code side I need to create a page on itch.io and this site to house the game. I feel good about my progress.
Life’s an adventure, what’s your quest?
Git Commit History
60aea87
Hack a fix for research point display growing, 2020-05-12
3bbbbc1
Add GoalFactory to generate goals, 2020-05-12
fa1c343
Add EncounterTypeGoal as an option, 2020-05-12
4cf99e5
Add new goal – HaveAmountGoal, 2020-05-11
b080607
Fix bug that caused the research panel title not to update, 2020-05-11
b880a74
Enable purchasing research items, 2020-05-11
15a3572
Fix ResearchItem IEquatable and IComparable code, 2020-05-10
c4001b8
Add multizone research trees, 2020-05-10
1f3eaf2
Add IsObtainable to ResearchManager, 2020-05-07
45f75d0
Add SelectedLocation property to GameManager, 2020-05-07
Like this:
Like Loading...
Related
One day a crazy, wild-haired troll gave me a quest to create video games. I know C#, so I armed myself with Unity and loads of game dev tutorials and went questing. Now I call myself a "game dev" and pretend like I have a clue. :)