The official raycasting feature in the LOS behaviour is a nice addition, although i have run into a performance snag regarding how it calculates the raycasting hits. In my example i am using sprites as the FOV. So i create sprites "on start of layout" then i pin those to the player, and then cast to those points.
My idea (and it's working nicely) was to create raycasting maps via sprite (that you draw), then capture that image with the canvas and populate it to an array (based on different color values etc). Then i create sprites for the walls (from the array), which i intended to use for the official raycasting.
The issue is this: Since it seems that you are using the "overall" collision model for the actual raycasting, there is a HUGE performance hit when creating medium to large rooms. Since every wall is one sprite, and your collision model is using some sort of optimization (which works fine in most cases).
I have only 128 rays, but alot of "2d" walls, that makes up the map. The idea of using raycasting is that in theory, the raycasting algo shouldn't be a big performance hog, since you are only testing the first collision (if you want). In Constructs behaviour you are obviously pre calculating stuff.
Also, I only have 8 pixels of view distance. Still the performance is realy bad. The performance hit is already taken, even before you hit a wall!
What i mean is, the number of walls shouldn't bog down performance barely at all. Only the amount of rays+distance used for the actual raycasting!
Is there a better way to gain some performance perhaps?