CodeWalrus

Development => PC, Mac & Vintage Computers => Topic started by: Snektron on November 16, 2015, 07:04:02 PM

Title: [C] AntiCaster: a non euclidean raycaster
Post by: Snektron on November 16, 2015, 07:04:02 PM
For the past few days i have been working on a little proof of concept: non euclidean space in a raycaster!
Basically, the space can be stretched or compressed, on tiles, making the rays do all sorts of crazy things, for
example a tunnel can seem 10 tiles long (and, since player movement is slowed down too it takes the same
time as to walk though it as an actual tunnel of 10 tiles), but in reality you only traveled 1 tile.

gif (about 500kb): http://i.imgur.com/pUIaGFC.gif

I probably add some more cool things, like portals and such and
turn this into a little engine. (Wolfenstein4D?)

You can find the window executable at http://quantuminfinity.space/files/ac.zip
It depends on SDL, so SDL.dll (included in the download) needs to be either besides the executable or
on your system's path.
It should be possible to run on linux and mac too, but you'll need to build yourself.
You can find the source at https://github.com/quantuminfinity/anticaster
Title: Re: AntiCaster: a non euclidean raycaster
Post by: novenary on November 16, 2015, 07:09:34 PM
Wow damn, that's pretty awesome. Good job. *.*
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Ivoah on November 16, 2015, 07:12:24 PM
This looks pretty neat! I can't wait to see where you go with it. It reminds me of CNLohr's No! Euclid! (https://github.com/cnlohr/noeuclid)
https://www.youtube.com/watch?v=tl40xidKF-4
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Snektron on November 16, 2015, 07:17:44 PM
Quote from: Streetwalrus on November 16, 2015, 07:09:34 PM
Wow damn, that's pretty awesome. Good job. *.*

Thanks :D

Quote from: Ivoah on November 16, 2015, 07:12:24 PM
This looks pretty neat! I can't wait to see where you go with it. It reminds me of CNLohr's No! Euclid! (https://github.com/cnlohr/noeuclid)
https://www.youtube.com/watch?v=tl40xidKF-4

i sawthat one awhile ago too, its pretty awesome
Title: Re: AntiCaster: a non euclidean raycaster
Post by: novenary on November 16, 2015, 07:25:15 PM
Now that's impressive.
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Dream of Omnimaga on November 17, 2015, 12:54:05 AM
Wow that is actually pretty cool. Would textures or shading slow it down much? You could make some mindf***ing puzzle maze game out of this O.O
Title: Re: AntiCaster: a non euclidean raycaster
Post by: aetios on November 17, 2015, 01:05:56 AM
dang, that got a fairly high WTFUWOTM8 value.
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Snektron on November 17, 2015, 01:14:29 AM
Quote from: aeTIos on November 17, 2015, 01:05:56 AM
dang, that got a fairly high WTFUWOTM8 value.
Thanks ;D

Quote from: DJ Omnimaga on November 17, 2015, 12:54:05 AM
Wow that is actually pretty cool. Would textures or shading slow it down much? You could make some mindf***ing puzzle maze game out of this O.O
Yeah, i will be working on that :)
Title: Re: AntiCaster: a non euclidean raycaster
Post by: alexgt on November 17, 2015, 02:38:10 AM
Wow, my mind is bleeding as to how you coded that, great job O.O.

No, plz don't explain I might suffer a coma :P
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Hayleia on November 17, 2015, 07:39:05 AM
Lol, you can make some really annoying games with that :P
You're probably more limited than AntiChamber but you still can do this kind of annoying things I guess :P
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Snektron on November 17, 2015, 01:13:38 PM
Quote from: Hayleia on November 17, 2015, 07:39:05 AM
Lol, you can make some really annoying games with that :P
You're probably more limited than AntiChamber but you still can do this kind of annoying things I guess :P
Yeah, mostly because this is essentialy 2d (well, the raycasty part is) and AntiChamber is 3d, but im fairly certain it uses the same kind of technique.

Quote from: alexgt on November 17, 2015, 02:38:10 AM
Wow, my mind is bleeding as to how you coded that, great job O.O.

No, plz don't explain I might suffer a coma :P

Let's just say that i use raycasting because it's way closer to real life than rasterization (drawing triangles), considering light are rays too. It would actually
be almost impossible to make using rasterization. That's probably why i don't like it when people implement it in minecraft (especially in vanilla) since i know
the engine doesn't support it and people just make hacks to test where players are and change the world according to it <_<
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Hayleia on November 17, 2015, 03:59:11 PM
Quote from: Cumred_Snektron on November 17, 2015, 01:13:38 PM
Let's just say that i use raycasting because it's way closer to real life than rasterization (drawing triangles), considering light are rays too. It would actually
be almost impossible to make using rasterization. That's probably why i don't like it when people implement it in minecraft (especially in vanilla) since i know
the engine doesn't support it and people just make hacks to test where players are and change the world according to it <_<
You can do it with a raytracer if you want the best realism and full 3D :P
But forget about speed then :P
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Snektron on November 17, 2015, 04:04:04 PM
I could probably pull it off (with some shaders) though, but i liked the idea of implementing it in a raycaster.
The way i did it it should be fairly easy to port over to less powerfull devices too (though i do need to calculate a lot of sqrts).
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Ivoah on November 17, 2015, 04:22:38 PM
The Makefile doesn't work :(
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Snektron on November 17, 2015, 05:23:37 PM
The makefile is a makefie generated by eclipse, and i'm not really sure how to build it otherwise. I'l try to build it manually
Title: Re: AntiCaster: a non euclidean raycaster
Post by: matrefeytontias on November 18, 2015, 12:07:42 AM
Wow that's awesome. A friend I'm talking with right now sends you props, and double props for releasing the source :P
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Snektron on November 18, 2015, 12:20:46 AM
Whoa, thanks ;D
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Dream of Omnimaga on November 18, 2015, 12:25:09 AM
Something I wonder is how fast the Microcat and Nspire CX would be able to run this, and what about the TI-89?

Quote from: matrefeytontias on November 18, 2015, 12:07:42 AM
Wow that's awesome. A friend I'm talking with right now sends you props, and double props for releasing the source :P
Lionel Debroux? :P I agree, though.
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Snektron on November 18, 2015, 03:47:33 PM
Quote from: DJ Omnimaga on November 18, 2015, 12:25:09 AM
Something I wonder is how fast the Microcat and Nspire CX would be able to run this, and what about the TI-89?

Well the good thing is, it would proably be fast enough :) Maybe even fast enough to run on a 84, but i do use a few sqrts per x-pixel per frame so yea

