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.
[General Algorithme] 3D engines
Moderator: MaxCoderz Staff
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 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
http://clap.timendus.com/ - The Calculator Link Alternative Protocol
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
http://api.timendus.com/ - Make your life easier, leave the coding to the API
http://vera.timendus.com/ - The calc lover's OS
- benryves
- Maxcoderz Staff
- Posts: 3089
- Joined: Thu 16 Dec, 2004 10:06 pm
- Location: Croydon, England
- Contact:
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"
See: "Nostromo"