top down : realistic reveal map

0 favourites
  • 13 posts
From the Asset Store
A template which allows you to customise the controls of your game.
  • im making a top down shooter, and i would like to implement a kind of fog of war.

    i would like to reveal only what can really be seen by the character.

    a kind of line of sight fog of war.

    so if you stand in front of an opened door,

    if you are far away you can see what its in the center of the room ,

    but if you want to see all the room you have to pass the door.

    just like the main character is a light source and everything behind a wall is in the dark

    understand what i mean ?

    do you think its possible ? and ideas how to achive it ?

    thanks

  • Hi,

    see the lighting example in the examples folder

  • spongehammer

    thanks for your answer, but if you read carefully, thats not good for what i asked.

    in the exemple it does not take count of walls.

    its a simple png with alpha following the player here.

    what i ask seems to me far more complex.

    correct me if im wrong.

  • activeden.net/item/realistic-2d-dynamic-lights-as3/686703

    like this . replace the lighted area by the field of view. but thats it. thats what i would like.

  • Cover a layer with sprite blocks, set the visibility of any that come within 300 pixels or so of the player to invisible. Leave them that way.

  • I know you're worried about walls, too. You could take BluePhaze's example, but modify if a bit and have like 8 "zones" around the player. One above, one beside, one diagonal, etc all the way around. It could even be 8 invisible sprites that define how big of an area you want cleared. Then, if a black "cover" sprite comes into contact with one, set it to invisible UNLESS the visibility zone is overlapping a wall object. You would have to do some testing to get the right balance, but that should work for rooms and hallways just fine, I think.

  • spongehammer very intersting post.

    your solution (your capx, is very nive but im afraid about frame rate.

    do you have the capX of Joannesalfa's example ?

    BluePhaze

    C-7

    thanks for your advice, i think it may wirk like hat also. need to do some testing.

  • manukeo

    Here it is.. this is not my work. I dont know where it originated i am afraid.

    Shadows

  • spongehammer   i wasnt able to fully undestand your capx, but i was able to reproduce it, but its far too heavy . nice but heavy.

    the BluePhaze solution is working well and allow 60fps .

    but it doesnt take count of the walls.

    Joannesalfa 's example , i cant make it work. impossible to spawn object on tiled background, and i will not make all my walls with single sprite. it will cause many toomuch sprite animated on every tick. not usable exept for very small layout i think....

    it left me with maybe trying the C7 version of bluephaze example.

    but i need to find a solution to tell : set invisible to the sprite who are between the player and the point where the detection sprite overlap the wall, and let the other, after the wall visible. dont know how to do that.

    i hope there will be a behavior like that in the future :)    

    someone know where we can consult the TO-DO list ?

    anyway thanks all for your help.

  • spongehammer o.O That's awesome. So damn clever, too. Kudos to whoever did that originally :D

    manukeo, here's something (r136) based on the Line of Sight behaviour. It's not the most practical approach, but it does work. It'll work even better if you happen to be building a retro-style pixel art game, but either way it's worth checking out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • GeometriX

    thanks ! but thats more or less the same system than the spongehammer one.   so it works but its too slow. i get only <20fps on your example, without effects.

    but interesting capX.

  • Cover a layer with sprite blocks, set the visibility of any that come within 300 pixels or so of the player to invisible. Leave them that way.

    How to set the visbility area/range?

    Thank you!

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