This is a great TED-Ed video by Kate Messner. And this is the important bit:

“Just like real life, fictional worlds operate consistently within a spectrum of physical and societal rules. That’s what makes these worlds believable, comprehensible and worth exploring.”

It doesn’t really matter what you write, whether it’s fantasy, science fiction, erotica or good old literary fiction. The world you create can be anywhere. It can feature whoever and whatever you want, but it must be consistent. It must have its own logic. It must be true to itself.