Raycasting help
Posted: Tue Feb 24, 2009 6:08 pm
Hey guys! First post and glad to be here.
Love2D is awesome, but I have some questions. I've written a simple raycasting engine in Love, and now I'm working on adding textured walls. In order to texture the walls I have to compare the image for the wall and the pixels in the wall itself, figure out what goes where, and draw the appropriate color pixel to the screen. This means I'm using love.graphics.point(x,Y) about a bazillion times per loop, which is hella slow!
I've had a few ideas about how to speed this up, but don't know how to implement them:
One would be to create an array of [screenSizeX][screenSizeY] and assign the color values to each data point as I go through the calculations, then draw everything at once...but still means using point() the same number of times, and might not be any faster.
Another idea was similar to the above. Is it possible to create an image from raw data rather than loading it from a file and display it that way?
Or perhaps tap into the routines that Love itself uses to draw images?
I'm really psyched up about this project, but I'm stumbling pretty hard. If these ideas would work, or there is a much faster alternative i'm not thinking about please let me know!
As things progress I'll post screenshots etc and eventually the engine itself.
Thanks!
Love2D is awesome, but I have some questions. I've written a simple raycasting engine in Love, and now I'm working on adding textured walls. In order to texture the walls I have to compare the image for the wall and the pixels in the wall itself, figure out what goes where, and draw the appropriate color pixel to the screen. This means I'm using love.graphics.point(x,Y) about a bazillion times per loop, which is hella slow!
I've had a few ideas about how to speed this up, but don't know how to implement them:
One would be to create an array of [screenSizeX][screenSizeY] and assign the color values to each data point as I go through the calculations, then draw everything at once...but still means using point() the same number of times, and might not be any faster.
Another idea was similar to the above. Is it possible to create an image from raw data rather than loading it from a file and display it that way?
Or perhaps tap into the routines that Love itself uses to draw images?
I'm really psyched up about this project, but I'm stumbling pretty hard. If these ideas would work, or there is a much faster alternative i'm not thinking about please let me know!
As things progress I'll post screenshots etc and eventually the engine itself.
Thanks!