Monocle: Monaco-style line of sight engine

Showcase your libraries, tools and other projects that help your fellow love users.
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 »

Can't shake the feeling that those are buildings .. I wonder why
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 »

Added repo.

How come you don't like canvases? For multiple light sources, I could make it so you can pass which canvas to use. This would allow you to use the same canvas for multiple light sources.
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Monocle: Monaco-style line of sight engine

Post by Nixola »

Many old PCs or laptops don't support canvases
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
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 »

Forked your repo and added Gaussian Blur and Alpha support:
https://github.com/Germanunkol/Monocle

I'll create a pull request when this question has been answered/resolved...

I wasn't sure about alpha support, after all, you can always do that manually as a user, when drawing the canvas. But I'd like to make a version without canvases. Micha and me are working on a game where we want to use this (I tried it, it works real well so far 'cause we don't update shadows often, so we don't get the crashes) and we need alpha support and don't want to require shaders/canvases... So I want to make it all "switchable".
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
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 »

Looks great!

I'm working hard to figure out where the bugs are, but it's pretty tough at this point. There is still some strange behavior that happens when a projection edge hits an endpoint. As a last resort, I could pre-check for co-linearity among the player, the hanging edges, and all other edges, and, when I encounter it, add some small random value to the player's position. This is needless work though, so I'd rather get the logic I've already implemented working instead :-/
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 »

Hm. I don't know if it helps, but I get an almost reliable crash if I walk start at the starting point and move diagonally towards the bottom right corner. When passing the tile at (6,6) and staying really close to it, it usually crashes...
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
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 »

I haven't fixed the bugs, but I pushed a new version with a check on the line that was crashing, so it just stops drawing triangles instead of crashing. I also added a random value between -0.005 and 0.005 to the x and y at every frame. This way, even when there is dropout, it only lasts for a single frame. I've seen it mess up a few times, and my eye was barely able to register it.

One thing you can do with your version is to return a success flag when the draw triangles loop completes (i.e. when current_edge == start[1]; currently line 270). When the success flag returns false, rerun the update in the next frame. In fact, I might make this a feature, since the optimizations I'm planning will involve not rerunning the update every frame.

Overall, though, I'd say that Monocle is now usable :)
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Monocle: Monaco-style line of sight engine

Post by Davidobot »

Sorry for the bump, but does anyone have a version of this that doesn't use canvases? And, is there a way to make the tiles that are visible slowly fade into darkness, so you could see the texture of the tile?
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
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 »

I'm working on a version. If its turns out to be any good, I'll post it here...
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
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Monocle: Monaco-style line of sight engine

Post by Davidobot »

Germanunkol wrote:I'm working on a version. If its turns out to be any good, I'll post it here...
Great! I'll be sure to check it out.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette!
personal page and a raycaster
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 4 guests