Games Development / Exercises

06.04.2023 - 06.07.2023 (Week 1-Week 14)
Esther Vanessa/0350751/Bachelors of Design (Hon.) in Creative Media
Games Development 
Exercises

JUMP LINKS


EXERCISE 1 (WEEK 1)

For our first exercise, we were instructed to play a bunch of games created by the previous batches in the same module. To play them you can access them here. Afterwards, Sir Razif instructed us to choose a game we like and review the game, point out the good things, what we can make a mental note and save for our reference later and also on what the game can possibly be improved on. 

After browsing through the games (and failing miserably, or the game just would not load) I decided on reviewing MISTY NIGHT by TAMARA AUDREY. 




My first impression of the game is that the art style is really cute and everything looks very very clean. The animation itself when the character attacks/hit the boxes is really smooth and clean and I can see that Tamara probably had her cheeky and smart way to design everything so that everything looks smooth. I have to appreciate what she could accomplish in 14 weeks and felt like she utilized things such as the attack button creatively (to hit boxes). I liked the fact the placement of the coins as it guided us on how to do the parkour and also that we could have 5 lives before it's game over. 

I should also mention that I liked the character design, felt like it's simple enough but also very adorable and I could see the basic shapes and balance to it.

The game itself is a standard parkour platform game and we need to get to the next checkpoint. I personally felt like the game is a little bit difficult (or it could just be my skill issue bcs ive seen my friends got to checkpoint 3) but the checkpoint for the first level itself is a bit too far for me. I felt like that was my only issue with the game. It was simple at best but the goal itself is clear and understandable. 


EXERCISE 2 (WEEK 2)

For our second task, we were assigned into groups of 4/5 and I ended up grouping with a couple of my friends (Michelle, Luisa and Audrey). We were to apply the brainstorming method that Sir Razif has mentioned earlier in the lecture, and try to ideate a new game. We could adopt from certain existing games, and develop from there. The method we finally went with was with the 3Is, which are:

  • incorporate/include
  • improve
  • inverse/invert

After huddling for a while, Michelle went on google and search for some famous games to see if there are anything funny or parody like to be inverted. Then that's when we saw GTA 5, one of the games I enjoy a lot (albeit the low hours of playtime). I recalled the fond memories of me starting out the game as a good, contributing citizen of Los Santos, driving slowly, never crossing the red light (which my friends would proceed by laughing at me because I drove so slowly that they're so far ahead of me). This story I have told Michelle a couple months ago and she seemed to remember this, so we both came up with the idea of what if we remake GTA but let them reward us if we are a good lawful citizen? Pitched this up to both Luisa and Audrey and they both found it hilarious and also a damn good idea. 

So slowly ideating from this, we try to include everything we like about GTA; the concept of 'rags to riches', getting up the ranks in your career and have access to multiple exclusive organizations. This, we realize, is ultimately similar to The Sims, the game we all have known and love, and we did not mind this, therefore we're sticking to this. This being done, Luisa and Audrey came up with the story of the game while me and Michelle try to ideate the gameplay itself.

Here is what Luisa and Audrey came up with (and after a few amends by yours truly too).

Essentially this is a parody of GTA. We will be playing in Los Santos but here is what we came up with for the gameplay, broke down to 3 parts; the challenge, the reward, the goal.

  1. The world is against the player. It ENCOURAGES the player to do crimes such as,
    • bigger opportunity to steal stuff because there is no security
    • the traffic light is always red, encouraging the players to go through the red light
    • no trashcans everywhere, therefore forcing the players to litter
    • basically it’s similar to the regular Los Santos we all know but the goal this time is not to escape the police but to get the rewards from being a good player, which brings us to the next point.
  2. The game REWARDS the good players. The good examples include,
    • The more you recycle the more money you get.
    • You can interact and build relationships with NPCs, the more they like you, the more nice things they will give you (this includes money). This you can do by giving them chocolates, flowers, etc.
    • You can also donate to charity and the homeless, which would further increase your popularity and relationship status
    • You are also able to repair and restore, say, the trashy or vandalized public space, or the broken public resources.
  3. You can STILL get nice cars, and nice apartments, those are not eliminated from the main story.
    • in fact, that is your goal.
    • to get rich but ALSO be good.
    • You can also rise through the ranks in your career, the higher you get, the more difficult it is to do good. This can be implemented for example when you are given two choices to do good or to do bad, the worse choice would make it easier for you to, say, finish the conflict, while the good choice would make it so that you stay longer in the conflict. This would obviously create some sort of judgement from the players.

Then, we put everthing into a slide and presented in front of the class. We were the first group too and the feedback from the rest of the class was great as they laugh when they saw our presentation, so I think we achieved what we were supposed to do in this week's class.

Here's the complete slide. 




EXERCISE 3 (WEEK 4)

This week's story is my laptop got rained on, broke down, so I had to resort to sharing laptop with my friend Abigail, so if the screenshot turned from windows to mac, that is why. 

This week we're introduced to unity, was excited for it until the laptop I was using in class just wouldn't open the app. Firstly we were introduced to components.

1. Rigidbody 2D 
Used so the objects recognizes gravity. 

2. Box Collider 2D
Essentially for objects to recognize each other as a surface/hitbox. 
This follows the ground rate scale, so no need physics calculation.

These 2 are essential to what we were making in class. 

First, we created a 2d Capsule sprite. This acts as our character. We also added a 'ground' with a rectangle. To both we added RigidBody and Collider.



Following the next instructions, I added more sprites, the goal is to launch the yellow square to the red boxes.



Then we were to add scripts to the file. Previously we only utilized physics, we wanted to try out movements on x axis and jumps. 

To do that we follow the steps => Add components => Add script => name it as playerControl

then add the script to the character sprite (capsule). Then we can edit the script by clicking on the elipssis of the component.

Then to the existing script we can add scripts like the picture below. 


We can also set the x to movespeed to be able to add custom speed (window below will show up). This also enables you to control the jumpspeed. 


Script for jump. 



To disable the infinite jump, we need to create a gameObject and tag it as "ground". That way, with scripting, it disables jump on non-"ground" object. the gameObject 


Scripting above is to allow the game to detect if the character (Capsule) touches the ground. We can then write down this script (highlighted)


Then for unity to enable double jump, we do this next script. 


Also do not forget to add these scripts so that the window (movespeed, jumpspeed, checkbox on the double jump, etc.) to show up. 


Other than that we can also play around with gravity and mass right in the Unity app. Sir reminded us to recolor the windows when we're on play mode so that we won't make any changes in game mode ( it won't save to the file, it'll be gone ). 


EXERCISE 4 (WEEK 6)

This week we started by animating doors.


We created an empty Game Object called doorTrigger and position it behind the door, so if our character passes through that game object, it will remove the door altogether.


To do that, we add the script to the doorTrigger and drag the Door to the component.


Afterwards, we want to try to create a better animation, therefore we create an Animation folder and add an animation where the door moves upward whenever the character enters the "doorTrigger" space.


To do it, just drag up the door in the 1 second mark when recording, it will automatically animate it. Also do not forget to uncheck the looping option in the animation clip.


Then we want to add this script below. Interpret it as whenever the character moves into the doorTrigger space, the animation will play. 


This is the result. 



Then we want to add another animation to close the door. To do this repeat the steps when creating the Door Open animation but reverse it. 





Then afterwards, add another doorTrigger (call it doorTrigger2) and place if AFTER the door, so that whenever the character passes the space, it will animate the door closing. Do not forget to check the "is trigger" option on the box collider component.


Add a similar script like the door open in the doorTrigger2 script.


It will show up like this. (The door is closing down trust me)


Next, we added a sprite called Gem-key to act as a key for the door. We want the game to trigger door open ONLY when you have the key.

When putting the sprite, remind yourself to set the Z of the position to 0.

Afterwards we want to add another line of code for the playerControl script, adding the condition IF you touch the gem key, the gem key will disappear (not the character). 


In the beginning, we do not have the key, therefore we add this script. 



Then we want to link the playerControl script to the doorTrigger script. To do this, we want to add this script. Afterwards, we only want to the door to open with the condition that IF the player.haskey == true. 


Next we want to try to add coins and animate it + add a counter + condition if you have 20 points and the key, you can pass through the door.

First we want to add the coin sheet and slice it (set editor ituo multiple, slice it automatically). Then the animation will be there automatically. Drag the sprite down to the asset and it'll be prefab (asset you'll use over and over again without changing it one by one)



Then we add new script for the coin and do this script. Code line 11 is to getComponent from playerControl the gameObject of Character we set as player. 

The condition written down below is cascading, it would only destroy after getting 10 points per coin. 



Add condition if player has 20 points (10 points per coin), and a key, the door will be able to be opened. Do this in the doorTrigger script.


In the playerControl script, we add the public integer of mycoins (for the counter). We start with 0 points. 


Next thing we want to add is adding something similar to like jumpspeed and movespeed to the coin value, that way if we want to change it in the middle of the way in our prototype, it's not gonna be too hard.


Add cinemachine to the character, add a couple of settings to create a better view that follows the character.


Add visual cue to the coin. To do that we go the animator, animate there and add a couple of scripts.


Add keyAnim. 



Then add this on the Key Anim section in playerControl Script. 


EXERCISE 5 (WEEK 9)

For bullets 
  • create empty game object - rename as spawnPoint - place under the character

  • for the bullet , create 2d object - sprite - circle
    • Add rigidbody 2d (for movement) and gravity 0 + circle collider 2d (to detect collision) check the isTrigger.
    • Drag to the asset folder - will be a prefab.
    • Delete from the hierarchy (left column)
  • Go to the playerScript and write the code


Check first if it works. 



Project Settings - check Input Manager - Fire1 will be triggered by left click mouse




To actually spawn it under the click of the left button mouse, use the same script but under the if condition that the Fire1 is triggered.



write the script and set bulletspeed to 800.




To Destroy the bullets, write the script.




Create - new script - name it DestroySelf. Drag the DestroySelf and put it under bullet's component.




in Door - check the Apply Root Motion (under Animator)



Create new sprite - Capsule - add Rigidbody 2D (Check Freeze Rotation) and Capsule Collider 2D - tag it as enemy and rename as Enemy


add new script name bulletControl - write the script - put it under bullet. (To destroy enemy and the bullet after collision)



Under enemy - add script named enemyControl, enemyhealth etc. - you can now add enemy health in under enemy. 




Under bulletControl, we add this script to let the game knows how many time we need to hit the enemy until it dies. (the bullet getting destroy is outside the if condition since it does not need the specific condition; it will just get destroyed no matter what)
 

To create effects/visual cue 

  • Download some spark effect from unity store and import to unity. 
  • write script and put under bulletControl 
  • drag the selected effect and put it under the bullet section (in the bulletControl component)
  • put DestroySelf in the effect component
  • under prefabs - double click FX - start delay 0
After killing enemy, spawn object.
  • Add the object to the screen (for example a power up you can take)
  • Add circle collider 2D (check the istrigger)
  • Drag into the asset folder - it will be set as prefab - delete from the screen. 
  • Add new script under the enemyControl script.


  • Create new animation under the object component - move it up and down using the animation
    • Apply root motion to the animation too.



EXERCISE 6 (WEEK 10)

New script to collect the power up gem. Put it in the prefab's script.


To add the movement speed of character upon getting the power up. Put in the gempower up script.


To make the speed up temporary. Without the hard coding.



If you want the power up to only be triggered after collecting. Add this to the playercontrol script




In the GemPowerControl Script, delete the code lines and replace with this. 




To make the enemy fire bullets at the character. Create a new script under the enemy - Enemy Attack Control.


Drag an asset (Sprite) to the bullet column in unity. 

Animate the Enemy attack. Enemy_Attack - Make Transition - Drag to Enemy Idle.


Add Animation Event in the animation. Add the function Shoot(); to the animation event.


Add spawn point of the 'bullet' called wheelspawn. 



to change the x and y speed (trajectory of the bullet)


Randomizing the bullet trajectory from the enemy's attack. 


To make the bullet deal damage. Add script to wheelblade. Add playerhp variable to playerControl Script.




Create invisibility when getting a health gem.
Add script to the health gem. 



In the playerControl Script.




Update to the WheelBlade Script (damage). Exclamation mark is to reverse the code. so in this case this means if player doesnt have the shield.


Character animation.

Go to sprites and select sprite mode to multiple - slice them up in sprite editor.

Add those to the animation


In Animator, create linkages



in playerControl script


Animating between the idle and run without delay



Animating the character moving to the left


Fixing bullet spawnpoint







Adding slash point to the attack animation


Set the Box Collider to isTrigger!

Coding for playerControl script (to enable the animation)

Add coding for indicator enemy hp to enemyControl 


EXERCISE 6 (WEEK 11)



Create a prefab and add collider, set to is trigger.

Add gameObject spawn manager, move it to set the spawn of said sprite - Create script




To access fire -> bullets[0]
To access wheelblades -> bullets [1]


this will only spawn 1 tho. so to spawn a lot of them, do this script. use invoke (call multiple times)


This script below will allow random spawn position


this  will randomize the items that will fall

this will let it spawn when character is in range. Make box collider for spawnManager and also stopSpawnTrigger. Use the script below in spawnManager.





Create new script called stopSpawnTrigger (empty gameobject, child of the spawnManager).





Box Collider for stopSpawnTrigger





REFLECTION

Week 2:
-The exercise for this week is fun. Concepting, making up a story and imagining a gameplay in my head has been my hobby since I was young. This was not only fun, it was also my chance to work and brainstorm in a group setting just like in real world experience. Pitching and presenting practice was also something I am no longer scared of. So, all in all this was a good experience.

Week 4:
Had to spend the class just looking at the instructions, have to make a mental note and try it myself in my friend's laptop. Was not really a fun experience other than watching the 'game' comes alive in happens real time.

Comments

Popular Posts