Hey, all. I thought that I would share this new game with you. Because this forum messes up my code, Ill just give you a link to the thread on my forum with thr code. Feedback would be appreciated. I used some of the tutorials on my site to help me with this.
http://geekbasic.webs.com/apps/forums/t ... -raycaster
Its nothing more than a multi-level maze game, but I want to make a RPG or shooter out of this eventually...
Raycasting game...
-
- Coder
- Posts: 45
- Joined: Sun Nov 26, 2006 2:00 pm
- Location: Champaign, Illinois
Outstanding!
This thread is probably dead, but i couldn't resist posting here!
Great job. Very minimal code. i remember my first raycaster... it was big and bulky. All kinds of subroutines everywhere and huge chunks of garbage code.
i noticed it fishbowls though. (When you look at a flat wall straight on it looks like the sides bend backward.) That's pretty common with raycasters. It happens because you project onto a flat plane (screen) whereas in the real world you project onto a spherical plane (the back of your eye.)
It's a pretty simple fix. If i remember right, you just take the distance the ray travels to the wall and multiply it by the cosine of the difference of the angles of the ray itself and the direction the player is facing. That probably didn't come out right... Basically: distance * cos(playerangle - rayangle)
Since the angle (playerangle - rayangle) is always the same for each column, you can precalculate the cosines and put them into an array for faster drawing.
Happy casting!
Great job. Very minimal code. i remember my first raycaster... it was big and bulky. All kinds of subroutines everywhere and huge chunks of garbage code.
i noticed it fishbowls though. (When you look at a flat wall straight on it looks like the sides bend backward.) That's pretty common with raycasters. It happens because you project onto a flat plane (screen) whereas in the real world you project onto a spherical plane (the back of your eye.)
It's a pretty simple fix. If i remember right, you just take the distance the ray travels to the wall and multiply it by the cosine of the difference of the angles of the ray itself and the direction the player is facing. That probably didn't come out right... Basically: distance * cos(playerangle - rayangle)
Since the angle (playerangle - rayangle) is always the same for each column, you can precalculate the cosines and put them into an array for faster drawing.
Happy casting!
sid6.7 wrote:everytime i see your avatar i want to scream and kill it....
- msdos622wasfun
- Coder
- Posts: 24
- Joined: Sun Jun 20, 2010 11:19 pm
- Location: Michigan, USA
- Contact:
Hey, that's neat! Simple but effective. Actually I'm glad that I found my way out ... for a minute I thought I was going to be stuck in there a while.
Check out my Freeware at <a href="http://erichkohl.blogspot.com/p/my-software.html">My Software Page!</a>
nice, I like raycasters,that stuff is pretty cool.
guild wars 2 gold
guild wars 2 gold