0 Favourites

How do I Advanced Fog of War

  • I want to create a fog of war that isnt just black, or a fog that you cannot see the map but instead is a grey darked out fog, but you can still see the ground. Then when the player goes over it it reveals the map and anything new going on under the map that wasn't seen.

    So the fog sort of takes a screenshot of the map while the player is there, then when it fogs back over again it will show what the player just saw but anything new happening under the fog isnt shown until the player reveals it again. This is a fog used commonly in RTS games.

    Anyone have any ideas on how this can be done in Construct 2?

  • If you just want to darken the unseen surface you can create the fog of war out of a tilemap on top of your surface tilemap. All you need is a whole black tile with less than 100% opacity set in your graphics program of choice before saving it. That is the easy part. This could also be done with just sprites but believe me, using a tilemap is much faster, especially if the map is big.

    Making things only show their last "seen" state is trickier. If it's just units you need a "dummy" ghost sprite. Basically when a unit is being set to invisible due to being in a hidden area, it would spawn a ghost sprite at it's position and with it's angle. This would be destroyed the moment the tile is revealed.

    To be honest the hardest thing with FOW is making efficient FOW reveal events. The higher the map size (in tiles not pixels) and the higher the unit count the bigger the performance hit will be, there basically is no simple solution here that is also efficient. With small unit numbers, small maps and simple map reveal mechanics (show all tiles in vision range, so no line of sight blocked by obstacles etc.) you might not notice anything. However anything more ambitious and it will become apparent there is slowdown.

  • You can do one layer for fog.

    Layer: "Fog"

    Configurations:

    Color = black.

    Transparent = No.

    Opacity = (Optional).

    Force own texture = Yes.

    For do visible create one sprite and put in effect

    Blend mode: destination out.

  • See my topic and demo capx for cloud over level

    I wil post a new demo a beter demo later today

    If you chance the destroy on collision to set transparent then the sprite wli be back covering the map agan ones the player moves off the sprite

    Dont know if it is what you are looking for but if you need more just ask

    Also do download the new demo not the old one

  • Oke here is a tutorial video

    youtube.com

    watch?v=sYbgzq-xb5E

    did you maen something like this?

  • Yes that looks really nice compared to some of the other ones i saw. Thank you. One thing I wanted was ghosting when a player sprite leaves an uncovered area, so it sort of partially fogs over, you cannot see anything new under the fog but its sort of like a snapshot of what you saw while it was revealed minus enemy units.

    It was suggested to do ghost sprites which is actually a good idea, so the sprite clone would just appear in postion when cloud fogs back over, but it is all sort of confusing still.

  • I am a litlle iverloaded with work at the moment but i try to make a demo video voor you this weekend

  • youtube.com

    watch?v=vHAwPC0THVU

    This is part 2 with an returning cloud in 50% transparentsie

    And with hide enamy under the 50 % transparentie

    As i say in the video i did not have mutch time to make ik and to shoot the video so there will be a part 3 also and depending on the time i have to make and shoot the video meby a part 4

    In part 3 i will have a better cloud not the best but beter also i will set enamys hide and show beter then this but as showing in the video that code will be the basic of the beter versie so you can start to set it in your capx

    Also meby you can upload your capx to google drive or so and pm me a download list and what you ehat to hide and be show then i can make it in your capx and upload it to my drive and send you a download link that way it will go faster and i dont have to gues what it is you want to hide and show

  • Look at the "Lighting" tutorial in the Construct2 > New...

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • gumshoe2029

    never looked at that before i will go play around with that to see if i can make a beter cloud and cloudremover effect with effects thanks for the tip

    i have to say i am new to construct 2 and i just read the how do i forum and see people questions and if it something i am going to use or just want to know my self i just open up construct 2 and start trying out stuff to see if i can make it if something work great is not delete and try agan

    i have not looked at effects at all for now but i will try to make a better cloud and remover with this.

  • Yea, we use the same technique in the lighting tutorial to operate the fog of war in our game also.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
167 39,773
lucasgc1's avatar
lucasgc1
Unread hot topic
99 10,137
karshinkoff's avatar
karshinkoff
Unread hot topic
56 10,673
Ethan's avatar
Ethan