Temple of The Roguelike Forums
Development => Programming => Topic started by: mughinn on December 26, 2012, 02:05:13 AM
-
So I'm adding LOS to a roguelike I'm creating.
I've tried implementing a very basic one that i didn't like (creating a Bresenham's line between the player and every tile in FOV and check if it was clear). This method, although fast, created some things that I didn't like, like having random tiles being highlighted surrounded by the dark.
Now I've done a raycasting one, and, for me, it looks bad. Also, I'm still discussing with myself if it should have asymmetry, and considering the gameplay options it adds.
I'd love some kind of comparison or some algorithm I can use, that is somewhat fast and looks good.
What I don't like about raycasting is something like this:
.........
...@..#
.........
....#.....
..........
where you can see just behind a pillar.
Thanks for any advice you can give.
-
Just some random links- no time for a real reply atm.
http://blog.pixelpracht.net/?p=340
http://roguetemple.com/forums/index.php?topic=2639.0
-
Well thanks, I ended up in the Restrictive Precise Angle Shadowcasting article in Roguebasin, It seems good, I'll try to implement it in my language and come back to say how it went.
-
Well thanks, I ended up in the Restrictive Precise Angle Shadowcasting article in Roguebasin, It seems good, I'll try to implement it in my language and come back to say how it went.
You can find good implementations of many FOV algorithms in the libtcod source.
-
The good thing, the thing works.
The bad thing, the thing doesn't work right.
And thanks XLambda, I ended up there :)
I'd pass my code, but 174 lines of Racket don't seem good for anyone, also, my code usually embarrasses me.
Is there any implementation in Lisp, Haskell or similar?
I'm still trying though, if someone finds an example in a somewhat functional language I'd be incredibly happy, until that happens or I'm happy enough with my beast, until then, wish me luck :P
-
There is a libtcod wrapper for Racket (https://github.com/lewis1711/pltcod (https://github.com/lewis1711/pltcod)). So you can use libtcod FOV algorithms from Racket.
-
Well, I actually wanted to implement it myself and not just use a library.
I think i got it now, It's sitting at 105 lines, and it's purely functional (if I'm not missing anything), there are some things I don't know if they should work that way, for example:
..........
.........@
## ##.
.
or this:
...#
...
...#
...
...##
.....
..@..
Should it work that way? showing extra walls (in a way, as I can guess parts with no walls that way).
-
..........
.........@
## ##.
.
or this:
...#
...
...#
...
...##
.....
..@..
I'd say this is more of how it should look like, assuming those are walls.
...........
..........@
######.
#.
and this:
...#
...#
...#
...#
...##
.....
..@..
-
No, the blank spaces are grass, and if it is that way, I actually like it, It seems at how in reality you would notice the walls, and notice that those spaces aren't walls, an yet you can't see what's in there.
Thanks for the help everyone, if someone wants, i can post the code.