This week I've been working on bugs and doing a little refactoring.
I finally hooked up the scheduler to the economy. This actually made me realize I'm a much better coder than I was giving myself credit for. For instance, my old rescheduler code took strings in of the skillnames and then looked through my scriptable objects for it. I changed the code and deleted it from scriptable objects because I want to edit skills with a JSON editor eventually. Well, instead of a string, I gave it a reference to the skill. And it worked. I was applying all the SOLID principles without even realizing it.
So then I thought, "Well ok, I have a list of skills from the scheduler, now how do I get it to affect things." The skill I was messing around with was "Execute recipe." The skill itself is linked to a company, so it doesn't care what kind of company it is. I went to go and write the code to execute the recipe, but I'd already written it for NPC's to mess with. And since my player was also an NPC through inheritance, I literally just called the method and it worked...without a bug. Open closed principle, done and done.
Now instead of hiring an employee, the player can simply work for 8 hours and do the same thing for their company. So there will be a decision of what you want to handle in your company, or whether to hire someone to accomplish it, and you only have so much time in the day.
I realized I hadn't even set it up so you could hire an employee. So opened up the market code after taking about a week from looking at it, and started to see some issues. Just by looking at the code, I found some other bugs...like the method that went through and counted all the inventory at the end of the day wasn't working, so had to check that...and if a job contract expired, the employee wouldn't stop working and would keep getting paid.
Another issue I saw was performance. When I hit the next day button or initialize the economy, it went freeze up for a couple seconds. I figured I would run into that eventually. But then I realized it was my Debug.Logs that were hitting performance...a bunch of outputs to show me what was happening. Once I took them all out, I have no noticeable slowdown. My computer is from 2010, as well.
All in all, I felt really worried about my code. But now, I'm starting to see it's actually not too bad. It still needs to be refactored, but it's easily navigable, simple to add behavior to, and adheres to alot of the SOLID principles I was worried about.
I am running into an issue of motivation. I don't have the drive I did before that would keep me up until 3 in the morning. My creation is kinda boring to mess around with. It's now WORK. And work sucks. I went through all the screens, adding buttons and functionality to navigate. But I'm finding myself being drawn to do other things. I want to start making a different type of game, or do another hobby. After reading a lot of blogs on game makers running into the same issue, I know not to do that. Don't rewrite my entire code base. Don't keep starting projects that I know I won't finish. Finish the game.
I find it best not to listen to music, but to listen to game developers talk about making their game in the background. Keep the motivation up.
Here's a picture of my scheduler at the moment with it's single skill in the game. I will add skills to the game as I run into something I want to code. For instance, I want the player to have a managing skill that gives bonuses to employees. I think I might make a screen that shows the company hierarchy next, where you can drag and drop employees and yourself into roles, and then have internal controls for each job as well...some jobs require certain controls to even function...and if you give too many controls, employees can steal from you. Guess that'll set myself up to begin creating the main mechanic of the game, Fraud.