SevenSeasToGlory - Sprint 2
SevenSeasToGlory - Programmer Sprint 2
Spawners
During Sprint 2 I had to implement a mechanism for handling Pirate Ship's and Pirate AI spawner. In Sprint 1 I just had the pirates spawning on the playership for testing purposes so I can work on the PvP combat. Now that I have worked on the pvp and the team and I feel satisfied with, now I was tasked to change the spawner to be on the Pirate Ship when it get's instatiated upon start. Same with the Pirate Ship's, they all get instantiated upon start and in the inspector you can actually choose how much ships you want, radius upon spawning so they aren't close to each other (or if you want them close to each other, decision is yours) and also how many pirates you want on the ship.
MiniMap
With the MiniMap I was also tasked on the create a basic design so it shows the players, ships, and enemies that are around you. Right now it's just a basic square giving the player a sense of awareness of what is around the player.
Blocking
With Blocking I was tasked to create an animation blocking effect and also reduce damage from incoming players giving the player options on how to engage in combat with the pirtate's.
AI
I've been working on AI's tasks since Sprint 1 and I have been enjoying every minute of it. During this Sprint I got tasked with working on the ship's sailing AI. I programmed each ship to first spawn looking in different direction going straight. Then after that I start with their decisive turning with left and right so it looks like the Pirate Ship's are actually sailing around the ocean which looks pretty nice and very proud of the work I put in. This ends up giving a player a unique feeling that he is playing a pirate game and feels engaged since there is other ships in the vast ocean that the player can see.
With Damage Indicators I actually came up with the idea since in almost every pvp game there is a damage indicator system that allows the player to see how much damage they are doing to other players or enemies. I created a floating text based on how much damage you do to a pirate and it dissapears after a short while
Some problems I encountered on the way
Problems I encountered was spawning the ships and directing their movement. I started off the beginning when using vector3.foward. The code wasn't what was wrong it was actually the orientation of the prefab of the ships direction. In the prefab the local axis was wrong so when the Pirate Ships would spawn it would actually move straight but the ship was sideways moving straight and it obviously looked wrong, it took me about a whole day from 8am to 8pm to figure it out. I would be at school, then work debugging and checking untiy's website for countless hours debugging my code. Then finally I checked the prefab and yup... the local axis was wrong and it was facing the wrong z direction. Another problem I encountered and actually still is a problem I am trying to fix. When the Pirates spawn on the Pirate ships, the ship will move the pirate's to the back of the ship because of the ships movement. I tried to child the pirates to the Ships prefab and still didn't work, and I am not too sure why. The code works for spawning the ship and pirates but just for some reason the ships movement affects the position of the pirates, I essentially would want the pirates just to stay still or roam around the ship while the ship is moving. Lastly the animations. The animations work perfectly but sometimes importing an animation from mixamo to unity the rigidbody animation gets obstructed upon importing to unity so I need to find a way to fix the animation for Sprint 3.
Logic
For the spawning of ships, I just have a for loop that iterates through a public variable that you can choose to spawn as much ships as you want to, then I just used a vector3 for a random position between a unitsphere, and setting the y at 0 for the ocean. Then I position the ship in random angels so each ship moves differently.For the spawning of pirtates I just have a for loop that iterates through a public variable that you can choose to spawn as much pirates as you want on the Pirate's Ship. After they're all spawned on the ship I set the pirates to be a child of the ship.
For the Ship's AI sailing I used a vector3 and made the ship sail forward. If for a movement there is no turning involved I created a DecideTurn() function to dictate whether to turn left or right with a certain % chances of turning left or right, right is obviously greater. In that random value if it chooses left then the ship will turn left and this happens due to using a transform.rotate to turn the object, this is for turning left and right.
For the MiniMap I just make sure the MiniMap Camera is always following the player.
For blocking I am using the new input system so you can block on any type of controller whether it's mouse or controller so it's universal. I created a InputAction called "Block" so in the player script I created a function called "OnBlock" so when you hit right mouse button or left trigger on a controller the animation of blocking plays, and when you let go you stop blocking. The second picture I just referance the player controller so I can grab the isBlocking bool so whenever it becomes true you take reduced damage from pirates and if it goes back to false and you get hit by a pirate you take normal damage.
Results
Comments
Post a Comment