Dmap and stealth/invis/etc?

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Dmap and stealth/invis/etc?

#1 Post by yufra »

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:

Code: Select all

newAI("flee_simple", function(self)
	if self.ai_target.actor then
		local tx, ty = self:aiSeeTargetPos(self.ai_target.actor)
		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
			end
		end
		return self:moveDirection(util.coordAddDir(tx, ty, dir))
	end
end)
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

Post Reply