Hello, hi, hey, so many ways to greet others in English.
Before I begin, I want to say that the second level is for an actual game, but it does have a very advanced shadow in it so if you want you can view that (I know @thebrickccentric wanted to see this), but the main thing is in the first level.
The main part of the generation is made with my old Random Map Generator, but I added an extension for it to automatically create walls/openings for you.
Wow, so nice work on both levels. I must say you somehow found seemingly the most complicated and tedious way to do the raycast shadows (360 individual raycast behaviors and 360 individually named line objects?!); the same thing can be accomplished with 2 Repeater behaviors and a lot less code…
But despite that, nice job figuring out a way to make shadows, and if you want I could show you a way to simplify things.
Believe me, I have tried it. Problems with using a repeater. And yes, this was probably the most tedious way to do it, but the performance is decent (~25-30 for me). Also if you want to give it a go you’ll encounter these problems.
Each repeater would be set to 180, and to adjust the angle of each ray it would need to increase a number by 1 for all the rays to 1-180/181-360.
I’m going to guess you’ve never used the repeater like this before because constantly doing that with the number behavior is a very heavy hit to the performance.
Now for the 2nd problem. I’m assuming in this case you would be using 2 Ray Cast behaviors. Now how do you specifically send a message to each of those line objects?
So you have 2 options. Use a ton of routers to send 360 individual messages like I am currently doing. Or using 1 message being sent to each object.
Let’s talk about the 2nd method. You will be sending 129,600 messages after each frame. This is because a message will be sent to all 360 of them every single time the angle is changed. so 360*360 is the number of messages. This is another very heavy hit on performance
Time for another problem. Deciding which ray should increase based on which message. So there are a few ways to do this part.
Using 2 messages. This would work by sending the angle, along with the length of the ray. You would put the angle through a filter set to “Equal to”. That filter would be set to the Starting Value or the Object Name → To Number. When this passes through the filter, it gets the Distance message, this is the length of the ray. Another heavy tank on performance.
Lists. Add each message to a number list, then use the “One” input to get a specific distance. Works, but don’t try it. The game literally has 0 performance.
*3. A guess that was my “few” ways to do it. If you find another try it.
So overall by the end of that, you will be lucky to run at 1 fps. So while what I have done was tedious, I doubt the same performance could be gotten.
But @thebrickccentric if you manage to somehow do this with 2 repeaters, a few ray casts, and messages, I’d love to know.
Actually thinking about it a little more, I think there could be 1 method that might work which I am so upset that I missed because thinking about it it should work perfectly.
The answer should literally just be to put the ray in the Line object. Spawn 360 of them, then use the Starting value to determine their angle and the angle of the Ray. This would bypass all messages and solve the problems of sorting through all the messages. Well, thank you for that, very glad that you made me think about how to do this again.
So in theory this would be the performance (The rays are messed up because collisions are off).
With collisions ray casts take 500ms… So until grazer fixes this very annoying bug it doesn’t seem to be possible.
Unless I have it as a parent object? I’ll try that rn
Hmm, that’s a wierd bug; I have used a lot of raycasts from non-solid objects and they seem to work fine, not sure what’s different here.
Maybe try making the lines solid and then disabling their physics a short time after the game starts?
But whatever the case, when you want 360 line objects, you can use a repeater set to 360 to spawn them and then have each line extract its starting value to get its angle