The general principle to put players in control of their flow channels is to design the game’s challenge structure in a way that concurrently escalates risk, relief, and reward, and not just over time, but “stacked” at any given gameplay moment.
A brief essay on “flow” in game design that I wrote for my university’s news room page.