Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Incremental Raycaster Idea
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
mirhagk




PostPosted: Wed Sep 15, 2010 7:37 pm   Post subject: Incremental Raycaster Idea

Tell me what you think of this idea.

Instead of the traditional left to right column by column raycaster I came up with an idea for a faster raycaster (not really needed with a "2D" raycaster, but could possibly help the idea of a true 3D raycaster).

The basic idea is instead of casting 640 rays across the screen (or whatever the resolution is), you could simply cast 10 rays spread out across the screen. Then check if rays that are beside each other intersect the same wall, if so then just draw the wall between them. If they aren't intersecting the same wall then just cast 8 more rays between them ( and 8 more between them, which would match the 640 resolution). Best case scenario is 10 rays cast instead of 640 rays. Worst case scenario is 730 rays cast, which is only slightly more. The chances of none of the 10 rays hitting the same wall is small, the chances of none of the 80 rays hitting the same wall is nearly impossible as long as the map isn't super wide open. (seeing 80 walls at once means you`d need about a 40 by 40 room, I think).

With the kind of game I`m making (a maze game where many of the areas are simply 1 wide hallways), the program could take advantage of this algorithmn very well, since many times you would see 10 or less walls.

Anyways, I believe it will work, But before I work too hard on it, I want your guys opinion (btw my game can currently cast about 3500 rays so that means about 60 rays in each direction, so I`d really need this for it to run).

Will it work? Is it a good idea? Is there any improvements/changes you could suggest?
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: