Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Apr 24, 2017 5:57 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Ray Casting II
PostPosted: Sun Oct 17, 2010 7:32 pm 
Offline
User avatar

Joined: Thu Feb 16, 2006 10:04 pm
Posts: 262
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


Top
 Profile  
 
 Post subject: Re: Ray Casting II
PostPosted: Tue Dec 25, 2012 12:09 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
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

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
 
 Post subject: Re: Ray Casting II
PostPosted: Tue Dec 25, 2012 2:39 pm 
Offline
User avatar

Joined: Thu Feb 16, 2006 10:04 pm
Posts: 262
Cool, thanks Dave. Please post the project when you get a chance. Merry Christmas.


Top
 Profile  
 
 Post subject: Re: Ray Casting II
PostPosted: Fri Dec 28, 2012 7:48 pm 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
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)

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
 
 Post subject: Re: Ray Casting II
PostPosted: Fri Dec 28, 2012 10:38 pm 
Offline
User avatar

Joined: Thu Feb 16, 2006 10:04 pm
Posts: 262
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?


Top
 Profile  
 
 Post subject: Re: Ray Casting II
PostPosted: Sat Dec 29, 2012 12:26 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
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.

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
 
 Post subject: Re: Ray Casting III - Textures and Floors
PostPosted: Sat Dec 29, 2012 2:55 pm 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
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

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Last edited by DaveS on Sat Dec 29, 2012 6:04 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Ray Casting III - Textures and Floors
PostPosted: Sat Dec 29, 2012 4:40 pm 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
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 :-)

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
 
 Post subject: Re: Ray Casting II
PostPosted: Sat Dec 29, 2012 5:50 pm 
Offline
User avatar

Joined: Sun Jan 25, 2009 5:11 pm
Posts: 576
Location: Guatemala, Central America
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!

_________________
Future RS guru.
Ride the world!


Top
 Profile  
 
 Post subject: Re: Ray Casting II
PostPosted: Sat Dec 29, 2012 5:58 pm 
Offline
User avatar

Joined: Sun Aug 12, 2007 10:10 am
Posts: 1086
Location: Boiling Springs, SC
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/

_________________
Matthew A. Combatti
Real Studio 2012 r1.2

Visit Xojo Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS

~All Xojo Compatible~


Top
 Profile  
 
 Post subject: Re: Ray Casting II
PostPosted: Sat Dec 29, 2012 6:00 pm 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
Link Fixed

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

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group