Week 2


Week 2 went more or less according to plan. I didn't end up creating boundaries for the camera yet but rather focused on making rooms functional. First, I focused on the feedback I got. The only feedback I received was that my room sometimes could not detect other rooms. Namely, when there was an elevator far away from a normal room it would not notice the elevator and allow the player to build over it. I have fixed that by using raycasts that span across the whole room that is being planned. After I was done with that I started working on rooms being able to perform tasks.

I had 2 ideas on how I could make rooms work. I could either make each room run a coroutine that would keep track of the task completion, or I could make each room store the time it started completing a task and create a function that would be able to tell when the room will complete a task. I decided to go with the second approach to save the CPU some work. Another reason I chose the second approach is that it allows the player to close the game and then come back to it without losing any progress.

As for the time it takes to complete a task, I decided to have a "default time", which is the longest time it can possibly take for the room to complete a task. In the future, I plan to make it so the cumulative appropriate traits of the monsters in the room reduce the time for the task to actually be completed. The same goes for the resources. I created a constant variable of default resource generation and it will increase with monsters' attributes and the size of the room.

To signify that a room completed its task I have created a script which I attached to each room. The script makes the room glow yellow when it's activated by making use of the sin function and the ability to change colours in the sprite renderer. However, this approach proved to not be exactly what I wanted. The colour addition mixes the colours extensively, making the rooms appear more green than yellow. Initially, I thought that to fix that I will create another yellow object that will cover the whole room and make it change transparency (going from 0% to 50% for example) to indicate that the room is done, however, my tutor gave me an excellent idea of actually putting the object behind the room and manipulating its size instead.


I have also added another manager to the game, the resource manager. The resource manager keeps track of the player's resources and does everything associated with them. When a room completes its task and the player clicks on it, resources appropriate to the type and size (and stats of the monsters in the room in the future) are collected. Also, now rooms have certain prices to build and they cannot be built if the player doesn't have enough resources. The resource manager handles that as well. Another, and last, for the time being, function of the resource manager is to display the resources on the player's UI.


Next week I will focus on creating fully functional monsters. That includes pathfinding, leveling up, food consumption, and rooms being affected by their presence/absence and their stats. If I am going well with time I will also add the spawner's functionality into the game.

Files

Builds.zip Play in browser
Sep 13, 2022

Leave a comment

Log in with itch.io to leave a comment.