Week 2 – Single Agent Setup

So this week, I worked further on my scene and setup a base hunger stat for the agents which depletes overtime and once the agent gets “hungry” – it goes to the food store to increase it’s stat back up.

The updated agent behavior looks like this:

 

Week2AiBlog

As you can see, my second agent forgot how to navigate and I am going to be investigating this issue further. But, what i did get is that one of my agent goes to the food store (green box), to get his hunger stat up and then resumes his patrolling action.

I learnt a very handy way to create a health bar in 3 lines of code.

I was digging through some 2d sprite settings and I came across the “filled” image type where you can adjust the fill of the 2d sprite. This can be a vertical/horizontal/radial fill and it made my experience making a health bar really easy. I dynamically adjusted it’s fill value to communicate the agent’s health at all times.

Week2AiBlog_HealthBar

Week2AiBlog_HealthBarScript.gif

 

Overall, this was good progress for week 2. Building from the ground up, i knew it was critical to get single agent behavior working so that I could enhance this for the group further.

 

Next steps:

  • Fix agent #2
  • Make a group controller
    • Figure out a way to make sure that the agent goes back to the group after finishing the action.
    • Develop a group “ID” manager

Stay tuned for Week 3 folks!

%d bloggers like this: