Fog of War & Lighting Updates/Optimisations


The Preparation for Fog Of War

So while the ultimate objective of this game is to be moved to steam once it's past what I would consider a 'vertical slice', in the meantime - we're on itch.io and using webgl, which is where rendering performance goes to die.

Purely for aesthetic reasons, I opted to add spotlights to the soldier's weapons and to the main directional light in the world. While that was novel, it came at a pretty significant perf cost for those of us not on absolutely baller rigs/laptops.

As we move toward vert slice, I'd like to begin adding fog of war, to further add complexity, depth and emergent gameplay. This is not without some performance considerations.

So, first steps

  • Removing shadow casting lights entirely (to be re-added when we deploy to Steam)
  • Adding ambient occlusion to better mitigate the loss of lighting 'interest'
  • A new shader that will handle the fog of war syste
  • Mesh combining!

Ambient occlusion

Ambient occlusion with minimal render or memory cost

Of course, any of you have ever dealt with mobile deployment or VR will know the pain of optimising like this. Of course, the game hasn't even had a real art pass yet, so this is more of an experiment for the fun of it rather than being a focused effort.

Right now, when the game is zoomed out, with 4 soldiers with lights, the game is about 800 draw calls. Of course, that's in overview mode with the entire map, in general the game is <300 draw calls unless there's an absolutely ridiculous amount of enemies and players onscreen. Simply disabling the shadows alone buys back 100 draw calls in regular use cases.

On a PC made in the modern century, this means the game would happily deal with a few hundred units wandering around before it started to hurt, and to be honest a modern iPhone probably also wouldn't even bat an eye at that. Of course, we're here in Webgl where sadness and tears are the default output of any game engine.

Expect these changes to roll out in the coming days.

Files

Archive.zip Play in browser
10 days ago

Leave a comment

Log in with itch.io to leave a comment.