DEV Community

Cover image for GameDevHQ Intensive Training Week 08 Recap Final Week ๐Ÿ“
Esther
Esther

Posted on

GameDevHQ Intensive Training Week 08 Recap Final Week ๐Ÿ“

Recap time.

Yes I know that I skip week 7 ๐Ÿ˜…but trying to recap Paypal experience is going to take some time BUT another developer did a EXCELLENT job explanation Paypal API and I will leave a link below:

https://schatzeder.medium.com/decoding-documentation-paypal-integration-in-unity-bdf1004fd0ca

For week 7 I really enjoy the whole idea to learn to make Paypal API functional on Unity. Lots of ideas actually came during week 7 and just need to sit down and put it into practice.

One thing I was clear about, thanks to week 7 Unity no longer is just a game engine for me.

Week 8 started as a practice week for mockup jobs interviews and mockups game projects. Each of the candidates were giving 2 projects in order to complete it in 48 hours. I was the following two: Game AI & Closest Target

GAME AI

Alt Text

I was given the task to make a simple AI in which a Sphere will be rotating in a circle with 10 waypoints and the cube will be moving at random inside this drawn circle. At first I was a little worried since to make the circle we need to use two mathf properties that i have never used, mathf.Sin() and mathf.Cos().

Once I read the instructions I decided to tackle first the circle with the 10 waypoints.

First search I did was to understand what mathf.Sin() and mathf.Cos() does; I jumped straight to unity documentation. For both mathf Sin and Cos unity uses the same code example and ironically it shows how to draw from the center of your choosing a line to the end of the sin and cos calculation.

Alt Text

Once I debug what was the example doing I then jump to change some value to get desire result in drawing a circle with 10 waypoint

Alt Text

Doing the changes I was able to locate my 10 waypoint and store it in a Vector 3 List. This list I will be using it to move my sphere and to draw my circle. To move my sphere I was introduced with the concept of Seek and Steering. Seek and Steering is a Vectors math calculation that allows you to move your GameObject and make a sterling effect so it wonโ€™t snap to the next position. For this I follow I explanation in how to determine the seek depending on the velocity and the next position for the GameObject, this calculation was not writing to Unity c# but following the logic I was able to incorporate on my project.

Alt Text

Another alumni of the training use the same resource / payper I used and is explanation for the Seek and Steering was to the point; Ii will paste that link below:

https://bjmercier.medium.com/simple-ai-behaviors-seeking-5d546c182c76

To incorporate the cube was easy; need to use the same logic to draw a line the only thing is that is random position was using Random.insideUnitySphere, with this i am able to give him a random position inside a fake circle and he will not go further from the radius I told him to stay.

Alt Text

CLOSEST TARGET

Alt Text

Closest target was my second project, the title gives a pretty good idea on what I need to do. If an enemy is near to the player, dot in blue, the enemy will turn green now if another enemy is the closest to the player this will turn green and the other enemy turn back to red. The enemy and the player will move randomly in the scene using a NavMesh agent.

To light the enemy green when it was near the player I prototype 3 to 4 different ways.
Since I alway ended up repeating some section of the code I decided to approach it using LINQ. Since all of my enemies were stored on an array, using the namespace System.LINQ, I decided to order the enemy list to the near one to the further of the player. This allows me to alway have the enemy.[0] has the near one to the player.

Alt Text

This has been a wonderful experience, since this blog post is a little long will make another one for what I am doing since I finished the intensive training and my thought of the process๐Ÿ˜Š

TO BE CONTINUED ๐Ÿ˜Ž

Top comments (1)

Collapse
 
icecoffee profile image
Atulit Anand

I have no idea about game development.
But the title was so catchy lol ๐Ÿ˜‚