Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI Z80 => Topic started by: LincolnB on February 14, 2012, 05:28:45 pm

Title: Flashlight Demo
Post by: LincolnB on February 14, 2012, 05:28:45 pm
Hey, I spent the last coupla days messing around with the idea of raycasting, and came up with something that, while looks very different, is in reality moderately similar to a first person view type of game.

(http://img.removedfromgame.com/imgs/anwiopvj.gif)

I'm not really planning anything big for this. If you want the executable, or the source, or an explanation (kind of a headache), just let me know and I'll hook you up.
Title: Re: Flashlight Demo
Post by: parserp on February 14, 2012, 05:30:14 pm
O.O wtf I was just wondering how do do something like that.


If you could provide the source, that would be awesome. :D
Title: Re: Flashlight Demo
Post by: saintrunner on February 14, 2012, 05:31:32 pm
Talk to BuilderBoy....Nightmare: Emergence .... ON CALC O.O
Title: Re: Flashlight Demo
Post by: Builderboy on February 14, 2012, 05:31:56 pm
Looks pretty awesome :D Is it really raycasting?  Since i couldn't see any walls that were occluding the view of the beam
Title: Re: Flashlight Demo
Post by: nxtboy III on February 14, 2012, 06:01:30 pm
That looks real nice!
Could you explain in simple pseudocode?
Title: Re: Flashlight Demo
Post by: flyingfisch on February 14, 2012, 06:04:11 pm
That looks pretty cool! And yeah, pseudo code so I can understand too :)
Title: Re: Flashlight Demo
Post by: Darl181 on February 14, 2012, 06:42:51 pm
This reminds me of an old Light project, except in the other one walls would cut off the beam.  This one runs a lot faster tho 0.o

Can't wait to see what's doable with it.
Title: Re: Flashlight Demo
Post by: LincolnB on February 14, 2012, 10:57:35 pm
Ok, so basically the flashlight drawing part loops through various degrees (180-210, 150-180, etc) and taking the sine and cosine, and drawing a bunch of individual lines based on that.

That probably didn't clear anything up. Source code!
compiled with Axe 1.1.1, and yes, you need the appvar for the source but not for the executable. Oh and KRAYSRC is the one to compile.
Title: Re: Flashlight Demo
Post by: Darl181 on February 14, 2012, 10:59:27 pm
So it basically draws a bunch of lines next to each other, masking/unmasking where the "beam" is?
Title: Re: Flashlight Demo
Post by: LincolnB on February 14, 2012, 11:08:10 pm
Yeah, basically. But it only draws about ten-fifteen lines, and it draws a 7*7 sprite instead of a single pixel. Also, I do ClrDraw, then draw the beam, then DrawInv, and then I draw the map.
Title: Re: Flashlight Demo
Post by: nxtboy III on February 18, 2012, 12:21:07 am
But seriously, you could make a pretty cool game out of this, because you do not know what is behind you, like in 3D FPS's.
Title: Re: Flashlight Demo
Post by: chattahippie on February 18, 2012, 12:27:08 am
But seriously, you could make a pretty cool game out of this, because you do not know what is behind you, like in 3D FPS's.

He is using the same principles that raycasters use, except he is not rendering the image from the player's perspective (as FP games do), which is why it seems so similar :)