Showing posts with label Year 3 Project Alpha. Show all posts
Showing posts with label Year 3 Project Alpha. Show all posts

Thursday, 4 May 2017

Outside the Box Project Alpha Work - Game Scene Variation/Development

In the very early prototype stages I was attempting to figure out the camera angle, perspective and positioning of the defences, player base and the overall game board the player would interact with.

The initial concept was to take influence from The Legend of Zelda: A Link Between Worlds. In that game the camera is positioned top-down but the characters and environment are 3D models. To allow the player to be able to distinguish silhouettes in A Link Between Worlds the designers decided to tilt all the models 45 degrees back, that way the player would be able to see all the characters and creatures whilst keeping the top-down perspective. My early attempt is visible in Figure 1.

Figure 0.1.

Figure 0.2.

Figure 0.3.
Prior to the start of term I made a head start on developing mechanics for our game, simply purchasing defences, upgrades and having the upgrades be represented by larger cubes; all of which deducting cost. I also wanted to add some cheat codes to the game and I made a script that would give the player money if they typed MONEY on the keyboard with breaking the string and hitting enter. It was buggy and didn't give the player the intended amount, but the proof of concept was starting to emerge through Figure's 0.1, 2 and 3.

Figure 1.
Figure 1. depicts a very early prototype of the upgrade system for the towers in the game, the spheres inside the cubes are the spawn locations and when clicked on a defence ( in this instance, a tower) will spawn in their position whilst also deducting gold from the player's supply contextually to the level of the defences being built: 
Level 01 - 100 Gold
Level 02 - 200 Gold
Level 03 - 300 Gold
These prices are simply for testing purposes and shall be adjusted later on for game balance.

Figure 2.
It was decided that the initial Legend of Zelda inspired view wouldn't work for our Tower Defence game, as the viewpoint gave us too little room to produce both complicated paths and impressive defence models.
Instead our next scene design was inspired by a game of Minecraft, were Chess and I built a mock-up in Minecraft and played with where the camera could sit (using the camera of the player in Minecraft). Figure 2. was what we came up with and I followed it by implementing that view point in our, then, current Unity Project; Figure 3.

Figure 3.
At the time we felt that this was a decent viewpoint for our game as it afforded us the faults of our last scene's perspective. We could accommodate the much needed long path for game balancing and more impressive defences. The reason for this desire to have impressive defences is because the visual spectacle of creating a large defence, then upgrading to a bigger and more powerful version, alongside sounds etc. is great for player feedback; the goal is to make the player feel powerful when building defences.

Figure 4.
The next challenge, as shown in Figure 4. was the distribution of UI, and where and how exactly the player health should be represented. Our initial idea was to make the player's health diagetic (an experience contextual to the medium), in this case, it was planned to be flags that the enemies were trying to steal from the player. The player would lose a flag when the enemies reach the player's base. 
This idea was scrapped due to a clustering of the player's view point, however, if we had continued this we could have done something interesting where the player loses a flag when the enemy reaches the base. But then the player would have the opportunity to claim it back by killing an enemy "returning" to the forest with the flag, and should the player manage to kill the returning enemy, they would be able to collect the flag from the board; restoring it to the player's base.

Figure 5.

Figures 5 & 6 show a minor adjustment to the scene, where I played with the lighting in the scene to add fog depth to the camera and colour to the main light in the scene, both to help portray tone and to make the scene more visually appealing. The desired tone was that of warmth, energy and fun. And from the perspective of a child the late evening sunset shades would normally be a welcoming, nostalgic and fun environment as that would normally be the time of day where one would have finished school and would then go home to play, either indoors or outside.


Figure 6.

Figure 7.
Figure 7. is the result of me re-building the project from scratch, as I had just fixed the coding trouble for building defences with Ibby, our technician at the time, and our older project file had become cluttered and confusing. This also gave me an opportunity to reinforce what I had coded for myself and to start implementing the finalised models I had made. At this time the only temporary model in the game was that of the enemies, which were just a bog standard cut out of a humanoid figure.

Figure 8.

Figure 9.
Figure's 8 and 9. represent the game as it was when we conducted our Milestone presentation to our class, tutor's and industry professional Steve Goss for feedback and progress report.

Figure 10.
After a team meeting where in Chess and I brainstormed directions we could take our game after hearing feedback from Supermassive's Director of Design Steve Goss and our course leader Andy Bossom. We made 4 concepts between us on a sheet of paper (Figure 10.) and I went away and built an alpha version of the top 3 maps sketches.

