Closed Thread Icon

Topic awaiting preservation: Raycaster (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=8891" title="Pages that link to Topic awaiting preservation: Raycaster (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Raycaster <span class="small">(Page 1 of 1)</span>\

 
wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 10-07-2003 22:13

Is it just me, or is raycasting a hell of a lot harder than raytracing??

Yesterday, I decided to make a raycaster. I spent quite a while on it, and this is what I got. Its not very good, just wondering if anyone had any suggestions for the reasons. I sort of despaired of it. Use up, left right for movement. There is a bug in the movement; this is due to the ambiguous sin rule or whatever it's called. I fixed it so many times in the creation of my raycaster, I cant be bothered to fix it in the movement. Feel free to have a look, but dont expect anything wonderful, it's fairly crappy, but I just cant be bothered any more. Anyway here's the code. Please have a look nevertheless:

<script>

function check(x,y) {
if (x>9

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-08-2003 17:59

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 10-08-2003 19:27

wrayal: Welcome in the raycasting arena.

I wonder what is your main goal at the moment : speed ? visual quality ? accuracy ?
Your code is a little broken. I mean there's some

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 10-08-2003 22:12

Well, I found one problem: a negative number modulus (%) anything will remain negative. Fixed that much. But there are two more problems:

Collision detection (think I can fix this without too much problem)
at 90 and 270 degrees you often get glitches. Has something to do with the trig. I think I will be able to fix this though.

Thanks for your suggestions poi, but at first, I just wana remove the glitches! (Would have a look at the 20 liner, but I cannot download zips at school). I guess removing glitches is my first priority, then speed. Anyway, any and all comments/help are very appreciated.

Have put it online. Sorry about the popup adds, am going to get a proper site before too long
www.wrayal.4t.com/ray.html

Go to kimber-ja.demon.co.uk and click on the link to the raytracer!

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-09-2003 11:02

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

RobertG
Nervous Wreck (II) Inmate

From:
Insane since: Aug 2003

posted posted 10-21-2003 14:14

Hi Wrayal, have you used the permadi tutorial to make this raycaster? Some of the maths is a bit wrong in that tutorial which may explain some of the glitches I can see when running your engine.

You can have a look at what I've been playing with here: http://www.elephantsneverforget.co.uk/dm/dm.asp

Use wasd to move around and m to shoot.. There's no enemies or anything (it's going to be deathmatch, but the netcode isn't working very well yet), but you can shoot the blue placeholders (hit them twice and they disappear, and stop giving off light).


The code is HORRIBLE, it's messy and bloated but the main raycasting parts CastRayH and CastRayV are pretty straightforward and might be useful to you.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-21-2003 15:02

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

RobertG
Nervous Wreck (II) Inmate

From:
Insane since: Aug 2003

posted posted 10-21-2003 15:23

InI, that's one of those things I just never get around to fixing.. I don't think the fish eye effect in my engine is very noticeable so I just don't bother sorting it out I know it's an easy fix, I'm just lazy I guess..

had a quick go at sorting it out here:- http://www.elephantsneverforget.co.uk/dm/dm2.asp

It doesn't seem to slow it down but I'm not happy about the additional 80 subtracts and 40 divides per frame it adds




Petskull
Maniac (V) Mad Scientist

From: 127 Halcyon Road, Marenia, Atlantis
Insane since: Aug 2000

posted posted 10-21-2003 16:51

what's the difference between raytracing and raycasting?


Code - CGI - links - DHTML - Javascript - Perl - programming - Magic - http://www.twistedport.com
ICQ: 67751342

RobertG
Nervous Wreck (II) Inmate

From:
Insane since: Aug 2003

posted posted 10-21-2003 17:11

"what's the difference between raytracing and raycasting?"

I think the basic idea is the same for both.. Raycasting is just a simplified, limited, faster version. I've never bothered to do a raytracer as I'm interested in frames per second not seconds per frame..

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-21-2003 17:57

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 10-21-2003 18:51

Could you point out which particular part of the trig is wrong? I was planning to go on to customize this further, if I can get the grlitches sorted out. Is it somehting to do with the dicontinuities in tan by any chance?

Wrayal

[edit] My raycaster seems to have taken a turn for the worst - I am going to re-write it, but using << and >>. The fact that every other raycaster uses them might be indicating something If anybody would like to point me in the right direction, please feel free! [/edit]

Go to kimber-ja.demon.co.uk and click on the link to the raytracer!

[This message has been edited by wrayal (edited 10-21-2003).]

[This message has been edited by wrayal (edited 10-21-2003).]

RobertG
Nervous Wreck (II) Inmate

From:
Insane since: Aug 2003

posted posted 10-21-2003 23:14

Wrayal, have a look at the CastRayH and CastRayV functions in my code.. They take an angle, and return the distance to the nearest horizontal or vertical wall slice.. The functions are fairly straight forward..

<< and >> are bit shifting operations,

<< shifts bits left, >> shifts them right.

1 << 1 = (in binary) 10, or in decimal 2. So x << 1 multiplies x by 2.

You can use shifting for multiplication and division, but it requires a bit more care. Everyone uses it because it's faster (I'm not sure if this is true in Javascript though, but it can't hurt). It's useful for raycasting because most of your multiplications/divides are by the same number, the grid/square/whatever/size, which most people seem to set at 64.




[This message has been edited by RobertG (edited 10-21-2003).]

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 10-22-2003 00:43

RobertG: Another interresting aspect of the bit shiftings ( and many other bit wise operators ) is that its an efficient way to get the integer result of a division. The fact that many people uses xx:6 fixed point maths in raycasting surely comes from the PERMADI tutorial

Mathieu "POÏ" HENRI

Scott
Bipolar (III) Inmate

From: schillmania.com
Insane since: Jul 2002

posted posted 10-23-2003 04:24

Once again you guys have some really neat stuff. Well done.

Perhaps a bit off-topic, but how did you guys get started (hooked perhaps? heh) on raycast/tracing? Did any of the old classic platforms (C64 etc) ever make use of it? I never really heard much about it until .. Wolfenstein 3D I guess it was, and then the demo scene at the time seemed to use a lot of it. I could be totally wrong though.

[This message has been edited by Scott (edited 10-23-2003).]

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-23-2003 11:15

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 10-23-2003 15:35

I have come to the conclusion that I am completely incapable of making a raycaster. Somebody mentioned earlier that the maths in the permadi tut was incorrect. Can anyone suggest a link to another tute? I think its time for a bit of reverse engineering

BTW, as we are on to raytracing, have a look at the one in my sig. And anyone reading, have a try! Its very fun! And its not actually that difficult, at least not to get to where I am. Beyond there, I have no idea.

Wrayal

Go to kimber-ja.demon.co.uk and click on the link to the raytracer!

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-23-2003 15:51

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 10-23-2003 15:55

I hope ur not insinuating anything!
Inspired, but there was NO copying, not even any reverse engineering - look at our sources if you want proof of that!!

Go to kimber-ja.demon.co.uk and click on the link to the raytracer!

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-23-2003 16:12

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

wrayal
Bipolar (III) Inmate

From: Cranleigh, Surrey, England
Insane since: May 2003

posted posted 10-23-2003 19:27

Just saying!
As to the interface - that was sort of a homage to Slime's tracer.
Originality? I've got something fairly original coming - a distributed network program in javascript and cgi. Should be ready in a couple of days, just need somewhere to host it. That original?

Wrayal

Go to kimber-ja.demon.co.uk and click on the link to the raytracer!

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-24-2003 12:15

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

« BackwardsOnwards »

Show Forum Drop Down Menu