Raycaster

Anything related in any way to game development as a whole is welcome here. Tell us about your game, grace us with your project, show us your new YouTube video, etc.

Moderator: PC Supremacists

Post Reply
User avatar
wtetzner
Chaos Rift Regular
Chaos Rift Regular
Posts: 159
Joined: Wed Feb 18, 2009 6:43 pm
Current Project: waterbear, GBA game + editor
Favorite Gaming Platforms: Game Boy Advance
Programming Language of Choice: OCaml
Location: TX
Contact:

Raycaster

Post by wtetzner »

So I wrote a raycaster a while back (in April I think) and rediscovered it while digging through my unfinished projects.
I intend to turn it into an actual game at some point, but for now all you can do is walk around.

It's written in C++, and uses SDL for drawing and input.
The main thing still missing from the rendering engine is the ability to draw sprites.

Anyway, I thought I'd make a YouTube video of the raycaster in action and show it off.

So, here it is:

http://www.youtube.com/watch?v=LYci8S1Mdsc

Oh, and since the video isn't the best quality, here's a screenshot:
Image
The novice realizes that the difference between code and data is trivial. The expert realizes that all code is data. And the true master realizes that all data is code.
jaymonster138
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 10
Joined: Wed Nov 25, 2009 10:05 pm

Re: Raycaster

Post by jaymonster138 »

thats really tight. What exactly is a "Raycaster"?
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Raycaster

Post by dandymcgee »

jaymonster138 wrote: What exactly is a "Raycaster"?
You stole the words out of my mouth.

Edit: I think he was demonstrating hidden surface removal, but since the surfaces were hidden to begin with you see no visual differences, only performance gain.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
andrew
Chaos Rift Regular
Chaos Rift Regular
Posts: 121
Joined: Mon Dec 08, 2008 2:12 pm

Re: Raycaster

Post by andrew »

jaymonster138 wrote:What exactly is a "Raycaster"?
Ray Casting

Games that used it: Doom, Wolfenstein 3D, lots of others too.

Example of a very small ray caster in C with Allegro.
jaymonster138
Chaos Rift Newbie
Chaos Rift Newbie
Posts: 10
Joined: Wed Nov 25, 2009 10:05 pm

Re: Raycaster

Post by jaymonster138 »

So does the program recognize which way you are looking and decides to build where your looking? or am I way off? Whats the point of tracing the rays?
andrew
Chaos Rift Regular
Chaos Rift Regular
Posts: 121
Joined: Mon Dec 08, 2008 2:12 pm

Re: Raycaster

Post by andrew »

Here you go:
'Doom' 3D Engine techniques. This explains it briefly.

This one is mentioned in the other link as having a much more detailed explanation of raycasters.
acksrc.zip
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Raycaster

Post by Falco Girgis »

Note that he's using SDL for drawing. That's pretty damn badass. Very impressive, sir.
User avatar
dandymcgee
ES Beta Backer
ES Beta Backer
Posts: 4709
Joined: Tue Apr 29, 2008 3:24 pm
Current Project: https://github.com/dbechrd/RicoTech
Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
Programming Language of Choice: C
Location: San Francisco
Contact:

Re: Raycaster

Post by dandymcgee »

GyroVorbis wrote:Note that he's using SDL for drawing. That's pretty damn badass. Very impressive, sir.
Wtf.. how? Looks like OGL.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Raycaster

Post by XianForce »

So basically it takes a 2D map, and like... makes it appear 3D?
andrew
Chaos Rift Regular
Chaos Rift Regular
Posts: 121
Joined: Mon Dec 08, 2008 2:12 pm

Re: Raycaster

Post by andrew »

XianForce wrote:So basically it takes a 2D map, and like... makes it appear 3D?
Exactly.
Just like this.
User avatar
RyanPridgeon
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 447
Joined: Sun Sep 21, 2008 1:34 pm
Current Project: "Triangle"
Favorite Gaming Platforms: PC
Programming Language of Choice: C/C++
Location: UK
Contact:

Re: Raycaster

Post by RyanPridgeon »

Maybe you guys should stop commenting like this if you don't know what it is. He's not using OpenGL or any pre-set 3d calculation, he's made a raycaster which draws the screen by the pixels, using "rays" to work out the size and texture splicing of the walls that the player can see. There's a good tutorial on it on Gamedev.net.

And yeah this is awesome, you should totally go for a full-on Doom style FPS game with this.
Ryan Pridgeon
C, C++, C#, Java, ActionScript 3, HaXe, PHP, VB.Net, Pascal
Music | Blog
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Raycaster

Post by Falco Girgis »

Gentlemen, don't you remember playing Doom 95 and Wolfenstein 3D on Windows 3.1 and Windows 95 before dedicated 3D cards were even invented?

Ever wondered how in the fuck Doom was ported to the Super Nintendo? Wonder no more.
Post Reply