Coded some functionality for Cosmic Call
Cosmic Call is a first person multiplayer shooter game designed with the Unity Game Engine.

Team Members:
1- Faith Fuller - 3D Modeler and VFX Artist
2- Sean Smith - Sound Designer and Composer
3- William Doo - AI Programmer
4- Jiaxin Huang - UI Programmer
5- Lajeeth Thangavel- Design Lead and Level Designer
6- Peyton Rodgers - Character Artist and Art Lead
7- Melody Geiger - Producer
8- Pulkit Mahajan - Technical Lead
9- Soo Aguilar - UI and 2D Texture Artist
10- Eduardo Monroy - 3D Prop Artist
12- Jack Kelly - Programmer
13- Mark Salinas - Combat Gameplay Programmer
14- Xiaowen Huang - 2D Texture Artist
15- Usman Khan - Pipeline Manager and Lighting Artist
16- Omar Ali - Level Designer

My role was a scripter who primarily focused on adding functionality to how weapons work in our game, and on syncing certain properties of players through the Photon Network. I also worked on adding respawn functionality for weapon pickups throughout the maps.
ManuelWeaponFiring script and Bullet script working together
for implementing shooting
Bullet steps
1st step - create the bullet with instantiation then add force to it. (Done in ManuelWeaponFiring script)
2nd step - Have the bullet destroyed after a couple of seconds have passed for performance not to suffer.
3rd step - Use OnTriggerEnter to detect when bullet hits certain players, or even other bullets.​​​​​​​
Code from the bullet script
Firing ranged weapon steps
1st step - In update detect input and the type of weapon equipped is a ranged weapon.
2nd step - Initiate the fire ranged weapon function.
3rd step - instantiate bullet and add force. Only when player has ammo to do so.
Code from the Manuel Weapon Firing script
Implementing Melee Attacking
Melee attack steps
1st step - In update detect input and the type of weapon equipped is a melee weapon.
2nd step - when melee attack button pressed, generate a sphere in front of the player. The sphere will store colliders that overlap the sphere.
3rd step - if those colliders are colliders of enemy players then have the enemy players take damage. Check if tags are correct for player and player hit to prevent friendly fire if both are on same team.
Code from the Manuel Weapon Firing script
Holding and equipping weapons that the player has
Have an array to store a list of gameobjects which are the weapons attached to the player.
Change weapons depending on the number keys pressed in Update.
Change weapon type depending on weapon equipped.
Set active the weapon gameobject that is equipped and deactivate the weapon gameobject that was previously equipped.
Code from the Manuel Weapon Firing script
Code from the Manuel Weapon Firing script
Synchronizing Player Gameplay over the Photon Network
For our game to be compatible with multiplayer we used the Photon Unity Network (PUN)

Key terms :
RPCs are remote procedure calls on remote clients in the same room. Clients in this case are players and room in this case is a game match.

Photon Hash tables - Can be used to set and store custom properties of the players or the room itself over the network. For example, keeping track of which team each player is on.
Synchronizing bullets shot by players in the scene
- Allows players to see bullets shot by other players
At the end of the firing ranged weapon function in the Manuel Weapon Firing script, a function called “Shots Fired” is called in the PlayerController script.
Then a RPC is called by the player who shot the bullet on their computer and is sent to the other players over the network.
The other players on their computers run the function “showBulletsInScene” to instantiate and add force to the bullets shot by other players in their scene.
Statement of code at the top is from the Manuel Weapon Firing script
Block of code at the bottom is from the PlayerController script
Synchronizing when players switch weapons
- Allows players to see which weapons are currently being held by other players
At the end of the equip weapon function in the Manuel Weapon Firing script, create a photon hash table that stores the weapon number that represents the weapon that player has equipped and store it over the network.
OnPlayerPropertiesUpdate will allow other players to see that player on their computer has changed weapons on their screen. It does this by calling the equip function for the player that recently switched weapons on other players’ computers.
Code from the Manuel Weapon Firing script
Synchronizing when players hurt or kill each other
From the bullet script, takedamage() is called for the player the bullet hit which lowers the health based on the damage value of the bullet.
A RPC is called so the health of the player hit updates over the network.
When the player hit runs out of health, we find and get the player ID of who shot the bullet and update their kill count. Then we kill the player who ran out of health by calling the die function on them.
Code from the Player Controller script
How Players Die:

In the PlayerController script we call Die() which references the playerManager gameobject with the MyplayerManager script.
Each player has their own Player Manager gameobject with their own player manager script.
MyPlayerManager calls the KillPlayer function which destroys the player gameobject across the Photon Network so it destroys the player on everyone’s computer.
The die function is called in the PlayerController script
The kill player function is called in the PlayerManager script
Gathering and Synchronizing weapon pickups in the map
1. Find weapon pickups in the scene and store them in an array of gameobjects.
2. Create another array that stores the spawn locations of those weapons in the map.
Code from Room Manager script
3. In the weapon pickup script, which is attached in front of the player as a collider gameobject, acts as a way to detect if a weapon pickup is in range of the player for them to pick up.
OnTriggerEnter used to get and store weapon pickup in range as well as set close to gun to true, however only if weapon pickup is active in scene.
OnTriggerExit to reset when weapon pickup is out of range for the player.
Code from Weapon Pickup script
4. In update, detect if a weapon pickup is in range of the player for them to pick up with the " f " key pressed.
5.  When in range, the weapon pickup active state is set to "false", and the weapon pickup’s position is sent to the “deactivate weapon” function in the room manager script.
Code from Weapon Pickup script
6. Activate an RPC in the Room Manager script and, in every player’s computer, call the deactivateWeaponInScene function.
7. Find the right weapon to set its active state to "false" based on the weapon position passed by the player’s weapon pickup script.
Code from Room Manager script
8. Each weapon pickup is a child of its own parent gameobject that acts as respawn manager for its child. When its child active state is set to "false", then set its activate state back to "true" after a certain amount of time has passed.
Code from Weapon Respawn Manager script
Cosmic Call
Published:

Cosmic Call

Published:

Creative Fields