Q: how do dreams work?
A: you stop accepting input from your eyes, ears, etc, but your mind keeps running. so that means even the smallest tiny little bits of input (thoughts, memories, etc.) can manifest into realities. but because they are not actual sensory input from the solid outside world, they are prone to wild transformation on a moment to moment basis.