Introducing AI


Hello everyone,

today I am going to present you my progress regarding Non Player Characters or in short NPC's. First I want to show you what I came up with the evil looking bunny I created while messing around with the shaders. I had the idea this bunny could follow the player and do some behavior depending on the state he is in. With the movement controller I had it was not  hard to get the bunny moving and to make a little AI for it. Let's ignore that the bunny sprite looks awful, I just created it for the purpose of testing. Here is the result:


Depending on the position the player has the bunny performs certain behavior as follow or jump, when player is above the bunny. This worked quite well in the beginning even it is buggy here and there.


The bunny is able to follow the player and perform jumps. In this point it also was very clear that I need to refactor the bunny sprite

To have this movement working was kind of feeling good. The MovementComponent I created is working as expected and I can imagine to create some animals or even enemies that can follow the player around for any purpose. One issue I had though with this, and this was the collision detection and in some situations the bunny is behaviing a very stupid way, which is breaking the illsuion of an animal following you. This part of the NPC-section needs to be refactored, but I layed it down for a bit, becuase I had enough to see the movement code and to do the controller for the bunny AI.


I went to create and refine the glowworms and their AI. As said last time I created a safe-space and some different types of worms and I am quite excited to show you my progress, because I feel that every step is bringing me one step closer to a really enjoyable game. The creation of the glowworms and their behavior opened new dimension to the game-play. I refactored the whole thing and made some different types of glowworms.


Green Bugs gather inside the box, while red bugs stay away and chase the green bugs.

There are friendly worms and enemy worms (for) now. Friendly worms will join the player in some way to follow him along the world and find their safe-space. Once reached this spot they will no longer be affected by enemies or the player, but live their life's as gentle glowworms and illuminate the world.The enemy worms will chase friendly worms, depending on their type they could attack other worms to kill them or even attack the player, so he loses his friendly glowworms. They will stay away from the safe-space and some will even avoid the player (maybe this can depend on some value or status the player has later).

Here is how they are set up:

  


The Bugs have different functions like gather on one spot, follow a target or avoid a certain target. Like this bugs can also follow or tempt other bugs and create interesting behavior. Like this could be chains of dependencies, like you need to collect all the green bugs, where  they just follow a big blue one, which the player then needs to maneuver around the map and try to keep all the bugs away from enemies or he will lose them all.
With this glowworm-settings it is quite easy to achieve this chain, all I need to do is to create a new type of worm and give it as Follow the player, create another type that will just follow this specific type of bug. this system is easily expandable.

Ok guys want to see some action, right? Here it comes:


Red bugs are enemies, they avoid the player and stay away from the safe-space (green square), the green bugs are friendly and follow the player. They will flee from red bugs and gather in the safe-space if possible.


Collecting glowworms and bringing them home. They are easy to collect and follow the player without distraction.


In this example the red bugs don't react on the player but chase green bugs.
A red bug accidentally entered the safe-space, it is obviously an undesired behavior, because now the green bugs want to gather in the safe-space and avoid the red bug in the same time.

There are some things not working as I want but that is always the case if you're working on games, we need to see where the game wants to go and help it along that way.
I need to adopt and tweak the bug's AI a bit, but I see they have enormous potential. Here is my ToDo list of the bugs:

  • (Give the bugs a pulsating glow effect.) Minor priority
  • Give bugs a health system and  an attack ability
  • Limit the amount of bugs a safe-space can hold
  • (Prepare safe-space in a way it can trigger the bugs to exit the safe-space) Minor priority
  • Made the light-circle depend on how much bugs the player is carrying Not working with the current shader setup
  • Make the safe-spaces in a way they could as well have light-circle depending on how much bugs the container is holding. They would be like some light or lamp hanging around and the player can light the map in some areas with the worms Not working with the current shader setup
  • (Limit the amount of bugs the player can carry around) Not sure about this idea anymore
  • Make the red bugs smarter
It seems like much on the list, but everything concerning the safe-space and the player will be redundant and so I can create an own class for this, e.g. a class called BugContainer and then create different types of containers. A bit as I did with the bugs themself.

I am super excited about these visions, they don't seem impossible to implement and it will give the game finally some game-play and dimension. It is now that I realize my shader-creating was on the wrong spot. It would be better to have done this in the end, when I polish the game. For a prototype it is not so much necessary but I am glad as well I did, to know in which context I am moving regarding shaders. For now I am going on with the glowworms and the points I have on my ToDo.
Till then, see ya

Leave a comment

Log in with itch.io to leave a comment.