Game Design-group Lycanthrope AI Bees part 2 I’m firing my Lasers

Hello, today I will write about how I upgraded my AI bees for our game. Our AI bees relied on circle colliders, but now they use line casting for detecting all kind of things, but mainly the distance to the player and if a point in the formation is empty.LASERSSSS.png This new system will allow our bees to react dynamically to the player, the honeycomb formation, and the different positions the bees will have in the idle state. I made this by using the line cast which comes with Unity, and the line cast has a unique function to access game object it collides with like a regular GameObject, but it does so faster than ordinary ”GameObject.Something”. I had some significant problems at first with that all the six bees found the same point in the formation. I solved this by adding all of the formation points to an array, and when a line cast hits that point, it sets a bool (Which is called isOccupied) to true and adds the line casts name to the formation point. This method allowed me to go through the array with all the formation points quickly, and check if the bool is true and if the position has a name on it. If the game object is not in use and it has no name attached to it is open for the AI bee to claim. Only when the line cast leaves the GameObject is the bool set to false, and the name gets set to empty, this allows reusability even if the player dies and respawns and if the AI bees need to change their line casting. This method has been an incredible learning experience for me as I have started to use the line casting in many different ways. For example, finding the closest enemy, detecting the distance from the bee and if it is greater than a set distance it moves in so it can fire on the enemy and go back to is the original position or turn away if the enemy is to close.

I know I changed the topic from what I said I would talk about last week, but this was more exciting and fun topic to explore.

En tanke på “Game Design-group Lycanthrope AI Bees part 2 I’m firing my Lasers”

  1. Hello, Adam! This is Jesper from Vampire

    One rather significant issue I have with this blog post is the sentence structure and grammar used, since it forced me to read some sections over and over again to understand them.
    The subject of this particular blog post is, as you mention towards the end, indeed interesting. Linecasting is something very useful within Unity, and it is good that you decided to explore it early on. I would even go as far as saying that this blog would have helped me in my development if I have had the time to read it earlier. You mention early on in the blog that you ”upgraded” the AI of your bees, but you never clearly communicate why. This is not a big issue in any way, but some context as to why you upgraded the AI would have helped.

    As previously mentioned, I would recommend that you make sure to proof read you posts and work on the structure of the sentences for future posts. Other than that I would consider this a helpful post that serves a purpose for anyone who needs dynamic detection in their future projects.

    Well done!

    Gilla

Lämna en kommentar