How do I replicate the Line of Sight feature in games like Darkwood?

0 favourites
  • 6 posts
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • For reference here's a screenshot ...

    So essentially it's visualising the LoS Cone, but morphs as the cone touches walls and doorways. Anything outside of the cone is darkened and doesn't show movement etc.

    I've seen an example on here for Stealth LoS, which is kind of similar but doesn't seem to react the way I'm after. So looking for pointers.

    Thank you

  • You can use 3D shapes (to obstruct LOS) and blend modes in a clever way. Basically, anything that blocks line of sight needs to come up out of the ground to actually block the camera's LOS. You can see this clearly in games like Teleglitch.

  • Thank you for replying so quickly. I did stumbled across Teleglitch during my research of this and can see what they're doing, but it's not quite what I'm after. The extruded 3d objects isn't necessary for our game, but the effect where the LoS extends when the doors open is spot on.

    I presume using something like a Canvas and drawing a polygon is probably the way but am entirely new to that.

  • Why wouldn't that work for your project? You could combine a few 3D edges and a sprite to get that exact shape in the screenshot.

    Also, have you played with the Shadow Light plugin?

  • There would be a lot of edges, and a lot of 3d objects so this is why I'm thinking a canvas with a polygon might be simpler to manage.

    The shadow light is what got me started on this path, it's good but doesn't seem to do the same behaviour. It casts shadows, which is great but doesn't plunge a room into darkness if the door closes and you're outside of it.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • What is "a lot"? Each 3D shape is, what, 12 triangles? 1000 objects would be 12000 triangles. I remember a time when that was a lot, a whole pizza cost a nickel and MTV played music. I don't think you're going to create enough cubes and prisms to cause any trouble.

    The sprite can certainly handle the ring around the player and you can even use it for the entire shadow shape, though I think it's less efficient for the hard lines, but it won't be able to account for other objects. Or am I not understanding; do you want other objects to obscure your line of sight?

Jump to:
Active Users
There are 2 visitors browsing this topic (1 users and 1 guests)