Page 1 of 1

Raycasting C-Codes

PostPosted: Sun May 18, 2008 3:58 pm
by asmodeus
I found the C-Codes for raycasting in the internet. Maybe that will help trying to make 3D.
Lode's Computer Graphics Tutorial

Re: Raycasting C-Codes

PostPosted: Sun May 18, 2008 5:26 pm
by makslane
Great articles, thanks!

Re: Raycasting C-Codes

PostPosted: Sun May 18, 2008 6:47 pm
by asmodeus
:D

Re: Raycasting C-Codes

PostPosted: Mon May 19, 2008 4:44 pm
by stevenp
this is seriously cool, and easy to understand

good job! +1

Re: Raycasting C-Codes

PostPosted: Tue May 20, 2008 2:00 pm
by asmodeus
stevenp wrote:this is seriously cool, and easy to understand

good job! +1

Thanks! :D

There is also some information about raycasting on wikipedia.
http://en.wikipedia.org/wiki/Ray_casting

Re: Raycasting C-Codes

PostPosted: Wed May 21, 2008 12:06 am
by feral
for those planning on working on raycasting...

sadly ... it does NOT work on GE.. in the current form raycasting is in..

This is because raycasting in the traditional sense relies on the drawing functions, which are not a GE specialty.

GE is primarily a sprite engine (and a good one at that)

BUT... :D , using these codes - or something similar - you CAN get the same effect in GE.

HOW?

use sprites instead of the draw function. this is exactly (sort of) how I made my 3d engine.

instead of using raycasted draw functions, I simply scaled sprites and placed them where the raycasted lines would have been.

ie: work out the angle and distance and place a sprite, instead of a line

Actually i did not realize I was raycasting until i read this article, but apparently that is what i did ( although a somewhat completely different method) but essentially I am using the same idea, only with sprites.. (I also have avoided 'some' - not all) of the "distortion" effects inherent in raycasting)

It is entirely possible (and would be a LOT faster then what I currently use my engine for) to do wolfenstein type mazes with my engine rather then draw functions, as there would be a much more limited amount of sprites on screen then I currently use (eg: in a maze on a 640 by 480 screen you only have a maximum of 640 sprites as nothing behind those wall sprites is drawn. whereas my engine allows for all background objects

you would however have to make an array of prescaled "line" sprites for it to work, but "blitting" a heap of sprites is still much faster then drawing lines.. ( this is why i am so keen to see sprite scaling in GE :( )

And, I like my method better as you can see items in the background. ie: have windows etc :) - and also, by using sprites I get away from many of the limitations of raycasting as i can easily draw higher/lower objects, slopes and can move objects way back to the horizon (and beyond) and many other things that basic raycasting cannot do..

anyhow, just letting you all know, that if you are interesting in raycasting, then my engine basically uses it, but it has been optimised for a sprite engine..

see my example demo again, and you will should now notice the similarities with raycasting
see viewtopic.php?f=4&t=5658#p39534

i will be posting more on it soon...sorry got busy with "real life" :?

cheers
feral

Re: Raycasting C-Codes

PostPosted: Wed May 21, 2008 6:10 am
by feral
sorry guys, i just reread my last post on thi,s and it seems like I was boasting or "showing off" ...

what I was trying to say is that raycasting will work in GE, just not in the traditional way, and I was simply trying to suggest that we think in terms of sprites rather then draw functions..

sorry if I sounded a bit "over the top"

cheers
feral

Re: Raycasting C-Codes

PostPosted: Wed May 21, 2008 6:18 am
by DST
You are a boasting A**hole!

J/k, honestly, if most of us had made that post, it would be boasty, but you've proven it. The fact that your 3d engine runs on an 800 mhz celeron is your justification....many of my simple games wouldn't run on that! (probably cause i coded them like an idiot).

I don't know about anyone else, but i'm hella impressed by ur 3d method, it could be used for all sorts of things (like driving games) and when I read the raycasting explanation indepth, its method is similiar to yours. It starts with a 2d map or array of locations, but yours is drawn by placing objects, the one on that site link was done with an array (oh i'm sure a paragraph of numbers makes for really creative level design!).

So to recap, ur method is legit, it's proven, and it seems like the best method for GE. But at the same time, you might still be an A**hole anyway.

Cheers!

Re: Raycasting C-Codes

PostPosted: Wed May 21, 2008 7:51 am
by feral
DST wrote: But at the same time, you might still be an A**hole anyway.

Cheers!


ROFLMAO :lol:

thanks for putting me back in line :D

oh, and thanks for the comments ....I think :oops:

cheers
feral

ps: I tried it with some driving games, but sadly my maths and experience with C programming lets me down :?

Re: Raycasting C-Codes

PostPosted: Fri Sep 26, 2008 2:12 am
by segwego12
asmodeus wrote:I found the C-Codes for raycasting in the internet. Maybe that will help trying to make 3D.
Lode's Computer Graphics Tutorial

I'm no tinto raycasting yet but i'm trying to make a plasma effect. And I need help.