Managed to implement a simple fog of war today. Each player character has a circular field of view and only characters inside the circle will visibly show up. Areas outside the field of view are hidden in the fog. The general idea is that I’ll show all environment geometry in the fog, but not render any important game elements (like opponents).
Had to tweak the test level a little bit. Because I still control the enemy, I setup the system so that when you switch to the Kingpin’s turn, you see what the enemy player would see. In practice, once the enemy is AI, I’ll keep the player view active and you’ll keep seeing what the player characters see.
You’re not supposed to take any type of action outside your field of view (like running), but because my current test level is very small, there’s a bit of a conflict there. You could actually run a greater distance than your field of view, but I added some code to disallow that. That’s just for the test setup, later on the field of view will be much larger and you won’t be able to run outside it anyways.
So the player’s field of view is always a circular area, but for the enemy line of sight I’m going to try a hybrid system.
I want to use a triangle-shaped field of view in which an enemy will detect a target, but once the target has been spotted, it will remain visible as long as it’s inside a certain range (like the visual circle).
I expect that will be a bit more complex to make.