God looked at the earth: it was corrupt, for corrupt were the ways of all living things on earth. God said to Noah, "I have decided that the end has come for all living things, for the earth is full of lawlessness because of human beings. So I am now about to destroy them and the earth. Make yourself an ark — Gen 6:12-14
For those of us interested in creating a fantasy world based on Scripture, the Flood is problematic from the perspective that it wipes clean from the world a fantasy staple — the Nephilim (giants) and their monstrous children. It is also troublesome from the modern scientific point of view which understands millions of years of prehistory with all kinds of wildlife that were wiped out before they ever had a chance to board the ark.
At this point, I must emphasize the primary purpose of Scripture — the revelation of God. Although it has historical elements, many of which can be corroborated by archeology, the Bible is not an historical document. It is revelation. It answers the question, "Who is God?" and from a Christian perspective, "Who is Jesus Christ?" As such, the story of the flood needs to be understood from this perspective.
Note that the cause of corruption on earth is humanity. We have turned our back on God and have taken all of creation with us. But for the goodness of one man — the choice of Noah to seek to be with God — God would have allowed creation to plummet toward destruction and return to nothing. God allows us the freedom to choose Him or choose to reject Him. In Eden, God gave the garden to Adam. When Adam chose to turn His back on God, the garden was taken away. The story of the flood is the flip side of the Eden story. God was willing to take everything away from humanity. Noah chose to turn towards God. Thus, God allows His creation to continue to exist.
God spoke as follows to Noah and his sons, "I am now establishing my covenant with you and with your descendants to come, and with every living creature that was with you: birds, cattle and every wild animal with you; everything that came out of the ark, every living thing on earth. And I shall maintain my covenant with you: that never again shall all living things be destroyed by the waters of a flood, nor shall there ever again be a flood to devastate the earth" — Gen 9:8-11
Ultimately, the primary purpose for the story of the flood is the covenant made by God. When God makes a promise, He never breaks it. All of His promises have been and will be fulfilled. This metaphor can be found in iconography, where the ark has been equated with the Church. Christ fulfills God's promise to all of creation by becoming Incarnate and intimately uniting Himself to His creation. The Church becomes the safe haven from the storm of a fallen world.
When creating a fantasy world, the flood is necessary only in metaphor, not in actuality. There need to be humans that turn toward God, even in the midst of corruption and evil. God, in some way shape or form, will make covenants with His people. From a Christian perspective, these covenants will be fulfilled in the person of the Christ.