Uhhh, raycasting, one of my favorites tempting
Yes, stretchy columns for the ouput is easy, not sure if Floblab is fast enough.
Another option (pokes @grazer) could be if our allmighty developer would grant us another image behaviour: Skew
That one works fine for good old Wolfenstein/Doom style 3D faking.
Not sure how Flowlab is built and what libaries it might be using for the gfx, but it is a quite common function, now even in HTML.
Would that be a difficult request @grazer? I can see many uses for it.
And the 3D demos @MagmaDude100 mentioned are propably the ones from @Wizardry . But they seem to be broken now.
Uffff, I think Flowlab’s raycast is not precise enough.
As you can see it seems to pick a nearly random spot within the hit target. To make fake 3D you would need to know the exact wall intersection point.
So it is good enough to identify objects in the view field, but one would have to calculate the details separately pain
Can be done by what I see, I will further tinker around.
Hard without being able to use lookup tables or calculations with more than 2 inputs.
Is a bit sinus/cosinus/whatevernus involved and pushing the results from one expression to the other doesn’t work because the results are turned into integers.
So you have to multiply them by some factor, shove them to the next block, divide … calculate … pain, or maybe I’m just a spoiled little Tinker
I already asked @grazer if there is a way to get more parameters into the expression block.
ACTUALLY, what I would need in this case is either a multiline expression block (easier to read what you do), OR even better a SCRIPT BLOCK
Folks, suggestions please. Anyone came up with a better raycast solution yet?
wow @TinkerSmith If we could get your example working even better, we could have a whole other type of game on flowlab.
could this work for other in-game objects too? maybe the way DOOM does it where the objects are always facing towards you but they get bigger and smaller (or offscreen) depending on how close they are.
Update & correction.
I increased the ray count to 80 and realized that the number raycast returns is not random. It seems to calculate the radius from the cast origin to the target center and gives you the point where the ray hits this arc. Easy to see here:
@F3Art , letting the sprites always face you is the easy part, LOL. I have done Wolfenstein clones back in the ages for Amiga Demo reels. The 80 rays already slow down Flowlab, normally you would need to cast at least 200 to 300 … depending on your screen resolution
But that can be optimized if you have the ‘math power’ behind you. I made one once where I actually only traced the edge points of the targets, that’s all you need to place your 3D fake.
Yeah, would be nice if we could achieve this:
P.S. actually. Since we work with a fixed cell map here it should be easy to just shorten the ray to the cell boundaries. Anyone here good with Vector Maths? I’m a bit rusty, haven’t done that for ages.
In the demo you can also zoom in and out. Biggest flaw is the FOV error you see, but I expected that with my simplified routine. I leave it as it is and hope someone else will finish it
If so I will continue with the raycast routine. Any takers?
One has to figure out a way how we can have multiple independent ones on the screen and how to push the information to them. By default possible, just tricky.
P.S. The Field Of View error shows because I did not implement perspective correction for the depth. I would have to change the scale ratio to make the back shorter and the front longer towards the view plane.
Yes @F3Art , sure I have a link. How else would I get back in to edit it
Ohhh, or do you mean if I would share it? ROFL
Nope … normally I don’t like to share links of demos that have a high tendency to crash, are unsorted and just a mess in general.
OK, OK, OK, … stop twisting my arm, here it is: Raycast Test
DISCLAIMER : I take no responsibility for computer crashes and the mental damage it might cause when you loose your favorite files. I also take no responsibility for any radiation damage caused by the extensive use of rays. Wear proper safety equipment and keep a minimum distance of 2 arms length to the computer!
Actually I’m working on a different version, so have fun. The way I approached it might give you ideas for your own game development. Basically I did the same as I did for the ‘Skew’ demo, I gave each spawn it’s own ID and made them independent smart units.
Note to @grazer, any chance of being able to identify and address spawns by their ID? Like with the raycast, if it would also hand back the target ID … I would give you one big hug … maybe TWO
P.S. … before I get the question, YES, part of the routines can be used to make a grapple hook