Help needed with basic pathing
Anonymous
Archived from groups: rec.games.roguelike.development (More info?)
need help... code is ok, or just math and pseudo code (even better)
I need a way to figure out exactly which squares (on a grid based map)
are crossed by a missle type object. It's easy to eyeball, but I can't
seem to wrap my head around the math to reliably draw a line from
(x1,y1) to (x2,y2).
I can handle straight lines and true diagonal lines no problem, but in a
case where the "line" goes "staggered"... I just cant see it. Not enough
sleep or caffeine probably.
................
................
...@xx..........
......xx........
........xx......
..........K.....
................
Any help is appreciated.
Those of you that play ADOM, that's the basic look I'm going for... when
you target a monster and it draws a line from you (x1,y1) to it (x2,y2).
Just need help with the math/algorithm, once i have that I can write the
code.
Thanks,
S.
need help... code is ok, or just math and pseudo code (even better)
I need a way to figure out exactly which squares (on a grid based map)
are crossed by a missle type object. It's easy to eyeball, but I can't
seem to wrap my head around the math to reliably draw a line from
(x1,y1) to (x2,y2).
I can handle straight lines and true diagonal lines no problem, but in a
case where the "line" goes "staggered"... I just cant see it. Not enough
sleep or caffeine probably.
................
................
...@xx..........
......xx........
........xx......
..........K.....
................
Any help is appreciated.
Those of you that play ADOM, that's the basic look I'm going for... when
you target a monster and it draws a line from you (x1,y1) to it (x2,y2).
Just need help with the math/algorithm, once i have that I can write the
code.
Thanks,
S.
3
answers
Last reply
More about help needed basic pathing

Archived from groups: rec.games.roguelike.development (More info?)
> Just need help with the math/algorithm, once i have that I can write the
> code.
What you need is Bresenham's Line Algorithm:
http://www.gamedev.net/reference/articles/article767.asp
Google for more info.
Aaron 
Archived from groups: rec.games.roguelike.development (More info?)
airolson wrote:
>> Just need help with the math/algorithm, once i have that I can write
>> the code.
>
>
> What you need is Bresenham's Line Algorithm:
>
> http://www.gamedev.net/reference/articles/article767.asp
>
> Google for more info.
>
> Aaron
Yes!! That looks perfect!
Thanks,
S. 
Archived from groups: rec.games.roguelike.development (More info?)
At Sat, 16 Jul 2005 15:32:57 0400,
Heroic Adventure wrote:
> need help... code is ok, or just math and pseudo code (even better)
http://roguebasin.tome.net/index.php/Breshenham%27s_Line_Algorithm

Radomir `The Sheep' Dopieralski @**@_
(`') 3 Grrr!
. . . ..v.vVvVVvVvv.v.. .
Ask a new question
Read More
Development
Video Games
Related Resources
 A greenhorn's plee for help
 Need help finding a RNG method
 LIne of Sight/Illumination Algorithms
 My powerbudget kinda gaming mainly development station
 Roguelike compo!
 Wilderness generation using Voronoi diagrams
 [help] java roguelike development insight needed
 Hi, I'm new here, would like to try my hand at a roguelike..
 How NOT to code
 Scumming Woes
 A New Roguelike needs your ideas...
 The Western Roguelike
 Roguelike AIs
 Fighting Styles
 Scripted approach to dungeon generation
 Spring and rubber room positioning
 [CCI] Roguelike Engines  why do they fail?
 How to write a roguelike game? :)
 Not this again...
 ZMachine in Basic?