Easy to implement Fog of War system for a Top Down game.
Fog of War uses blueprints and post-process materials to create an effect known commonly in video games as a fog of war. In addition to simply displaying or hiding actors in sight, in allows for a clear display of players range of vision.
All aspects of the fog such as range, angle of the vision cone and visibility of all objects can be easily adjusted with variables.
Fog of War is a key element of many top down games, and now it takes only one minute to implement. To use the system you simply need to put the fog drawing actor in your world and add the fog controlling component to any actor that interacts with the fog (either by blocking vision or by changing its own visibility).
Currently only one source of vision is supported (you can’t combine vision from many sources, but you can toggle between them).
Technical Details:
-Actor controlling the fog.
-Component controlling the interaction with the fog.
-Material for the fog and the post-process effect.
-Precise and optimized visibility checks.
-Pixel perfect fog.
-Options to customize a lot of different aspects of the fog.
This is not supposed to be a literal fog - this is just a term for this type of mechanics.
You can replace the gray material with something else if you like.
There is no noticeable performance drop.
The system creates fog and checks line of sight only for actors in range of vision.
With a reasonable amount of actors there is almost no cost.
Although I haven’t tested it on mobile I think it would work. Does mobile support custom mesh component?
You don’t need to use post process but you then lose the option for shadows to be semi-transparent. They would need be opaque (the video doesn’t show this well).
I’m pretty sure it does - its the post processing where it gets kinda iffy - cool I think I can use this, I just hope its easy on the cpu/can be adjusted - thanks for doing this, can’t wait to check it out!
My project is ready.
I have submitted it to Epic and I’m waiting for the response.
I do not know how much time it will take before it is available on the marketplace.
Your plugin looks very cool and could help us in our current project. Is there a way to pay via Paypal to avoid the Epic authorisation for the marketplace ? Please, could you give us some news about the incoming marketplace availability ?
It’s not really ‘Fog of War’, it’s more line of sight and visibility, so I wouldn’t call it as such (people assume RTS style vision when you refer to ‘fog of war’) - I’d consider renaming it to avoid confusion.
Epic is currently reviewing my project files. I have no idea how long it will take.
Just to be safe I would prefer to wait until they are done to ensure that everything is up to marketplace standards before I sell it to anyone.
Fog of War may not be a perfect name but I couldn’t come up with anything better.
Even if there is some initial confusion, I think screenshots and videos explain what I created pretty well.
What do you mean by “real 3D perspective”? Camera here is 3D, not isometric - so it works (and it also works in 2d btw).
If you mean third person / first person, than yes, it works but its kind of pointless to have it in fps case.
Yes, it draws shadows on X/Y plane, on custom Z. You could modify it to work on any given plane.
I didn’t do any tests with matinee, but it should work with any actor as long as you can read its location / rotation. I think I will do some testing of that.
In the example video there is an object that scales it self with a timeline - and it works without problems.
about this:
1-So you need to add all the actors references that block the vision ? or you are saying all the actor classes that should block the vision?. what If I want to use simply static meshes as blocking vision?
2- So, in a RTS game where I could split some unit actors in two groups, I only can have one line of vision active, while the other became blind?
This is because some technical limitations in the implementation, or this is because is just not implemented yet?.
Sorry if I misunderstood, my English is not good.
1- You need to add a component to anything that blocks vision. This means you need to add this component to any static mesh that you use as a wall or an obstacle. I know this isn’t very convenient, but it makes drawing fog a lot cheaper and faster.
It could be modified to hold an array referencing all the actors instead of having to add components to each one of them, but that would complicate things when changing options and sizes of objects.
2- At any given time there can be only one “point” that is a source of vision. Vision from multiple sources won’t stack, so yes, in your example one unit would have vision and others would be blind (or rather others would have their vision glitching if you tried to force it). This problem should be possible to overcome, and I’m working on that, but as of right now I can’t promise that.
Good news everyone!
Fog of war should be released this week (at least that’s what Epic told me:))