Chaosforge Forum

  • April 16, 2024, 13:55
  • Welcome, Guest
Please login or register.



Login with username, password and session length
Pages: [1]

Author Topic: Line of Sight and mapping  (Read 3925 times)

MadCoder

  • Guest
Line of Sight and mapping
« on: February 09, 2007, 14:16 »

So I did a google search, and came across some info on RogueLike coding.  I found:

www.roguelikedevelopment.org
roguebasin.roguelikedevelopment.org

Both of which are nice, but I fugure you guys are the ones who would know this.  What sites are good for info on coding RL?  In particular, line of sight code.  This seems to be the biggest issue with coding an RL.  For those who have played Ultima III, IV, or V, that particular style of LOS code was great along with DoomRL.

Any info/links appreciated!
Logged

Anticheese

  • Lieutenant Colonel
  • *
  • Offline Offline
  • Posts: 483
    • View Profile
Re: Line of Sight and mapping
« Reply #1 on: February 09, 2007, 17:38 »

roguebasin has a link to a Roguelike USENET group, you may find the information you need there.

rec.games.roguelike.development
Logged

Santiago Zapata

  • Temple Guardian
  • Backer
  • First Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 236
  • Roguelike Developer
    • View Profile
    • Slashie.net
Re: Line of Sight and mapping
« Reply #2 on: February 09, 2007, 20:07 »

Logged
Slash (Castlevania, Metroid, Drash, ZeldaRL)
Temple of The Roguelike
Slashie.net

MadCoder

  • Guest
Re: Line of Sight and mapping
« Reply #3 on: February 10, 2007, 18:14 »

Thanks for the suggestions.

I am working on my own LOS psuedocode that is entirely comprised of lookup tables to cast shadows.  It doesn't take into account light sources yet, but each light source could also use the table.  The distance for each LOS and light source could be calculated off of the same table, with the distance of each only using what each one is set to at the time (or loop).  My initial idea for a table that would work on a 40 x 40 LOS would be under 8k.  It also uses simple math, with no floating point variables.

I hope it comes out ok.  If any of you know of lookup table source code for LOS, I'd like to see it.  Thanks!
Logged

TFoN

  • Colonel
  • *
  • Offline Offline
  • Posts: 562
  • Gleefully antisocial!
    • View Profile
Re: Line of Sight and mapping
« Reply #4 on: February 11, 2007, 12:01 »

Please post it somewhere when you're done, and let me know.

I'm also interested in LOS code, though my programming experience's near zero.

MadCoder

  • Guest
Re: Line of Sight and mapping
« Reply #5 on: February 11, 2007, 17:13 »

So I think I have this great LOS code idea, then I discover a major flaw in it.  I was going to use a lookup table for each block in a quadrant to map shadows.  Problem is, when two blocks are next to each other they block much more than the original one does.

Damn, back to the drawing board.

I've been reading others LOS code, and there seems to be tons of calculations to make it happen.  How in the world did Ultima III and IV get made with great LOS, nice graphics and less than 64k RAM?  Granted, it was in machine language/assembly back then, but still, memory has to be allocated.

I'm surprised that with all the roguelikes out there, that someone hasn't come up with an object oriented code module just for LOS mapping.  Nothing more, like light sources, or what the map contains (treasure, weapons, monsters, etc).   I've found lots of code examples, but they all seem quite complex and have lots of hacks to make them work.

Has no one come up with a clean code base for LOS mapping?  I hope I can find an effective one, or a roguelike may have to wait...
Logged

Aerton

  • Elder Chaos Guard
  • First Lieutenant
  • *
  • *
  • Offline Offline
  • Posts: 205
    • View Profile
Re: Line of Sight and mapping
« Reply #6 on: February 11, 2007, 18:26 »

I hope it comes out ok.  If any of you know of lookup table source code for LOS, I'd like to see it.  Thanks!

Lookup table FOV is used in Angband. Although code is heavy optimised and thus is very hard to follow. I think the algorithm was posted on rgra or rgrd.


I'm surprised that with all the roguelikes out there, that someone hasn't come up with an object oriented code module just for LOS mapping.  Nothing more, like light sources, or what the map contains (treasure, weapons, monsters, etc).   I've found lots of code examples, but they all seem quite complex and have lots of hacks to make them work.

There is FOV library named libfov I never used it myself though so cannot comment of how fast or easy to use it is.
Logged

Kornel Kisielewicz

  • God Hand
  • Apostle
  • *
  • *
  • Offline Offline
  • Posts: 4562
    • View Profile
    • http://chaosforge.org/
Re: Line of Sight and mapping
« Reply #7 on: February 17, 2007, 11:23 »

Maybe you'd be interested in looking at Berserk! and the Valkyrie library. The advantage of Pascal is that it is readable as long as you can code in ANY language ;]
Logged
at your service,
Kornel Kisielewicz
Pages: [1]