It comes from many years as a tabletop GM. When you have to adjucate insane situations like how many dice to roll when you plunk a grenade in a motorcycle's gas tank and ram someone with it, or how to handle your players when they hire the antagonist in your story arc instead of fighting him, you start getting good at thinking ahead. On my way to a movie in a short little bit but I'll post afterwards.