Friday, October 30, 2015

Unity Day 31 (Survival Shooter Project)

What I Did:

     So today I decided to skip converting space shooter to mobile as its fairly difficult to set up the sdk and my phone on a school computer as i have to mess with drivers and etc. to make it work properly with android. So I'm moving on to the next project and may revisit this later. So today I will begin working on the survival shooter tutorial. So the first thing i did was go to the asset store to download this projects assets however I needed to upgrade unity because it was out of date for the projects assets so i had to take a bit of time to update the software. To update the software I had to go to help in the engine and check for updates. This took me to a webpage that had me download an installer. After the software had finished downloading I unfortunately didn't actually have time to do anything else aside from downloading the assets from the unity asset store.

What I Learned:

      I Learned how to update unity for future reference in case a newer version comes out at some point.

What I'm Doing Next Class:

     Next Class I will finally begin working because I have everything ready to begin the survival shooter project.

Wednesday, October 28, 2015

Unity Day 30 (Space Shooter Project)

What I Did:

     Today I simply waited for the android sdk (software development kit) to finish downloading so i didn't really do a whole lot today, however next day I will be finally starting on the mobile development.

What I Learned:

     I learned that an system specific sdk is required for developing software/games for devices such as smart phones and consoles.

What I'm Doing Next Day:

     Next Day I will finally begin mobile Development for space shooter.

Tuesday, October 27, 2015

Unity Day 29 (Space Shooter Project)

What I Did:

     Today I finished off this tutorial finally and now have a working game, the error from last day was very simple it was simply a typo. Now after adding the amounts for each variable in the inspector of the enemy ships evasive maneuver script I dragged the enemy ship into the prefabs folder and made it a prefab. I then dragged the new prefab into the game controller's array that it uses to randomly pick a hazard to spawn. the game is complete for PC. It has a new and improved scrolling background, new types of asteroids, and a new enemy that moves around the game and shoots back at the player.


What I Learned:

     I Learned how to make a simple ai that allows an object to move and shoot on its own.

What I'm Doing Next Day:

     Next Day I will begin development for making this space shooter game into a mobile game. The tutorial for that is also very long and will be most likely posted on for 4-5 days. This is however the final tutorial for this project.

Monday, October 26, 2015

Unity Day 28 (Space Shooter Project)

What I Did:

     Today was a shorter day so I didn't do too much, however I did start work on the evasive maneuver script which should be finished but I'm running into an error CS1922 so I will try to fix this next day. The evasive maneuver script is designed to make the enemy ship evade while its in play to add a bit of life to it rather then have it be just another asteroid with a different model. Script was added in order to make it move from left to right and right to left only so it won't actually leave the game screen. I also clamped it as an insurance in case it misbehaves at some point.


Tutorial Started: 01:08:20
Tutorial Stopped: 1:29:00

What I Learned:

     I Learned how to use the Mathf fuction in scripts for more complex position changes.

What I'm Doing Next Day:

     Next Day I will hopefully be finishing this tutorial.

Thursday, October 22, 2015

Unity Day 27 (Space Shooter Project)

What I Did:

     This day I was unfortunately met with a problem in the game that prevented me from making much progress today. The error was making my enemy ship completely rotate to the direction it was moving which essentially made it go in reverse towards the player which wasn't acceptable. The problem took a bit of searching but it turned out to be a fairly large error in the mover script and i'm not totally sure how i didn't notice this applying it to the asteroids and bolts, i'm assuming it is because you can't really tell the difference between front and back on them. The problem was that the mover scripts speed variable was a Vector3 rather then a float and that the line...

rig.velocity = transform.forward = speed;

should've been...

rig.velocity = transform.forward * speed;

and i'm assuming that it caused the the way the ship moves to equal the way the ship faces.

What I Learned:

     Today I didn't learn a whole lot, but I did learn how to make objects turn and move in that desired direction for future reference since i discovered this on accident.

What I'm Doing Next Day:

     Next day I will be doing what I was setting out to do today, sadly I couldn't because of the error I was met with but I will be doing it next day.

Wednesday, October 21, 2015

