Page 4 of 4

Re: Monocle: Monaco-style line of sight engine

Posted: Sat Sep 28, 2013 5:22 pm
by Germanunkol
Ranguna259 wrote:Wow! This is getting really cool, can't help thought so I'm just going to give moral support :P

Keep on doing the awesome work :nyu:
Thanks!
... you can always do debugging/testing, though, if you want to help. :)
EDIT: Also it'd be cool if we could set the angle of the light and where it's facing, for stuff like flashlights and stuff alike
This would need quite some changes to the algorithm, I believe. But maybe it's possible to only render the triangles facing some direction. Gravy?

In the meantime, here's a small update: Blurred shadows now also have the correct shadows, thanks to the solving of this issue:
Image

Edit: @Gravy:
Gravy wrote: 2) The light has moved, but is still within the same square of the grid. In this case, get_forward_edges and link_edges do not need to be called again. However, those initial edges will need to be stored somewhere that the rest of the program doesn't touch, since the edges are subsequently changed when the projections are added.
This is very good to know! Should save quite some calculating. I already store all the data per light right now, instead of directly in the Monocle table, so this should be relatively easy to check.

At this point I simply let the user decide when to call the update fucntion. I think this is best because it keeps the library simple and gives the most flexibility to the user, because they can decide when the light is updated - every frame, or only at level start etc.
Gravy wrote: One other improvement I've been thinking about is adding logic to create edges around the perimeter of the grid. This removes the need to have a solid border.
Yes, that would be really useful!

How do you want to handle this: Do you want to keep two forks? Or merge it all? Or create a new branch which this fork could go onto?

Re: Monocle: Monaco-style line of sight engine

Posted: Sat Sep 28, 2013 5:24 pm
by Ranguna259
Will do, and found a bug, I'll post it in a gif, gimme a minute

EDIT: Bug in the gif

Re: Monocle: Monaco-style line of sight engine

Posted: Sat Sep 28, 2013 6:48 pm
by Gravy
@ranguna259: It looks like Germanunkol is missing a few of my fixes from his version.

@Germanunkol: You should replace your versions of draw_triangles and draw_vision_edge with mine. They have a check that prevents crashes. You're also missing the small random numbers that are added to the lights' x and y values, which make the mess ups much more unlikely. They can be small enough that there is no visible change to the shadows with each update.

I'm going to play around with your version for a bit. I want to make sure I understand your changes so I don't get too lost when I want to add things. After that, let's merge.

Re: Monocle: Monaco-style line of sight engine

Posted: Tue Oct 01, 2013 8:02 am
by Gravy
EDIT: Also it'd be cool if we could set the angle of the light and where it's facing, for stuff like flashlights and stuff alike
Yes, this would be difficult to build into Monocle and probably wouldn't look good. The easy solution would be to make another canvas and draw the player's field of view on it. Then just draw that on top of the Monocle canvas in multiplied mode. This should get the same effect without much hard work.