Raycasting game...

Discuss whatever you want here--both QB and non-QB related. Anything from the DEF INT command to the meaning of life!

Moderators: Pete, Mods

Post Reply
User avatar
bongomeno
Veteran
Posts: 231
Joined: Wed Dec 10, 2008 9:08 am
Location: San Bernardino CA
Contact:

Raycasting game...

Post by bongomeno » Wed Apr 28, 2010 12:01 am

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...
Home: http://www.geekbasic.com" target="_blank
Forum: http://www.geekbasic.com/index.gbws?$page=forumsmain" target="_blank
QB64 powered web server: http://www.geekbasic.com/index.gbws?$pa ... inter=%201" target="_blank

izidor
Veteran
Posts: 110
Joined: Wed Apr 22, 2009 3:13 am
Contact:

Post by izidor » Wed Apr 28, 2010 8:18 am

It's great!

User avatar
bongomeno
Veteran
Posts: 231
Joined: Wed Dec 10, 2008 9:08 am
Location: San Bernardino CA
Contact:

Post by bongomeno » Wed Apr 28, 2010 8:51 am

thanks! :D
Home: http://www.geekbasic.com" target="_blank
Forum: http://www.geekbasic.com/index.gbws?$page=forumsmain" target="_blank
QB64 powered web server: http://www.geekbasic.com/index.gbws?$pa ... inter=%201" target="_blank

User avatar
sid6.7
Veteran
Posts: 318
Joined: Tue Jun 21, 2005 8:51 am
Location: west USA
Contact:

Post by sid6.7 » Fri Apr 30, 2010 3:13 pm

well done....

User avatar
seaBiscuit$
Coder
Posts: 45
Joined: Sun Nov 26, 2006 2:00 pm
Location: Champaign, Illinois

Outstanding!

Post by seaBiscuit$ » Fri Aug 13, 2010 8:14 am

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! :)
sid6.7 wrote:everytime i see your avatar i want to scream and kill it.... :)

User avatar
msdos622wasfun
Coder
Posts: 24
Joined: Sun Jun 20, 2010 11:19 pm
Location: Michigan, USA
Contact:

Post by msdos622wasfun » Mon Jun 06, 2011 7:41 pm

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>

jash08
Newbie
Posts: 1
Joined: Thu Aug 09, 2012 12:26 am

Post by jash08 » Thu Aug 09, 2012 1:25 am

nice, I like raycasters,that stuff is pretty cool. :)
guild wars 2 gold

Post Reply