Unity Day 26 (Space Shooter Project)

What I Did:

     Today i made then enemy ship be able to shoot. To do this I first created a new script called weapon controller from the add component section of the enemy ship game object. In the weapon controller I added code telling it how to shoot. I then dragged the bolt prefab that I filed from the player ships bolts and attached it to the enemy ship so it would be a child game object of it. I added another empty game object call ed shot spawn and set it as a child object of the enemy ship, and set the bolt as a child of shot spawn. I adjusted the enemy bolt to a cyan texture so it looks different, I also reversed its movement so it would fire towards the player instead of away. After that I edited the destroy by contact script so the bolts would ignore the enemy objects if it was fired from the enemy ship. I created a new tag in unity named Enemy and tagged the enemy ship, the enemy shot and the 3 asteroid prefabs. I then filed the enemy bolt as a prefab. The enemy ship now fires and can destroy the player. Because both bolts from the player and enemy are supposed to destroy any object it touched with exception the two bolts can eliminate each other on contact.




Tutorial Started: 00:45:01
Tutorial Stopped: 01:08:19

What I Learned:

     I learned how to create an object the shoots other objects independently, and how to make the object it fire lethal to some objects and not others.

What I'm Doing Next Day:

     Next day I will be making the ship move, able to evade and possibly adding it to the random spawn rotation.

Tuesday, October 20, 2015

Unity Day 25 (Space Shooter Project)

What I Did:

     Today I begun by finding out that the project from yesterday did not save! Fortunately the script changes and new script was still there so i must not have saved the scene last time. I was able to fairly quickly redo the work from yesterday but it did cost me half an hour of time. So on shorter time I wasn't able to do as much today as I wanted, but I did finish making the enemy ship. I did this by creating an empty game object and renaming it enemy ship. I then added the enemy ship model and enemy ship engine effect as child objects of the new game object. After doing that I started adding physics to the enemy ship game object with the rigidbody and sphere collider components. I then added the destroy by contact script to it and set the score its worth to 20, filled the player explosion space with the player explosion effect and the explosion space with enemy explosion.


Tutorial Started: 00:34:21
Tutorial Stopped: 00:45:00

What I Learned:

     Nothing new was really learned today since I did essentially what I did to create the asteroid and player ship, I did however learn to check to make sure I saved the scene more carefully.

What I'm Doing Next Day:

     Next day I will be making it so that the enemy ship will shoot and evade.

Monday, October 19, 2015

Unity Day 24 (Space Shooter Project)

What I Did:

     So today I figured out that the problem from last day was simply me dragging the asteroid prefabs to the wrong location, I needed to drag them directly onto the array that war created in the inspector. So now that this problem was fixed, in play mode 3 different types of asteroid models are now spawned. So now I began making it so that the background would scroll during the game play. To do this I first started by adding the star field particle effect by dragging its prefab into the hierarchy from assets/prefabs /VFX. The star field effect was already set upon taking it so I left it as is. I then duplicated the background and tweaked the duplication's y position to -1 so it is exactly touching the previous background. I also made the duplication a child of the original so that the script i was going to create and attach to the original would also apply to the duplicated background. Then I created a new script on the first background and named it BGScroller. Upon doing that I added code telling it how to make it move. This simple code gave me two variables to tweak in the inspector. The tile size was set to 30 because its the same as the background and the scroll speed was set to -0.25. Now the background scrolls along, and stars twinkle along with it.\



Tutorial Started: 00:12:01
Tutorial Stopped: 00:34:20

What I Learned:

     I Learned how to make a cinematic background with different effects.

What I'm Doing Next Day:

     Next day I will be implementing enemy ships into the game that shoot and dodge.


Friday, October 16, 2015

Unity Day 23 (Space Shooter Project)

What I Did:

    This day I decided to skip building the game since their are tutorials after adding on to the game so I will build it afterwards and deploy it on mobile devices. The next tutorial is 2 hours long and adds much more to this simple game. To start off I created two more asteroid prefabs containing two new asteroid models for the game to spawn. I did this by taking my original asteroid prefab and then switching the model that the object was parenting to the two new ones. I then added them to the prefab folder to turn them into prefabs and deleted them from the scene. After that I opened up the player controller script and changed some of the code to spawn randomly one of the 3 models. However I ran into a problem where I the 3 slots for referencing the prefabs wouldn't show up.



     The problem has something to do with turning the gameobject into an array but why its happening i don't know.

