do internets

on internets doing computer

« Back to blog

Pathfinding, potions and feature creep

Well, not really feature creep as much as boredom with pathfinding code!

The full post is here:
http://codesquares.com/post/more_fun_with_pathfinding

Posted July 26, 2011 by Marcin M 
Jul 26, 2011
Andrew C said...

You cross-poster, you!

Jul 26, 2011
Andrew C said...

Really interesting write-up though.  So,  here is my question then: does it not make sense to write mob AI based around objectives. e. g. Mob sees player - moves to attack. Mob sees nothing, sleeps after ___ / never sleeps. Etc..

-Andrew

Jul 26, 2011
Marcin M said...
What *you're* talking about is not really around objectives though, that's kind of around the environment, the near inputs.
 
Objectives would be things like "Seek player", or "Improve weapon" or "Find armor" or "Flee", based on some sort of internal calculations and thresholds. Say if there's a weapon threshold the creature feels good about, it can go seek out enemies. If not, it can try to improve itself. If it's low on HP, it escapes. I am not doing this yet, although I'd like to. I suspect this will take a LOT of time.
 
That would be the pro-active model. Then there's the reactive model like what you're talking about. Creature hears a noise, or sees an enemy or item on the floor, and does something appropriate. I am currently doing this because it's simple - just iterate through the level's items and NPCs, check if anything is nearby, and then go look at whichever one is closest. Tada! 
 
I plan to see how well/poorly it works, then consider the other. I *think* the game can work with just the reactive, but it should be much more interesting with the proactive, and that *is* the ultimate goal.