I usually write a massive draft about what I have in mind and that process is me making it up as I go along.
Then I go back and edit stuff out, change some bits and bobs, add a few bits and bobs.
Even when I start coding it, it always changes according to the plot.
I have a rough idea of what I want but most of the time it never turns out to what I was actually planning 