Tutorial Started: 0:00:00
Tutorial Stopped:  0:12:00

What I Learned:

     I Learned how to add an array that will spawn random different objects that are assigned to it.

What I'm Doing Next Day:

     Next day I will try to figure out what is causing this error and move on to whatever is next in line.

Thursday, October 15, 2015

Unity Day 22 (Space Shooter Project)

What I Did:

     Today I am making it so the game can end by breaking out of the infinite loop. To do this first of all I had to create two new labels for the game over text and the restart text. I then created a new empty game object to parent the three label objects to clean up the hierarchy. After that I opened up my game controller script and proceeded to add the variables for the two new scripts and code to define them and give them their proper functions. I then went to the destroy by contact script so to add script to where the player ship can be destroyed, then added the script so that it would display the game over text and end the game when the player is destroyed and the current wave clears the screen. So now the game is a working playable piece of work. When the player is destroyed by the asteroid hazard the game over text will appear, then after the wave clears the player will be able to press the R key to restart the game and a prompt in the top right of the screen will be there to say so.

Current Destroy By Contact Script:


Current Game Controller Script:

Game Upon Reaching A Game Over:
 

What I Learned:

     I learned how to call a script when certain circumstances are met and how to end an infinite loop within the game.

What I'm Doing Next Day:

     Next day I will be building the games standalone launcher like the roll a ball game, and then I will move on to the first of the 2 long tutorials the extend this space shooter game.

Wednesday, October 14, 2015

Unity Day 21 (Space Shooter Project)

What I Did:

     Today I started by finishing up where I left off last day. The error from last day was a simple capitalization error which was an error on my end. The code that was effecting me was when i had error gameController.Addscore the s was capitalized on the game controller script when it was declared, so Addscore had no meaning when I put into the destroy by contact script. This was fixed by simply changing the line to gameController.AddScore. So after fixing that I returned to finishing the code needed to count the score. I also added a bit of insurance code to display a message in the console in case I happen to break the game in development. After that I dragged the Score Text game object to the game controller scripts reference slot for Score Text and set the score gained to 10 in the destroy by contact script both from unity. Now every time an asteroid is destroyed by the player the score is increased by 10 in the top left.



What I Learned:

     I learned how to make an efficient score counter in a game that counts by whatever number I input and whenever I tell it to from in code/engine.

What I'm Doing Next Day:

     Next day I'll be adding the game function of breaking out of the games infinite loop and ending the game presumably when the player is destroyed

Tuesday, October 13, 2015

Unity Day 20 (Space Shooter Project)

What I Did:

     Today's tutorial that I'll be following is how to count the points earned by the player and then how to display the via a score counter. First thing I did was create a new empty game object and name it Score Text. I then set its transform so the text would display in the top left portion of the screen. After properly positioning the score text I opened the game controller script to make it count upwards. However it didn't know what made it count up so i needed to edit the destroy by contact script. I added a code referencing the Game Controller script, but ran into an error like before. I unfortunately didn't have time to look over and find a solution today.

Destroy By Contact Current Code (Error):



Game Controller Current Script:


What I Learned:

      Although I haven't learned anything new today since a lot of this was covered in the roll a ball project, I am in the process of learning how to make the counter infinitely go up as needed.

What I'm Doing Next Day:

     Next day I will be fixing this error, finishing the tutorial and moving on to being able to end the game.

Friday, October 9, 2015

Unity Day 19 (Space Shooter Project)

What I Did:

     Today I begun by figuring out the error. I have been unable to figure out how to properly cache and give the GetComponent<AudioSource> ().Play (); a simplified form so I used It's full form to replace the audio.Play. Although this Isn't optimal I had to do it in order to move on with the tutorial so the code currently stands as:

