Hi all
I’m really struggling to understand behavior trees, they just seem to fire off everything, all the time, which is ok if you’re doing AI for an FPS, but I’m doing a strategy/civ-style game. I know there’s a way to do this properly, but information/documentation seems pretty sparse, especially if you’re not doing an FPS-style game.
I had this all working nicely in a Blueprint, but then I discovered the behavior trees, and thought it would be better to do AI stuff in here. So far, I have 2 nights work on these things and nothing to show for it
I really don’t know if this is even the correct way to do it, but what I’m going for is:
- During the day, if the city needs food, AssignHunters
- During the day, if the city needs shelter, BuildHouses
- When it becomes evening, check how much food we have. If we have an excess, increase population. If there’s a deficit, decrease population.
As it stands, NeedFood is false, so then it hits NeedShelter, and it just repeats it all day. I think this is because it doesn’t factor houses under construction into the equation, so I’m busy fixing that.
The big thing is, though, that once it becomes evening, AdjustPopulation just fires off the entire night, so population spikes as all the food is eaten, then everyone starves.
Is there some way to just fire AdjustPopulation once when the enum changes to evening?
Also, how can I check NeedFood and NeedShelter less often? It really doesn’t need to check food levels every tick!
Any help will be greatly appreciated!