top of page

Update 0.15.0 - Devlog 10 - Smart AI v2

Quietly push this through. Since almsot done. Happy 2026 Everyone! Hope 2026 is good so far for everyone~


Finally push this update post. Keep delaying and cause me to rewrite this post a couple of times.


I had some times this holiday to work on the game a little bit more.

Wish the holiday is longer. I got a feeling this year will be very busy, but will push on one step at a time. (Slow and steady win the race?)


While doesn't look like much and no new stuff on this update. (being spending awful long on re-doing existing logic). It is a very crucial update for the next bit of good stuffs~

Major Change:


  • Major Refactoring of AI Behavior codes.

TLdr: Previous AI was hard to debug and very linear. New AI system now allow more dynamic decision making by utilising both point based system and behavior tree.





--------------------------------------------

Little bit of a story and tech talk here:

What started this was when doing more testing on the hunter npc logics. I found bugs of npc sometimes getting stuck (Very common bug.) And with what I have at the time, there isn't much visibility on what the npc is doing. With AI system there is a couple comon ways to do AI behavior.


  1. Code States - This is where I have different variables to track states and with codes that check corresponding state and execute specific actions. All via programming codes. (also probably the easiest to intergrate with the save system.)

  2. Behavior Tree - I was using Unity behavior tree as a sub nodes to piece logics together.

  3. Point Based Desicion - Allocate different points for decisions and using it to weight the next action.

  4. GOAP (Goal Orientated Action Planning) - Not implemented yet, but should be very useful in the future. As GOAP approach determine NPC behavior in a reverse order.


What I was using is a hybrid model of using AI Behavior Tree and code states. However with the code States, while it's quicker to implement, it doesn't provide eough visibility and make tracking and debuging harder. I needed this however as I need a way to swap out different logics for different npc behaviors and situation.


I know sooner or later I will need some refactor and changes. And it looks like at the moment it hit the time for this refactor, otherwise as the game expand more, its going to make it harder and longer to refactor.


Current plan:

Currently, I end up doing a couple of changes.

  1. Rewrite and convert the existing NPC logics (Hunter, Villagers, Herbalist, Shopkeeper) into a Third Party Behavior Tree System. (One reason for this change was so that I can take advantage of it's tactical formation system which should be very cool in the future update.) (Behavior Tree System will be for logical actions such as go to a specific point -> look for enemy -> engage in combat -> etc)

  2. Add in a new point based intelligence system which allow switching logics. Replacing the existing code states. (Not only this provide more Visibilities but also allow npcs to make more smart decisions dynamically.) (This is for changing states between NPC behavior such as deciding when to go to work vs go to tarven to eat vs go on an assassination mission or looting).


Future Plan

There will be mostly like be another upgrade in the future to implement a GOAP system ontop on existing intelligence system for NPC Memory/goal behavior. (For example, npc might have a goal such as become a guard captain, and a set of logics span over serval days or months for the npc to progress towatd that state/goal.)

-----------------------------------------------------------------


Change Log:

  1. Major AI Behavior intelligenc Refactor.

  2. Fix new game loading bug.

  3. Other many bugs during the conversion process

bottom of page