In general, a story's setting basically serves two purposes: to grant the audience Willing Suspension of Disbelief, and to enable the plot. The rules which govern the world can range from technobabble to intricately detailed science, magic, or societies.
In some works, the rules of the world not only shape the story, they are the story. They become a Driving Question themselves, such as "How does this work and how can it be used?", "Who am I?", "Where am I?", or "What's in the box?".
By their nature, such stories tend to feature a Science Hero and/or Guile Hero, and the Rules Lawyer is more than welcome. The audience of such stories tends to revel in Complexity Addiction and may find themselves having to take notes as necessary, because even Mr. Exposition will probably expect them to keep up.
Refer to Minovsky Physics, Magic A Is Magic A, Rule Magic, and Three Laws-Compliant—these types of stories are much more frequent in Speculative Fiction because much of the reader's engagement in the story comes from trying to anticipate and deduce new properties of the mystery and new ways to use it to solve problems. Those that do have a real-world setting tend to involve specialist fields of knowledge, such as law, psychology, or mathematics, and put special effort into Showing Their Work.
Compare the Lord British Postulate and Sequence Breaking, which result from the audience engaging themselves in game mechanics in the same way, and Trial-and-Error Gameplay. Contrast New Rules as the Plot Demands. May involve Loophole Abuse. Runs entirely on the Cool of Rule.
- Death Note: Light knows the rules (and learns new ones whenever Ryuk feels like telling him) of the Death Note notebook, and L (and later Near and Mello) intend to work them out in order to stop him.
- Eden of the East: The main character opens the story naked outside the White House with a gun, a cell phone, and no idea who is he or how he got there. The plot then spends time trying to figure out the answers to this, and how the phone works, and how to save all of Japan before he runs out of money.
- Future Diary is basically a big battle crossed with Scry vs. Scry, with each of the eponymous future diaries working under shared rules with individual special restrictions.
- In Hunter × Hunter, there are a lot of characters with complicated rules for their powers—characters can decide what sort of powers they'll have, and the more conditions there are, the more capable the power will be. All of the best fighters in this series are Genre Savvy enough to reveal as little as possible (some choose to not use their powers at all until necessary), so victory in a fight largely comes down to who can figure out the opponent's powers first. So far, there has only been one villain in the series whose power contains fewer than 6 rules.
- Kaiji features rules that have been laid out specifically for competition purposes, in which law-abusing is expected and even encouraged but law-breaking will result in costly disqualification.
- In YuYu Hakusho, a small group of humans gain the ability to create "territories," where they can create physical rules to the space and people within it. Often (but not always), the creator of the territory can only be beaten by getting him- or herself to break one's own rules. The most notable case is Kaito, whose rules are, "No violence is permitted" and "Every 30 seconds, a letter is banned from use in a spoken word." Kurama defeats him by waiting until nothing can be spoken, then tickling him to get him to laugh.
- Isaac Asimov established the Three Laws of Robotics principally to write stories of this type in I, Robot.
- Mistborn - Allomancy, Ferruchemy, and Hemalurgy and the inherent abilities of kandra and koloss combine in some surprising ways. The Lord Ruler managed to make himself practically immortal this way. (Brandon Sanderson admits to having been inspired by Magic: The Gathering.)
- From The Unorthodox Engineers, there was a short SF story called "The Pen and the Dark", by Colin Kapp, in which Sufficiently Advanced Alien Lost Technology is causing bizarre problems that defy the laws of physics and it's the job of the protagonist to work out how to solve them using only human science.
- Kenny vs. Spenny: Each episode has the two friends competing at something, each trying to bend the rules in their favor. Of course, that's when they don't just cheat.
- In Fluxx and its derivatives (EcoFluxx, ZombieFluxx, etc.), the cards you play may set new rules or victory conditions when played that last until the card is removed.
- Depict1 deliberately lies about the rules.
- Doodle God doesn't give any indication of what elements need to be mixed or how to create the new ones—or even which are missing.
- Tower of Heaven requires the player to get to the god at the top of the tower, and he keeps giving you more rules to obey as you ascend - "Thou shalt not touch living things", "Thou shalt not touch blocks or walls from the side", "Thou shalt not walk left"... "Thou shalt not review the Book of Laws."