Trying to figure out a book I read many years ago. It was, if I remember right, a story that had people playing a game in one perspective, then went to the game world in the other. I can't remember much, because I don't think I finished it.

A couple details I do remember was that the magic system functioned very much like a game. The spell casters could cast a limited number of spells per day, and that amount reset at midnight. There was a scene, if I'm remembering right, where the wizard (or whatever he was) used that to his advantage to fight a forest fire. He waited till just before midnight, used all his magic on a water or ice spell, then when midnight hit, used his magic again. I believe there was also a magic artifact that, from the description, resembled a polyhedron, maybe even a d20.