if (Input.GetButton("Fire1") && Time.time > nextFire) 
{
nextFire = Time.time + fireRate;
Instantiate(shot, shotSpawn.position, shotSpawn.rotation);
GetComponent<AudioSource> ().Play ();
}

     Now that the laser fire makes proper sounds every shot, I added background music by dragging and dropping the background music file onto the player controller game object in the hierarchy. Then making sure the play on awake section was ticked so it would begin playing when the game started, and loop was ticked so that the music would keep playing.

What I Learned:

     I learned how to make sound effects play when the player activates and action, and how to add music to a game.

What I'm Doing Next Day:

     Next Day I will be adding a scoring system that counts points when asteroids are destroyed. 

Wednesday, October 7, 2015

Unity Day 18 (Space Shooter Project)

What I Did:

     Today I have begun the tutorial for adding audio to my game. To start it off I begun by simply dragging and dropping the asteroid explosion sound on to the asteroid explosion prefab and again with the player explosion sound on to the player explosion prefab. Then I opened the player controller to try and make it play the laser fire sound whenever the player fire a shot however i ran into an issue where audio.Play does not work in unity 5 for the same reason that rigidbody.velocity didn't work earlier in this project. It is supposedly the same fix however it keeps telling me that .Play is undefined and I'm trying to figure out what is causing this and what to change/fix.



What I Learned:

     I learned how to make a sound effect play upon having an object spawn into the scene.

What I'm Doing Next Day:

     Next day I will hopefully figure out how to fix this problem and move on with adding the audio for the player laser shot.

Tuesday, October 6, 2015

Unity Day 17 (Space Shooter Project)

What I Did:

      I begun the tutorial that involved creating the game controller. I started by creating an empty game object and resetting its transform. I then created a new script call GameController. I wrote code that I've already seen before in the other tutorials, however this was telling unity how to spawn the asteroid game object. I did not run into any new things or issues during this tutorial.


     Now I started the next tutorial on spawning the waves of asteroids now that unity knows how to spawn them. I Did this by adding to the previous script "GameController" and andding adding a variable that lets be tell it how many asteroids to spawn per wave, then telling it to loop the instantiate code over and over every few seconds to keep each wave separate. After doing that I created another new script  to destroy the explosions so they wont get out of control under the hierarchy. I added a variable to let me input how long before the explosion would be destroyed. I input 2 seconds so the explosion effect could run its coarse then delete.




What I Learned;

     I learned how to spawn mulitple objects when and how i want/need in a game, I also learned how to have an object be destroyed after a set time.

What I'm Doing Next Day:

     Next day I will be adding audio such as the sounds for the explosions, laser fire and background music to add to the games effects.

Day 16 Absent

Was absent from class due to being sick and did not make any progress on Unity.

Day 15 Technical Dfficulties

      The Version of windows 10 that was installed expired so i essentially had to stare at the computer screen all class waiting for it to finish. I did not finish in class however so I was unable to work on my unity project.

Thursday, October 1, 2015

Unity Day 14 (Space Shooter Project)

What I Did:

     Today I begun by creating a new game object and naming it Asteroid. I then went to the models folder and dragged the first asteroid model onto the new asteroid game object making the model a parent of it. I added a rigidbody and capsule collider component to the asteroid game object and re sized the collider to properly fit the asteroids model. I then added a script to make the asteroid tumble at random with a simple code and also added another script that made the asteroid destroy itself and the laser fire upon contact. There was a bug that made the asteroid destroy the boundary object on the first frame, however this was solved by adding a tag to the boundary and telling the code to ignore the collider on the boundary.

Tumble Code:



Destroying Code:


     Moving on to the next tutorial, I will be adding explosions to the game. I added two bits of code that allowed me to drag the asteroid explosion and player ship explosion animation onto the variable slots, and made it so it played the asteroid explosion upon contact with the laser and both explosion upon contact with the player ship.



What I Learned:

     I learned how to add hazardous types of objects, how to call an animation upon specified circumstances and how to make an object tumble at random.

What I'm Doing Next Day:

     Next day I will be adding a game controller to control how the game operates, such as spawning waves of enemies and hazards.