Raycasting C-Codes

You must understand the Game Editor concepts, before post here.

Raycasting C-Codes

Postby asmodeus » Sun May 18, 2008 3:58 pm

I found the C-Codes for raycasting in the internet. Maybe that will help trying to make 3D.
Lode's Computer Graphics Tutorial
Attachments
raycastspritetranslucent3.jpg
Screenshot
User avatar
asmodeus
 
Posts: 483
Joined: Thu Oct 11, 2007 5:04 pm
Location: Germany
Score: 43 Give a positive score

Re: Raycasting C-Codes

Postby makslane » Sun May 18, 2008 5:26 pm

Great articles, thanks!
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: Raycasting C-Codes

Postby asmodeus » Sun May 18, 2008 6:47 pm

:D
User avatar
asmodeus
 
Posts: 483
Joined: Thu Oct 11, 2007 5:04 pm
Location: Germany
Score: 43 Give a positive score

Re: Raycasting C-Codes

Postby stevenp » Mon May 19, 2008 4:44 pm

this is seriously cool, and easy to understand

good job! +1
User avatar
stevenp
 
Posts: 403
Joined: Sat Dec 22, 2007 12:49 pm
Location: canada, ontario
Score: 16 Give a positive score

Re: Raycasting C-Codes

Postby asmodeus » Tue May 20, 2008 2:00 pm

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
User avatar
asmodeus
 
Posts: 483
Joined: Thu Oct 11, 2007 5:04 pm
Location: Germany
Score: 43 Give a positive score

Re: Raycasting C-Codes

Postby feral » Wed May 21, 2008 12:06 am

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
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: Raycasting C-Codes

Postby feral » Wed May 21, 2008 6:10 am

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
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: Raycasting C-Codes

Postby DST » Wed May 21, 2008 6:18 am

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!
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Raycasting C-Codes

Postby feral » Wed May 21, 2008 7:51 am

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 :?
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: Raycasting C-Codes

Postby segwego12 » Fri Sep 26, 2008 2:12 am

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.
http://www.freewebs.com/primewaregames/

The Primeware Games website

Projects
Era of Rome: Done
segwego12
 
Posts: 167
Joined: Mon Jul 07, 2008 2:48 am
Location: My Website, please come to my website.
Score: 3 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest