I’m using the option to simulate a foggy effect in my game. Is there a way to prevent the mist from going though the walls of a cave/ completely enclosed room?
Mist is calculated from camera distance, so no, not really.
What you can do is turn it off when the player is indoors,
use scene.world.mistEnable https://docs.blender.org/api/2.79/bge.types.KX_WorldInfo.html?highlight=kx_world#bge.types.KX_WorldInfo.mistEnable
I’ve tested it on UPBGE 0.2.4 and it indeed let’s you enable and disable mist at runtime.