Second week of the project is now done! This week I have done plenty of stuff. All mechanics for the tutorial room is finished and almost all mechanics in the Horus room which is the next puzzle the player encounters, the fire/sun god puzzle.
I started off by working on the last mechanic in the tutorial room which was the perspective mechanic. We wanted that when the player is standing on a certain location and is looking at a certain point/object an event is triggered. In this case we wanted two door arches to come together as a door when the player was standing at a point looking between the two torches in the tutorial room.
At the moment the door arches are placeholder pillars and as you can see in the image there is a red line/beam being drawn out from the players location towards where the player is looking. We are using a function called raycasting which creates a vector from a start location (the player location) to a end location which is whatever we decide it to be, you can call it the raycast range. Between these point we have drawn out a red line for debug purposes which makes it easier to explain and show for others, but will not be drawn out in the finished game! Anyway, there are two components that is required for this to work, a triggerbox which checks if the player is standing in the right location which triggers the raycasting and the other component is the pillar that checks if the raycast is colliding with the door object. While the player is looking at the door one of the pillars will start moving towards it’s end location which is next to the other pillar that is already in place. When the pillar is at the endlocation one of two conditions to open the door is complete. The other condition is that the torches has to be lit next to the pillars. If both conditions are met the door will open. And that is the puzzle of the tutorial room done! We were two working on this solution of the perspective puzzle. I made the raycasting function along with the triggerbox and a door object that checks if conditions are met. While Erik the other programmer in our group worked on getting the pillars to start moving when raycasting on the door. Which might seem like a simple task, but it was more difficult than we anticipated. But now all mechanics are done and working as we want!
Besides that I worked a lot on the Horus room which uses the mechanics the player recently learned in the tutorial room but with a little higher difficulty. The only mechanic I had to add in this room was an elevator that the player can use to reach three different floors. Which I made without any major difficulties. I created a floor object on which I placed two lever objects. When the player approach one of the levers and press E it will either go up or down a constant x value in z-axis. While the floor is on the first floor the lever to go down cant be used and while on the third floor the lever to go up can not be used. With that done I could start prototype designing the Horus room. At the end of the week it looked like this:
First Floor:
Second Floor:
As you can see in these images there are torches on different heights in the room which requires that the player go to each floor to light them. The puzzle is done when the player has lit all the torches.
Here is the design concept I followed while creating this room:
Besides this I worked on a AI for the small rats we will have later on in the next room, the Anubis puzzle which is all about taking life and giving life. The AI is really simple it is just wandering around to random location within a certain radius. I also added a short delay after each random location is reached until it starts wander to the next random location, to give it a more likely rat behaviour. I added these since the player will be able to take life from the rats in order to give it to something else. At the moment they are tiny humans running around which looks hilarious. That is all I have achievied this week and I am pretty satisfied with what we have accomplished!