The “”””fun”””” part of game development.
As part of my game dev work tonight I fixed four bugs/issues that were present in the game and discovered a new one that I’ve never seen before. The bugs fixed during this dev session were:
- The inability to change a worker’s job.
- The worksite of a builder being set to null for five seconds after completing a building. This resulted in workers completely freaking out as their behaviours would get confused.
- The camera movement only working properly when the player was facing forwards.
- Workers having their workplace being set to null when dropped. This prevented me from moving workers to and from the storehouse after they had filled their inventory with goods.
These issues were relatively simple fixes with the most complex one being the camera movement due to the way I had to set up the camera in order to work with the Oculus Rift. In any case, the player now moves relative to the direction they’re facing so that holding the left analog stick of the gamepad forward will move the player forward in the direction they’re facing, holding it back will move them backward from the direction they’re facing, and so on and so forth. In addition, builders no longer have their work object set to null after completing a building and as a result won’t be walking to the next building site and suddenly find themselves without a reference to it. Furthermore, Players are now able to successfully reassign workers to new jobs so builders can become farmers can become miners can become builders. I also stopped the workplace of a worker being set to null when dropped. This is something I forgot to do when setting up the original code for assigning workers to new jobs and so was an easy fix.
Finally, I also changed the way that picking up game objects works with the player able to pick things up by holding the A button but only being able to drop them by pressing the X button.
With all that said, the bug I found tonight is that workers who go to the storehouse will not always return to their workplace. Instead, they seem to transition straight to their ‘Working’ state and begin to generate resources. As far as I can tell, this is a result of their target position not changing quickly enough before the distance to their target point is checked (which shouldn’t cause that), but I’ll have to fix it tomorrow as I’m hungry and tired.