Real Software Forums
http://forums.realsoftware.com/

Ray Casting II
http://forums.realsoftware.com/viewtopic.php?f=4&t=35904
Page 1 of 1

Author:  mauitom [ Sun Oct 17, 2010 7:32 pm ]
Post subject:  Ray Casting II

Fellow Rb programmer, R.David Sisemore, sent me his revised version of my Ray Casting port project. He fixed the player/viewer map placement on the mini map, applied some of his own OOP principles and added some graphics changes. It’s a very nice update. Thank you very much! Scroll to the bottom of the post to grab this project.

http://bigdaddysurf.com/blog/?p=4

Image

Author:  DaveS [ Tue Dec 25, 2012 12:09 am ]
Post subject:  Re: Ray Casting II

I didn't realize this thread was 3 years old! But I was bored and dug up this code again......
And improved upon it some more....

It now works with Cocoa (although there is an annoying BEEP everytime a key is pressed ...that doesn't happen in Carbon)

I can get upwards to 40FPS depending on the complexity of the view..... AND... I have got texturing to work.

I am going to make a demo from what I have, using textures borrowed from Wolfenstein 3D.

Note : this is RAYCAST .... NOT OpenGL.

If anyone is interested I will post more after the Holidays

Author:  mauitom [ Tue Dec 25, 2012 2:39 pm ]
Post subject:  Re: Ray Casting II

Cool, thanks Dave. Please post the project when you get a chance. Merry Christmas.

Author:  DaveS [ Fri Dec 28, 2012 7:48 pm ]
Post subject:  Re: Ray Casting II

Now with Sprites and Textures

Image

The more detail the slower it processes.... but even at 960x720 I can get up to 8FPS in CARBON (cocoa is 1/2 that speed)

Author:  mauitom [ Fri Dec 28, 2012 10:38 pm ]
Post subject:  Re: Ray Casting II

Wow, that looks great Dave.

This is one link for those interested in what this is all about, the link in my notes section in the project is broken, but this looks like the same page.
http://lodev.org/cgtutor/raycasting.html

And for what it's worth, you actually could hook this up to an OpenGL renderer if you wanted to, my guess would be it would be a lot of work. Ray Casting is just giving you a fake 3D world, deciding what the pixel color location should be, which is currently passed to the Rb graphics object. You could set up an ortho projection and give OpenGL the same pixel color that is used now, i.e. replacing g.drawline ..... You could also pass the color and location directly to Quartz, CoreGraphics. Or any other renderer for that matter.

Spinning this off to a thread might speed things up a bit too. And refactoring to coincide with the suggestions for drawing with Cocoa would probably help too. Cocoa aside, this runs on Windows and Linux too, right?

Author:  DaveS [ Sat Dec 29, 2012 12:26 am ]
Post subject:  Re: Ray Casting II

I can't see any reason this won't run on any platform.

I will package up the code and post a link this weekend..... And if anyone can find any more optimizations, PLEASE let me know. :)

Currently this is 100% RealStudio code. No plugins, No declares, No OpenGL.

So there are literally thousands upon thousands of calculations for each frame. (FYI... I converted the previous code to use RGBSurface, and found it to be FASTER than DRAWLINE, and the previous code violated the "Don't Draw outside the PAINT event" for Cocoa... so that too was changed) [As far as I know it meets all the Cocoa criteria.... it is just slower]

and yes... the link you provided IS EXACTLY where I got the rest of the information from.... Although I did find a few errors in his math that caused sprites to warp when then were near the edge of the screen.

Author:  DaveS [ Sat Dec 29, 2012 2:55 pm ]
Post subject:  Re: Ray Casting III - Textures and Floors

Here is the project code so far.

If anyone can figure out how to get the navigation to go STRAIGHT.. I'd appreciate it.......
When you walk forward.. it moves to the right location.... but on the screen it looks like you are moving at a angle... I need it to move so the "crosshair" remains centered on what ever object it is on when you start to move.

http://ftp.rdsisemore.com/raycaster.zip


edit : fixed link

Author:  simulanics [ Sat Dec 29, 2012 4:40 pm ]
Post subject:  Re: Ray Casting III - Textures and Floors

DaveS wrote:
Here is the project code so far.

If anyone can figure out how to get the navigation to go STRAIGHT.. I'd appreciate it.......
When you walk forward.. it moves to the right location.... but on the screen it looks like you are moving at a angle... I need it to move so the "crosshair" remains centered on what ever object it is on when you start to move.

http://www.rdsisemore.com/raycaster.zip


The link is broke :-(...didn't get to respond to the email but great work so far btw :-)

Author:  HMARROQUINC [ Sat Dec 29, 2012 5:50 pm ]
Post subject:  Re: Ray Casting II

Even though I've been around compuers for around 30 years both as a kid and then as a developer 3D graphics have always been over my head and I'm always impressed with work like this. Nice!

Author:  simulanics [ Sat Dec 29, 2012 5:58 pm ]
Post subject:  Re: Ray Casting II

HMARROQUINC wrote:
Even though I've been around compuers for around 30 years both as a kid and then as a developer 3D graphics have always been over my head and I'm always impressed with work like this. Nice!


Off thread topic but:
This uses the OpenGL ...great place to start learning :-)
http://www.real3dtutorials.com/

Author:  DaveS [ Sat Dec 29, 2012 6:00 pm ]
Post subject:  Re: Ray Casting II

Link Fixed

http://ftp.rdsisemore.com/raycaster.zip

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/