ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Sat Aug 15, 2020 2:14 am

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Fri Apr 29, 2011 7:39 pm 
Perspiring Physicist

Joined: Tue Jul 13, 2010 2:53 pm
Posts: 1332
I was looking into tiger_eye's bug report about fleeing and stealth (link) and tracked it down to how the dmap features are not obfuscated with the aiSeeTargetPos method. How should this work? Should we assume that anything with dmap has a supernatural sense for the player and leave it as is? In that case we should introduce a flee_simple AI routine that uses aiSeeTargetPos, something like this:

newAI("flee_simple", function(self)
   if then
      local tx, ty = self:aiSeeTargetPos(
      local dir = 5
      local bestdist = 0
      for i = 1, 9 do
         local sx, sy = util.coordAddDir(self.x, self.y, i)
         local sqdist = math.pow(self.x - sx, 2) + math.pow(self.y - sy, 2)
         if self:canMove(sx, sy) and sqdist < bestdist then
            bestdist = sqdist
            dir = i
      return self:moveDirection(util.coordAddDir(tx, ty, dir))

An alternative would be to add some random values to the move/flee_dmap that takes into account the canSee chance. Thoughts?

<DarkGod> lets say it's intended

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group