How to improve Wolfenstein effect

Another idea:
the sides of the screen have the wall appear farther away which creates the curve effect, so maybe you can just decrease how much the scaling is affected if an object is close to the player.

2 Likes

Normally a cosine formula is used to get rid of the curve, but I can’t get it to work in Flowlab because I don’t have the length of the ray cast (The output changes depending on where you are, even if the length of the ray stays the same). Crazy Simple Raycasting E2 - 🎮 How to make awesome 3d games in Scratch - YouTube That’s a good series that explains it really well. If you skip to 23:10 it explains the fish-eye effect. (The video is using Scratch for the project, but the general principles stay the same)

2 Likes

really cool video, that solution makes sense.

The output changes depending on where you are, even if the length of the ray stays the same

What do you mean by this? looking at the code it looks like the hit output does have the length. You could go inside the wall bundle and do Math.cos(raycastAngle - playerAngle)*distance

2 Likes

I tried that but it didn’t work. If for example, I am at Y20 and move to Y50 without changing my X position, the distance to a wall parallel to me does not change, but the output from a ray cast does for some reason.

3 Likes

There’s several issues in the way before we would be able to really get clearer 3D tests…

5 Likes

I know the raycast returns the distance to the middle of the object, would it be possible to have small objects to represent the walls and have that work?

3 Likes

Technically yes, but the number of objects walls^n of objects per wall. That’s a lot.

3 Likes

The original Wolfenstein 3D casts a lot more rays that output the distance to the edge of the object, letting them put a different strip of wall every column of pixels to create the 3D effect. Basically none of that is possible in Flowlab right now. And entities just can’t be made without some crazy math.
This video may help, although it has some complicated math in it.

3 Likes

I refuse to believe anything is impossible in flowlab

2 Likes

I agree with you. With enough workarounds and creativity, you can literally do just about anything in flowlab

3 Likes

I managed to cancel the fish-eye effect here

It’s not in 3d but you can see the curve when you get close to a wall

3 Likes

I got the 3d to work mostly, but I have this weird effect where some lines don’t update until you rotate the camera a certain way, it kind of reminds me of the effect when you go outside of a level in other games like apex legends
But I did get the fish-eye to work right

1 Like

It looks great rn! Does it lag for you, or is that just for me?

1 Like

It lags if you set the resolution to high, I was messing with it earlier but it should be good now.
In the “lineSpawner” object you can change the resolution and FOV.

2 Likes

I think most of the lag comes from the raycast line objects spawning on top of each other, maybe add another mode that lets you use normal raycasts instead