Prototype One: Environment Interaction
In order to better visualise the mechanics that i am proposing for Spectral, prototypes are the best way to get the point across as well as allow others to see directly what you are trying to achieve. The first prototype will be surrounding the environment interaction mechanics of the game as well as the movement and so rather than create the first section of the game, i took all of the elements that the player would be able to interact. I also added other sections of the game which included the main pillar within the section to get an idea with how the character would interact with it, and whether it would be possible for the player to move around it easily. This was alongside the lighting, as the rest of the game would be built within unity, so i wanted to get this element of the environment completed.
To achieve my goal for this prototype, I initially used the functions ‘OnMouseDown’ & OnMouseUp’ to allow the boxcollider to recognise when it had been clicked on and what to do in the event that it had, and what to do when the mouse was no longer clicking on it. However, this resulted in the message that was supposed to stay on screen, flashing on and off when it it had been clicked, which is where i found the function OnMouseExit, which allowed the message to leave the screen once the mouse position had left the collider. This however caused the player to be able to click on the objects from wherever the player was, even if they were on the other side of the room, which would be a problem as they could click on countless objects depending where they were. To get around this problem, i created a larger boxcollider which would serve as a type of max distance to prevent the player from doing this, and instead they would need to first ‘hit’ this collider before the one surrounding the bookcase became clickable. This was then applied and altered slightly to work with the computer as well rather than needing to write an entire new piece of code.
In terms of the chairs and overall movement of the characters, due to my limited knowledge in the ways of coding, these mechanics were enabled by way of importing the character First Person Controller, which came with a script allowing the user to drag objects with RigidBodies. The door however, was created using the similar process to the bookcase and computer, however it included the current state of the door which included: Open, Closed and In between. This allowed the code to know which animation to play depending on the current state of the door, which would change whenever the character clicked on it.
Prototype Two: Environment Walk Around
With all of the mechanics featured in my game being created within the first prototype, i then set about creating my second prototype which would be a 3D environment that would be able to be explore as well as interacted with. When starting the creation of this prototype, many of the models created previously were no longer exporting properly and so many areas of the model were invisible and not showing. This resulted in the need to find an alternative model and merge the two together to create an environment that looked similar to what it would look like in the final game. The only elements that i had to do manually once the two were merged together was create the boxcolliders which would enable the player to interact with the objects seen in the first prototype. Due to the broken model and with many elements within failing to be visible, i had to remove some of the aspects of the interaction and focus on the elements between the player and bookcases.
Link to download both prototype builds: https://1drv.ms/u/s!AiJBr4OWxUJTkBOvB_uSI67awUZX
Both prototypes are built for Windows and have no exit feature, so you will need to press Esc then the Windows key in order to close the game completely. And avoid the walls on the second prototype.