robotis / rlfl

Python RogueLike Function Library
http://packages.python.org/rlfl/index.html
GNU General Public License v3.0
26 stars 5 forks source link

Walls are not marked as CELL_SEEN #2

Closed sirvaulterscoff closed 12 years ago

sirvaulterscoff commented 12 years ago

Hello, I create fov map and fill it parameters as follow

 fov_map = rlfl.create_map(self.current.width, self.current.height)
 #iterate over x, y and get tile
 if tile.block_los:
     rlfl.set_flag(fov_map, (x, y), CELL_WALK)
 if tile.is_wall:
 rlfl.set_flag(fov_map, (x, y), rlfl.CELL_PERM) #actualy i tried setting CELL_NONE or even not setting anything here
 #next i compute fov
 rlfl.fov(fov_map, (x, y), fov_range, rlfl.FOV_PERMISSIVE, True) #tried all available FOV algorithms as well

#in my render code
visible = rlfl.has_flag(fov_map, (x, y), rlfl.CELL_SEEN) 

When i check CELL_SEEN flag on the wall i always get False.

robotis commented 12 years ago

Use CELL_OPEN for open cells, CELL_WALK blocks LOS

Maps start with all cells blocking LOS so you only need to mark those that are open. Remember to mark the origin open as well.

Hope that helps

sirvaulterscoff commented 12 years ago

Thanks for reply. It seems that i omited most important part, where i set CELL_OPEN for floor tiles etc. I will provide test case as soon as i have access to PC

sirvaulterscoff commented 12 years ago

Oh, excuse me. Seems to be the problem in my rendering code. Test case turned out to work perfectly. Many thanks for creating such a great library! PS is there a way to create non-passable los-non-blocking (i.e. window) tile?

sirvaulterscoff commented 12 years ago

Actualy this seems to be an issue with rlfl.fov mapping. Documentation states that it has 5 params, but accordint to source code in has 6 params. So if i call rlfl.fov(map, xy, radius, algo, True) - light walls will somehow reset to False. if i call it like rlfl.fov(map, xy, radius, algo) or rlfl.fov(map, xy, radius, algo, True, True) - everything seems to be fine.

robotis commented 12 years ago

Hello

Thanks, Ill look into the light walls strangeness.

About windows I usually use:

(CELL_OPEN | CELL_WALK) on floor: walkable and non blocking CELL_OPEN on wall: Window or glass wall CELL_WALK on wall: Illusion wall CELL_WALK on monster: (like dragon) Monster blocks LOS

sirvaulterscoff commented 12 years ago

Many thanks for all your help!