NEW BLOG POST

You weren't doing anything on a Friday afternoon were you?

Here's 4 thousand words about the new and improved Chronicles behavior planning and how I leveraged reinforcement learning techniques used by Chess and Go algorithms to make my baddies smart and efficient. Enjoy!

https://blog.brianna.town/the-bigger-better-chronicles-npc-behavior-system

#gamedev #indiedev #blog

The Bigger Better Chronicles NPC Behavior System

I wrote about Chronicles` action system ~sigh~ over three years ago and over the intervening horrors of modern existence it has grown int...

The Ebonheim Chronicle

the opening paragraphs of this post have been slightly modified for correctness because the original actions post mentioned predated the first working implementation of behavior planning by several months.

This bothered nobody but me, please enjoy.

@britown This is oddly topical for me: I've been noodling around with behaviour planning/selection stuff in my current project for a couple weeks, so it's interesting to see other approaches to it :)
@britown excellent article, brought me right back to my graduate algorithms days doing decision trees and alpha/beta pruning :)
@britown Do actors in this system also consider the possible actions of others or just their own?
@kampffrosch the simulation begins when it's the actor's turn within the turn so anyone who goes before then has already "gone" which they can react to but it can't know what actors that go after it will do or what the player will do. For the multi turn sim it does still simulate end of turn things like timers ticking down and drowning/hazards

@britown I see, thanks!

Another question:
How do you handle hidden information?
Let's say the player places a trap that should be invisible to the enemy.
Now if the enemy simulates the outcome of moving into the traps tile it'd notice it takes damage and avoid the tile (possible getting stuck in a hallway).
Do you simulate as if the trap wasn't there?

@kampffrosch good question yeah actors have an awareness concept. They don't gain or lose score for things they don't know about. This includes things like walking into a trap, or like they get score for shooting where they think you are even if they don't know exactly where you are. Normally they would lose score for friendly fire but if said friend is obscured they wouldn't know they're hitting them, things like that
@kampffrosch additionally, the function that iterates through the action list to simulate forward is the same for preview as it is when a real turn happens just with a flag so it's trivial to, say, "if executing for preview, and the current actor doesn't know about this trap they're triggering, don't execute it"

@britown thanks, that was a great read - using MCTS to coordinate multiple enemy AIs is quite a novel approach!

A couple of questions. Do you do anything to simulate the player's move after each step? And how do you 'score' moves like 'block the exit'?

@bbbscarter I'm glad it was coherent! NPCs treat the player as doing nothing on their turn which is great when they go first and less reliable if they go after, but the player has the automatic into the breach advantage of seeing everyone's planned turn before deciding what to do.

The simulation does take into account end of turn tick down and recovery for the look ahead though, they'll see the damage of standing in fire or understand that recovering stamina for a turn allows a good ability

@bbbscarter good eye on the escape path line 😊 I'm currently calculating a "degrees of freedom" or escape score for their targets that attempts to give a value for how many options the player has on their turn for getting away. The theory is I can crank the weight of this for certain enemies to do things like blocking chokepoints or pushing you into corners
@britown ah, very nice, makes sense. Thanks for the explanation!
@britown Lovely read! I hope I can leverage a similar system in the never-future when I’m working on AI!