Figure 11.

Figure 12.

The purpose of Figure 12. & 13.'s version of the game is to defend your outposts from spawning enemy waves. Should your outposts be destroyed (life represented through red boxes currently) then the enemies will begin to attack your home base.
For future development we hope to make this into a control the board game type, where enemies don't destroy the outposts, as they do currently, but instead take control of them and will later on be able to take control of your defences, you as the player would defend your outposts and try to reclaim any lost outposts. After a certain number of waves and the board hasn't been taken by the monsters, The Monarch would appear as a boss to fight off to win the round.
This returns us to our One sheet and Game design document roots of the story of our game, where The Monsters are invading and you must defend your land. This switch also allows us to retain our games status as a Tower Defence game but also provides us greater freedom to play with mechanics and strategy, such as AoE (Area of Effect) attacks and the, previously mentioned, bubble wrap to slow down The Monsters.

Figure 13.

Figure 14.
Finally for the Alpha submission the last variant I pieced together was suggested to us by our tutors and Steve Goss and concept made in Figure 10.
The variant is Plants vs Zombies inspired. However, we never took this forward and was more of a proof of concept that we listened to the provided feedback and acted on it. None of the members of the team (myself included) had any interest in making, what we felt to be, a Plants vs Zombies clone. 

Outside the Box Project Alpha Work - Main Menu Development

The governing concept for the majority of our games aesthetic was that a child had built the game board in their spare time and that the act of playing our game was seeing this kids imagination come to life as they saw it when they played.
So to reinforce this concept we decided that in the main menu the player would be able to see the game board the kid had made and that the player would have a sense of where they were when they chose "New Game". To that effect the main menu design was based off the living room in my student house where Chess and I initially made the concept of this game prior to the start of term.






Figure 1.
The tea mug in Figure 1. was later removed as it came across as too grown up for the desired design for the main menu.

Figure 2.1.

Figure 2.2.

Figure 2.3.
Figure's 2.1, 2 and 3. each represent how we wanted to make the main menu somewhat diagetic, that the player was seeing through the eyes of the child at the table ready to play. This also involved things like the "Credits" button activating an animation, created by me, where the camera rotates up and to the right to look at the pin board, where our credits would be pinned up like paper.

However, with the fridge in the referenced image and scene of my living room, the pin board was replaced with a fridge scene with magnets on, and the pin board was repurposed as the magnets themselves. These magnets would then contain pictures of us, the developers, holding paper to the fridge door with our credits visible, as if someone had left a note.



The animation only required 3 key frames; the first being the starting position seen in Figure 1. the second had it's Rotation variable of the Transform component set to 0, to portray the camera looking up, and finally the third key frame was a Rotation on the Y axis to look to the right toward the fridge (Figure 2.2.).
To return to the main menu proper seen in Figure 1. I simply made a second animation that played in reverse. These animations were controlled to start in a Main Menu Controller script and the appropriate buttons would then play the contextual animation by calling the appropriate function in the Main Menu Controller.

Figure 3.1.

Figure 3.2.
Figure's 3.1. and 2. show how I added a fade in with the menu by controlling the Canvas Group Alpha, having set to 0 at the start of scene loading in and then playing a Coroutine in the Main Menu Controller to bring the Alpha back up to 1 over a period of time, whilst also activating a new animation as seen in Figure's 4.1 and 2.

Figure 4.1.

Figure 4.2

Figure 4.3.
The newly created animation mentioned previously was that of the camera looking out of the window in Figure 4.1. and then panning down toward the table and being pulled back to rest in the seat the camera is positioned above as seen in Figure 4.2.

Figure 5.1.

Figure 5.2.

Figure 5.3.
Figure's 5.1, 2 and 3. show that we re-shuffled the main menu UI placement a little after I rebuilt the project to tidy up the folders and code a little. I also had re make the animations after the rebuild.

The reason for this was because I didn't want the UI covering the game board, as it appeared at the time, as that was the focal point of the main menu.

Also following our feedback from the milestone presentation presented to our class, tutor's and Steve Goss and following on from creating the other level variants as explained in the Game Scene Development blog. I added new buttons so as to allow the player, for the Christmas/Project Alpha hand-in, to access these other level variants I produced.

Outside the Box Project Alpha Work - Miscellaneous Scripts (Health, Money etc.)

Game Manager:

As our Game Manager, this script was designed to be a hub to handle most unspecialised tasks within our game, such as loading scenes, controlling when our game will start etc. and for a while even controlling the Player's money, though this would later need to be updated when I get around to implementing a proper health and damage system for our defence attacking our enemies.





Player Health:

A rather simple thing, our Player's health manager. There is an invisible trigger box that sits at the door of the Base which is, coincidentally, where the last waypoint of the enemies path is located.

This trigger box simply detects when an enemy collides with the trigger box through the enemy gameObject's tag and then reduce the numerical value of the Player's health and removes the appropriate visualisation of the Player's health on the screen.


Outpost Health:

The OutpostHealthManager operates exactly the same as the PlayerHealthManager, but controls the health of the outposts, and also, controls the paths the Enemies will take contextual to if the health of the Outposts has reached 0. Should the outpost health reach 0, then the paths of the enemies will switch to the Player's main base.


Main Menu Controls:

Like the Game Manager, the Main Menu Controls script handles the nitty gritty of the mechanics required of the main menu scene. However it is also the only script in the main menu as all that needs to be controlled is the loading of scenes and the playing of animations.



Outside the Box Project Alpha Work - Defense Behaviour Scripts

Defence Shooting:


FirePoint is the transform that the bullet prefab will be spawned

InvokeRepeating (UpdateTarget) is in Update as we need our Defences to be constantly searching for the nearest target


Update target will store a list of all the gameObjects tagged as Enemy that enters the range value.

The forereach is calculating how far away the gameObject's tagged as Enemy are from the Defence and then in the following if statements we are checking these distances and setting the target variable to the nearest enemy.


Bullet:

Bullet script controls the behaviour of our Bullet's, such as the speed they travel and their ability to move from their spawn point at FirePoint to the targeted enemy. It also controls the amount of money the Player receives from killing the enemy and destroys the enemy instantly.

This will be updated at a later time when I have properly implemented a health and damage system for the enemies to better control the supply of money to the Player and to add more depth to our mechanics, as the bullets currently just instantly kill our enemies.



Outside the Box Project Alpha Work - Defense Building Script

Originally the building of defences ran off 2 scripts, a Place Defences Script and m_Defences Manager Script.
They referenced each other, with the manager script organising how much it would cost to build a defence and which defence would be placed and when, such as the level 01 defence being built first, not last.
The place defence script organised which defence would be built (at the time either a levelled cannon or a levelled outpost/tower) and would instantiate it.
The trouble we had for a long time was that the first level of defence's instantiated clone would spawn switched off and thus wouldn't do anything until the second level was bought, at which point the shooting script on the second level of defence would run.


We found that the problem was that the prefab saw the level 01 defence as being switched off always, and so when it instantiated the game object, it spawned switched off. We fixed this by turning the game object on in the prefab of the build spot, however the next problem occurring was that the level 01 defence was just on the game board all the time.


We tried setting the active boolean of the level 01 defence to false in the void Start function, which worked, but then when we tried to buy the level 01 defence it would no longer spawn, despite having paid for the level 01 defence and that when you tried to upgrade, the second level of defence would spawn.
Ibby suggested it may have been a problem with the code trying to interact with each other between the Place Defences Script and the m_Defences Manager Script, and that we should try merging the two piece of code to work as a single unit, which we set about doing.


Prior to Ibby's suggestion of merging the code, we also tried duplicating the code we had already built and setting it to just build the towers, because we found that the cannon's were building just fine, and so we sought to rectify our prior trouble by duplicating the code to build the cannon's and just make the code build the towers, however this didn't fix the issue and the level 01 defence was still not being spawned properly.


By merging the code, as Ibby suggested, we found that most of our troubles with building the defences was gone, the only remaining trouble, which we have yet to fix, is that the box collider (which detects mouse clicks, which in turn allows the player to buy and build defences) would regularly not detect mouse clicks. It didn't make the game unplayable, but frustrating as the player can sometimes click repeatedly without buying a single defence, but can on other occasions, buy the defence without trouble.





With the defence building functionality all on one script, we found that it became tillable. Basically, the only difference between build spots is the tag of the build spot, cannon build spots are tagged as "Cannon Build Spot" and the same for the towers except the tag has Towers in place of Cannon.
This means we can use this code for most of our defence building by simply repeating the code in the script to build the new defence and changing the referred to Tag, for example if we wanted to use this to build our bubble wrap AoE game object to slow down the enemies, we'd just copy the code again that governs both the cannon's and towers and just replace the game objects in the list with the bubble wrap game object, and then make a new script that would be on the bubble wrap game object, as a prefab, that provided the bubble wrap with it's AoE, slow down, functionality.