Page 7 of 7

Posted: Fri 10 Mar, 2006 9:02 pm
by coelurus
The "Permadi-way" will visit every grid if you combine the traversal of both horiz/vert rays. Since you jump 1 step in X and 1 step in Y independently, you will not miss any grid cells.

And yes, I used a flag matrix created in the raycaster to quickly figure out the conservative visibility of an object (simply check visited[obj.y][obj.x]).

I'm not sure how one would go about "storing objects as rays pass by", because that would require you to quickly figure out what objects are close to a ray for each step. These kind of problems have a number of solutions (with additional "derivatives" of course):

1) Test each object at each ray step (ugh!).
2) Flag for visited cells and then test all objects at once.
3) Store objects in dynamic arrays in a matrix (maybe even only allowing 1 object/grid cell).

The 3rd alternative gives a couple of nice features, such as controlling the number of objects in grid cells for collision detection.

Posted: Fri 10 Mar, 2006 10:35 pm
by Timendus
Yes, I was thinking about the third thing. I'm not up for this yet though :) I've been playing and testing with raycasting in Java this afternoon. I got the scaling and stuff working, but my routine to cast rays isn't done yet :P It's really interesting stuff, but it's gonna take a while before I'm confident enough with this to give it a try in assembly :)

Posted: Thu 20 Jul, 2006 12:53 pm
by benryves
This thread went on a bit of a tangent to what I was doing specifically with my engine, so have split the thread.

See: "Nostromo"