Economy Enhancements & Loading State
Reminder: What you see in this devlog may be changed by final release of the game.
Hello fellow Commuters and for our North American friends I hope you had a great Canada Day/Fourth of July long weekend!
This week we wanted to do a lot more but was faced with a game breaking error that took a good chunk of my time to fix it. But, were cleaned up and ready to start going through our changes for the week.
In Devlog #3 we created our time engine and at the time, it was to ensure that the dispatch of trains was working with our Signal Controller. We started to develop more and drew out the plans for next task to work on and found that using real time was not going to work for the type of game we would want to do.
I’m sure you are all are aware that typical tycoon style games work on their own time. So, when you end the game, the game pauses and then resumes when you restart the game. With that in mind, we changed the time engine to work on a local time system. Because of that we are able to speed up the game and run at a faster state allowing you to play the game a little faster.
Now that we have a more usable Time system we are now able to run things “offline”. What we mean by that is that when you leave one station and go to another, the income you gather from the first station will get calculated and counted so that when your working in another station, you are still gathering income.
Also, we are now able to spawn sprites based of the time of day just like in real life. So, 1am is not going to be as busy as 5pm on a Friday. Before, we just had it spawning every few seconds. But now, we can control it with the data we have put in.
This adds to the realistic effect that the time of day tests your system for its efficiency.
So, as I mentioned we found a game breaking bug that took WAY to long to fix. Well, longer then I wanted. It came down to the saving and loading. The game upon getting killed would save all the necessary things it needs to save. Then when it reloads, it well, reloads everything.
This was working fine, then it game to me loading it on to my device for some testing and noticed that when the game launched, it crashed. No mater what I did, it would crash. Turns out when the game loaded and it did not have a save state it freaked out and crashed. So, after many hours trying to fix it we figured out the solution. Now when the game launches for the first time it will create a save state and then call it later. Then upon close, it does the normal working behaviors.
This was honestly like 3 lines of code. Funny how that works eh?
Thanks for reading this weeks devlog. This was intended to be a video devlog but ran into some tech issues when editing. Hopefully the next one will be a video for you all to really see the game.
As always please follow us on all our socials!
Changelog Version Alpha 0.2 - Changed TimeEngine.cs to be local vs live time. - Created speed code for fast forward feature. - Created LoadingScript.cs to increase loading speed and prevent crashing. - Changed GameController.cs to match spawn requests from EconomyController.cs - Set out of station code to calculate income while not in station. - Added players per minute to UI - Trains now tally how many sprites board train for future features.