Also, i pushed an update :)
The windows link is still http://quantuminfinity.space/files/ac.zip
Not many visible changes, but i improved movement and structured the code a bit more.
Title: Re: AntiCaster: a non euclidean raycaster
Post by: matrefeytontias on November 18, 2015, 05:28:15 PM
No, it's not someone from the TI community, but he does appreciate open-sourced projects, especially awesome ones like this one :P
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Snektron on November 19, 2015, 11:47:00 PM
Today i added mirrors and textures! :D (the windows link is not updated yet, the github link is)
(http://img.codewalr.us/raytexmirror.png)
It now depends on FreeImage for image loading.
(Texture credits to LD Studios, it was the first one i could find in my asset folder)

As of yet textures are still a bit slow and buggy, so i'll need to make some improvements.
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Dream of Omnimaga on November 20, 2015, 06:35:29 AM
This is getting better and better. :) I hope you can get higher resolution textures to run fast enough at some point. Also would adding a floor and sky background (gradient for the floor and maybe a 2D scrolling image for the sky, or gradient depending if you're indoor or outdoor) decrease speed a lot?
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Snektron on November 20, 2015, 02:46:53 PM
Texture size isn't really the problem, but it gets a little slower if you stand in front of a wall because the CPU has to do so much work, and it isn't really made for that. I might see if i can speed up vertical drawing with the GPU.

Also:
(http://img.codewalr.us/ithadtohappen.png)
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Dream of Omnimaga on November 20, 2015, 05:25:21 PM
Strangely enough, most other 3D engines speed up when you close to walls. But I remember that the Nspire raycaster did the opposite like yours.
Title: Re: AntiCaster: a non euclidean raycaster
Post by: alexgt on November 20, 2015, 08:09:43 PM
Looks great Cumred :)
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Ivoah on November 20, 2015, 08:14:33 PM
I ported it to the Nspire:

(https://sr.ht/n6BO.png)

There are still a few bugs, namely when trying to look or walk through compressed or stretched space

(https://sr.ht/N5Xh.png)

tns download: https://sr.ht/jsWe.tns
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Dream of Omnimaga on November 21, 2015, 06:28:01 AM
Awesome Ivoah. Also it seems like you are trying to do some anti-aliasing, right? Because I notice some pixels that are darker.


Quote from: Cumred_Snektron on November 20, 2015, 02:46:53 PM
Also:
(http://img.codewalr.us/ithadtohappen.png)
Yes. :P
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Ivoah on November 21, 2015, 09:48:39 PM
Quote from: DJ Omnimaga on November 21, 2015, 06:28:01 AM
Awesome Ivoah. Also it seems like you are trying to do some anti-aliasing, right? Because I notice some pixels that are darker.

Nah, that's the Nspire Student Software scaling up the image, and then OS X scaling that up for the Retina display.
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Dream of Omnimaga on November 22, 2015, 07:31:42 AM
Ah I see. How is the speed on-calc? I didn't have much time to recharge my calc and try this. Also does this work on OS 3.6?
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: SiphonicSugar on November 22, 2015, 03:00:53 PM
Whoa! This is cool!
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Dudeman313 on February 28, 2016, 03:10:19 AM
Nice! Now port it to the CE and Life's Good. :P
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Dream of Omnimaga on February 28, 2016, 06:16:14 AM
A CE version would be nice actually, especially now that Cumred is doing CE stuff. I am curious about if the speed would be fast enough, but since a raycaster runs at good speed on 6 MHz calculators, then I guess a CE version wouldn't be too slow, even with a larger screen. THe question is: Does the non-euclidean part of this raycaster take much more CPU resources?
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: 123outerme on March 09, 2016, 11:04:41 PM
I know nothing of 3D, but if you could port this or the CSE (or the CE, since the CSE is stupid slow), that would be awesome!
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Snektron on March 09, 2016, 11:06:24 PM
Since its a ray caster, which only casts on one line rather than the whole screen, it might even be doable. Though it will have poor fps probably :/
Maybe i'll have a try one day.
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Dream of Omnimaga on March 09, 2016, 11:54:01 PM
A CSE port would be possible, but it would need to not only use half-resolution mode, but also not fill the entire GRAM being used. So the game wouldn't be fullscreen. A CE version would be more feasible, especially since you can switch the screen to 1 bit, 2 bits, 4 bits, 8 bits and 16 bits for speed, and it has both a memory-mapped LCD and a faster CPU.
Title: Re: [C] AntiCaster: a non euclidean raycaster
Post by: Dudeman313 on March 10, 2016, 12:41:17 AM
Good to know the specs. I see it's possible, it just depends on
if it's done. :P
Title: Re: AntiCaster: a non euclidean raycaster
Post by: alexgt on March 10, 2016, 03:21:49 AM
I wonder how possible a fast raycaster for the Prime is...
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Dream of Omnimaga on March 10, 2016, 08:10:41 AM
Critor made one a long time ago, which ran at 2 FPS at low quality, but I think it was much more complex than Wolfeinstein due to variable wall height and stuff. A raycaster that ran off a small GROB (eg 80x60, scaled up to 320x240 when copied in GROB 0) with Wolfeinstein capabilities might have a playable frame rate.

https://tiplanet.org/forum/archives_voir.php?id=87246
https://tiplanet.org/forum/viewtopic.php?t=15033
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Ivoah on March 12, 2016, 01:37:43 AM
Quote from: DJ Omnimaga on November 22, 2015, 07:31:42 AM
Ah I see. How is the speed on-calc? I didn't have much time to recharge my calc and try this. Also does this work on OS 3.6?
Looks like I never replied to this, whoops  :-\

Anyways, trying to run it on an actual handheld freezes it up, and you have to reset it. I have no idea why, and don't really care enough to find out :P
Title: Re: AntiCaster: a non euclidean raycaster
Post by: Dream of Omnimaga on March 12, 2016, 04:31:22 AM
That sucks. I wonder why, considering it doesn't use any C code. Which OS did you try the code on? You could maybe post the source in case someone can investigate. Maybe it contains the future exploit for Ndless 6.0 :trollface:
Title: Re: AntiCaster: a non euclidean raycaster
Post by: aetios on March 12, 2016, 03:34:14 PM
That's not even a bad idea :P