Hello all, first post here (I hope this all displays correctly).
I program a little in Java here and there (made a few very basic games), and recently thought I should start writing my own raycasting engine.
Anyhow, I seem to have a problem rendering my walls properly. My level is square-shaped, with blocks along the edges.
Currently, the size of the walls seems to be a little strange : it is the same ratio no matter what direction one looks in, no matter where one happens to be (walls at the other end of the map seem to be the same size as ones a dozen pixels away).
What's more, some walls are jagged whereas some others are smooth. Lastly, the size of the wall doesn't quite change smoothly with distance.
Source code enclosed is simplified and therefore mostly unoptimised (little bit shifting, nor any precaslculated values) in order to help understanding.
Angles are in degrees (360 >angles >=0).
554 is the distance to the proj plane, for a FOV of 60 degrees. Screen size is 640*400.
In my Render class, I have these methods :
The render method has this piece of code :
Here's the raycasting (which I put in a separate class) :
Finally, here's the level data :
This method returns the block corresponding to the coordinates (usually intersection coordinates)
Here's the level :
That 's the layout. -1 for walls. Width and depth are set to 8.
I hope that wasn't too much of a mouthful, but I've been stuck at this point for the last couple of days, even after rewriting part of the above.
If the full source code needs to be posted, just tell me.
Any help on this would be greatly appreciated.