WEEK 1
Analyze A Game Mechanic:
Hover over image to see notes.
I think that programming is the class that I am most nervous about as I do struggle a lot with logical problems. I am however very excited to start to learn programming, since I would love to create my own game one day. I have absolutely no experience in programming so hopefully by the end of this I will have at least a bit of knowledge to kickstart me.
WEEK 2
Programming a clicker game in class was quite interesting. I found it quite useful to have everything broken down as we moved along. I did find it a little hard to concentrate however. At home I have been watching a youtube video on how to make a clicker game step by step, so I can add more features and understand coding in unity better. So far It's been going well. I can follow along and code at the same time at my own pace. I've learned how to add and program buttons, animate popup text, make a counter, add a sell button, add sprites and create a pop up. Iāve learned a bit more about if and else statements, although Iām not sure if I will be able to logically apply them in different situations just yet. I am surprised at how fun programming is. Iām hoping that as we move forward I will start to understand the language a bit better and how to apply it to my own needs.
So far you can click the Cow button to get milk and click the sell button to sell milk to get USD. If you try to sell milk when you donāt have any, a little message will pop up in the purple box to say you donāt have enough milk and the button wonāt work. There is also an automatic milk adder applied that adds 1 milk per second. However it is not attached to anything yet. Eventually there will be an option to buy a farmer onto which I will attach the adder to.
Today we went over data types, what they are used for and what they stand for:
Int: whole number (1,2,3,4)
Float: Decimal (1.1, 2.2, 3.3, 4.4)
String: Characters in āā (āa, b, c, dā)
Bool: a statement that is true or false (My name is Georgia = true;)
WEEK 3
In class today we learned some new concepts:
Referencing: gets access to another script or game object (GetComponent)
Adding forces (physics)
Learning to make a character move and pick up coins was interesting. I started to understand how to apply scripts to objects a little better and things are starting to become more intuitive. It is a bit hard to process what Iām doing as Iām following along, so hopefully the more times we go over things it will start to sink in.
I continued to follow along with the YouTube tutorial on how to make a clicker game to improve on it. Iām actually finding it quite helpful as it goes over some of the things that we went over in class such as variables and classes. I now understand that a variable is declared and then it is named to be able to refer back to later on in the script.
In my clicker game it is now possible to buy a farmer which adds an auto click. There is also a purchase log which makes things cost more each time you buy them. Iām still at the point where Iām just following along to the tutorial and trying to understand what Iām doing. Iām hoping that once the video is finished that I can use what Iāve learned to add even more mechanics.
WEEK 4
Learning C#
I tried using code academy this week as after class I felt as though I needed to brush up on a few concepts. It actually helped me so much. I now actually understand what I have written in previous code. I did understand what I was doing before. However because I was following along to someone else, I wasnāt able to retain the information I had been given. Whereas now having a brief explanation alongside having to figure it out for myself helps me to retain better. Iām hoping to catch up on some more code academy and hopefully things will become easier to grasp.
Space Invaders
Today in class was easy enough to follow along. Unfortunately I didnāt save my game properly, so when I went to load it at home my heart sank. Thankfully all of my pefabs and scripts were still there, there was just nothing in the hierarchy. So I had to figure out how to make the bullet work again, which I did eventually! I tried to make the bullet disappear once hitting an alien and after a while I was able to figure it all out for myself. That was a proud moment. I also tried to get a score working, by looking at how I did it in previous games, but I couldn't get to that point by myself. I refreshed my memory with another youtube video and eventually got there. Iām hoping that with a little practice in this area I can learn to do this myself as I still find it quite complicated.
WEEK 5
This week in class we remade Space Invaders. I found that I made a few mistakes that I couldn't figure out how to fix, since I fell behind with an issue and the class was moving along at a quick pace. I donāt really know how to fix this so I may just go back to the first Space Invaders script and work from there. In retrospect, I should have stayed after class and asked for help, but I had received some bad news that day and just wanted to go home.
Space Invaders Redo
WEEK 6
Trying to Fix Space Invaders
I managed to fix the boundaries, however that seems to be the only thing I could do. For some reason now the score is not working anymore. I tried really hard to figure out how to make the aliens shoot and move, but I gave up after a while. The code that Sonnu gave us in class doesnāt seem to be working and Iām not really sure how to fix it. I feel a bit overwhelmed so I think I will try to do some code academy for now.
I have been struggling a bit with my understanding of programming, so I decided to invest my time in some code academy lessons. I did a few, but the ones that I found most useful were the ones focused on if and else if statements.
I made a script that uses an if statement to decide to go to SaladMart if there are equal to or less than 10 people in line. If the if statement is false, the else statement tells you to go to Soup N Sandwich instead. The program will then print the answer in the console to the right depending on what data is present.
I then made a script that decides games based on how many guests come to a party. I used an if statement: if there are 4 or more guests then the console prints Catan. Then āelse ifā to add another condition: if there are 1 or more guests the console prints Innovation. Finally the else statement (meaning no one shows) then print Solitaire.
WEEK 7
We were introduced to John Whitney, the animator and inventor that created computer generative art. The first invention that was used to generate computer art was considered to be analogue. Whitney reconfigured a WWII anti aircraft machine that was used to aim guns at planes with accuracy, to instead use calculations to create art.
Using a pre prepared package that Nick created, we played around with generating our own art, mainly by messing around with the sig and cos functions. sin and cos are terms from trigonometry that are used to determine the angles of things. We were shown how sin and cos can be used to find the position of a given point on the diameter of a circle in reference to the circle's radius and what angle that creates.
Computer Generative Art
In the beginning, the amount of maths that was being brought up made me nervous, since maths is not something that Iām good at. But once I found out we were just playing around with a pre-made script, I had a lot of fun. In the end I feel as though I got a cool result.
My Computer Generative Art
WEEK 8
I wasnāt able to make it to class today, but I walked through what was done in class by Thomas and tried my best to understand what was done.
From what I understand, what we did was create a mesh so that the AI can understand where it can and cannot move through. Then we added waypoints for the AI to move to. The programming part went over my head a little even though Thomas explained very well.
Ai Pathfinding Project
I also tried to fix space invaders by combining week 5ās scripts with my week 4 project. I managed to get the boundaries to work but I couldnāt figure out how to make the aliens move or shoot.
Again, I understand the ideas and use unity to put things together and make them work. However when it comes to the actual coding part, I can only really understand things once they are written down. Iām actually finding it really difficult to retain all of the information, so when I try to recreate things, I just canāt make sense of it. Iām actually starting to get really frustrated with it.
WEEK 9
Singleton
Iām not sure that I fully grasp the concepts of singletons yet. From what I understand is that it is used in a script that there is only one of and that after creating it as a singleton all other scripts can refer to it without it having to be declared. We also went over some other ways of organising scripts but at the moment I think Iām not advanced enough for this stage and Iām going to try to focus more on making a functional shooter game.
First I tried to copy and paste the Player Movement script from space invaders and fiddled around with it so that I could move my player vertically as well as horizontally. I remembered Sonnu saying that the boundary system we used in space invaders wasnāt great because it wonāt work properly on a different sized screen. This is why I tried to follow a tutorial that showed how to make the coordinates work on multiple screen sizes. I was able to implement boundaries in my script although when getting close to the boundaries my player would snap to them.
Starting Shooter Game
Problems With Boundaries
I looked up a solution to this and found a YouTube tutorial that implements another script for boundaries and followed along leaving notes for myself in the script so I could understand what I did when referring back to it.
Boundary Issues Fixed
Shooter game Scripts
WEEK l0
In class we did a quick exercise on arrays and how to use them.
An array is a data type that stores one value. It will usually be written as public or private followed by the variable type and then square brackets. After the square brackets is where you give a name to the Array followed by an = to then classify what is in the array.
Private string [] Alphabet = {āAā, āBā, āCā};
Further on in your project you can add a command that changes any given value in the array. All that needs to be written is the name of the array, in [] the position number of the value you want to be changed and then what you want it to be changed to.
Alphabet [1] = āhelloā;
In this instance the letter B in the array will be changed to hello. This is because computers count from 0 so the position of A = 0, B = 1 and C = 2.
Arrays
I spoke to Bradley and Sonnu about my struggle with coming up with how to add pathfinding to a 2D game. They recommended that I try to follow a PacMan style of pathfinding, where the enemy follows a bunch of nodes that are laid out. Kind of like waypoints. I started to follow a Pacman tutorial on how to create pathfinding. It was a little hard to figure out where to start since my game is different to Pacman so I switched between videos to piece together the bits I needed.
Shooter Game Continued
Shooter game Scripts
Because I was struggling to figure out what parts I needed and didnāt, I asked my sister Lana to help me. Lana knows a lot about programming so I thought that it might be good to get her to explain some things we went over in class to me again.
Lana took one look at the video I was following and told me to stop and delete all of my scripts from that video. We sat down together and she broke down what she recommended and why. We laid down a few nodes and the problem solving began. It was really useful for me to do this with her because she has never programmed in C# or in unity before, so we were both figuring things out together. She would break down what she would usually do and then I would tell her what I thought that might be from what we learned. A few times I was able to solve a few problems, mostly with syntax, which really gave me a confidence boost.
I think I learned a lot more by sitting down with my sister and having her explain what she was doing and why than trying to follow a tutorial. She made sure that I understood what was being done and why. The first thing we did was set up a method for the enemy to find the nearest node. She explained that we needed to set the shortest distance as an absurdly high number so that the enemy will always be looking for the nearest node. We then made it so that the enemy moves from node to node in a cycle by cycling through the objects starting from the node it is closest to. There are 14 nodes in total and once the enemy reaches the final one it cycles back on itself. One issue we ran into was that the enemy kept trying to go to nodes through the walls so we had to implement a script where it canāt see the nodes through the walls. We did this by making the enemy cast a ray to see if there were obstacles and an if statement telling them to go to the next unobscured node. I think the if statement here was the hardest thing for me to grasp.
Once that was done it was time to actually make the enemy move once it found a node and player detection. In void update() we made it so that the enemy will move to a node. Then we had to specify for it to move to the next node once it arrived at the first one otherwise it would think the node that it is currently on is the nearest one. After setting up the pathfinding it was onto making the enemy chase the player within a certain radius. To do this we made it so that if the enemy detects the player within the radius then it chases them. We did have a few issues again where the enemy would see the player through the walls and would run through the walls to get the player. This happened because we had to take the rigidbody 2d off of the enemy since for some reason with it on it would run away from the player instead of chasing them. To fix this we used the same solution of casting a ray to determine whether or not there was a wall in the way and that solved this issue. We then had to specify for the enemy to go back to the nodes once the player left its radius otherwise when the player died an error would pop up saying that the target object was missing.
After my sister helped with the hardest part, I was able to add things like health, damage and scores. She stuck around to help since when I added things like damage it affected the pathfinding. But the rest was simple enough for me to figure out.
Shooter game Scripts