Monocle: Monaco-style line of sight engine

Showcase your libraries, tools and other projects that help your fellow love users.
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Monocle: Monaco-style line of sight engine

Post 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?
Last edited by Germanunkol on Sat Sep 28, 2013 5:31 pm, edited 2 times in total.
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
User avatar
Ranguna259
Party member
Posts: 911
Joined: Tue Jun 18, 2013 10:58 pm
Location: I'm right next to you

Re: Monocle: Monaco-style line of sight engine

Post by Ranguna259 »

Will do, and found a bug, I'll post it in a gif, gimme a minute

EDIT: Bug in the gif
Attachments
Bug screen
Bug screen
bug.png (25.12 KiB) Viewed 2321 times
Bug
Bug
Untitled-1.gif (2.16 MiB) Viewed 2321 times
LoveDebug- A library that will help you debug your game with an on-screen fully interactive lua console, you can even do code hotswapping :D

Check out my twitter.
Gravy
Citizen
Posts: 80
Joined: Sun Jan 22, 2012 10:15 pm
Location: CA, USA

Re: Monocle: Monaco-style line of sight engine

Post 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.
Gravy
Citizen
Posts: 80
Joined: Sun Jan 22, 2012 10:15 pm
Location: CA, USA

Re: Monocle: Monaco-style line of sight engine

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests