So after working on this for a while, I've come up with a solution (possibly). Libtcod has a built in line-drawing function. So I was thinking during the AI loop, draw a line from the creature to each object in the dungeon. If there are no obstructions then that creature can see that item. Here's what I have so far, but when I run it, the game freezes. I'm not sure if the loop is infinite maybe, or if it's just THAT much overhead?! Sorry, I'm still very new to Python.
def CanSee(self, o):
#Returns true if this fighter can see the object
monster = self.owner
if o.fighter:
Object = o.owner
else:
Object = o
libtcod.line_init(monster.x, monster.y, Object.x, Object.y)
x,y=libtcod.line_step()
while (not x is None ):
for object in objects:
if map[x][y].blocked == False:
if object.x == x and object.y == y:
return True
x,y=libtcod.line_step()
return False