Better Raycaster Engine - Raycaster Engine V.6

This one runs faster, at 20-25 fps, than the other. that runs at 5-10 fps.
Here’s the link:


Grazer posted this in the discord


Wow, @grazer, that’s insane!


Thanks @Yoann - yours is getting pretty advanced too :slight_smile:

I think I’m going to steal your depth/shadow idea - it looks pretty good!


No problem, do you have a page for it, im curious to know how you did this. (other than discord)


Here’s a description of how it works, I basically just implemented the algorithm described on this page:Raycasting

I also added your depth shadows to my demo, I think it looks pretty good! :slight_smile:


@JR01 has been working on an improved version as well, with double or quadruple the resolution.


@grazer I’m trying to get rid of the fish eye effect, but it doesn’t seem to work. Any ideas?

Here’s a page with a little bit of discussion about avoiding the fisheye effect, maybe compare it to how you are calculating the distance: A first-person engine in 265 lines

The Fisheye effect is usually from rendering the wall height using distance to the player directly, vs finding a perpendicular distance to the “camera”


the thing is that I already did the distance*Cos(angle), but it does something weird (even if I convert it in degree, it wont work either)

(press 1 to see)

1 Like

If you’re using raycasts it’s probably because ray casts do not output the distance traveled, but instead the distance + distance to center of the object, which can mess things up a lot. This is the reason for why there wasn’t a fully functional wolfenstein earlier.

I already fixed that

May I ask why this game is multiplayer?

Oups, must of been a missclick

1 Like

No problem sire, we all make mistakes sometimes. What’s rubbish about mistakes is not learning from them. Perchance.

1 Like

Hey grazer, I was looking at the code for the raycaster and it looks a bit complicated, but it shouldn’t be too hard to decipher.

Also, I was wondering, is there a way to actually make a playable map that the walls are then projected from? I planned to add tables and furniture to something like this, but I have no clue how the map data works or how it’s laid out.

I have seen a few other raycasting designs that utilized a physical map, then raycasted the walls to form the visuals as seen in the game. With the design you used, I wasn’t for sure if this would be possible since I wanted to achieve a larger map with doors and such.

I guess this goes for any raycasting engine, not specified towards grazer.

Also too bad there isn’t a behavior that acts like the cursor behavior that allows you to lock the cursor in the middle of the screen with a toggle or by electing specific keys for it. That way first person shooters will actually be possible in flowlab.

1 Like

JR is working on a map ”maker” for it rn, it should be pretty easy to make because it’s an array of values, though objects like couches may be hard to implement due to needing to display the wall behind it (unless 2 maps are made, 1 with the layout and the other with furniture)

1 Like

Can’t a + just be placed in the center of the screen, then the playable top down character shoots a bullet straight ahead?

1 Like

What I meant was how the mouse cursor locks onto the screen so when you move your mouse, the camera moves in that direction.

Adding a crosshair on the middle of the screen would work, but I was thinking of an easier alternative than using A and D or arrow keys to look left and right.