Years ago, I remember being annoyed at the depiction of religion in the computer game Space Empires IV. Even though I was an atheist at the time, I somehow saw it as almost offensive that you could just build religious buildings and get some sort of supernatural benefits from them. So when I went to make my own mod for Space Empires IV, I wound up explaining this away by treating the effects of the buildings as, well, basically magic in the descriptive text. "It's so because we believe it to be so", in other words - the placebo effect in action! That was probably even more offensive to people who were actually religious, though...
But then if religion isn't magic, how do we explain miracles? I think the answer is clear - it's divine intervention with the laws of nature. What about actual magic, though? Is it real? And if so, where does it come from?
If it is real, I'd have to say it's probably Satan's attempt to mimic God's miracles. We see this in Exodus, where God, through Moses, sends the ten plagues upon Egypt; the Egyptian magicians in turn try to duplicate them (why they would want more plagues, I don't know, maybe they just wanted to show that they were powerful magicians?) but their attempts are nowhere near as impressive as God's. We also have Elijah's competition with the priests of Ba'al; Elijah is so confident that God will set his offering ablaze that he douses it with water first to prove that it really was God and not some parlor trick! The priests of Ba'al of course are unable to duplicate this marvel.
So what does this say about portrayals of magic in games and media? Do we need to stop playing D&D and reading Harry Potter because they're "satanic"? I don't think so. People are capable of telling fantasy from reality, and there's nothing wrong with a little escapism so long as it doesn't consume one's life. Does playing Grand Theft Auto turn people into criminals? Does watching Jackass turn them into idiots? No, it's just entertainment. Mostly harmless, as Douglas Adams would say.
Back to Space Empires IV, then. What's up with the religious buildings providing wide-ranging effects such as bonuses to ship combat effectiveness (War and Death Shrines) and renewal of planets' natural resources (Nature Shrines)? I'd have to say that it's simple - Space Empires IV is set in a polytheistic universe, so there are actual gods answering the prayers of the worshipers at these shrines. But the gods are unnamed, for whatever reason. Maybe someone will make a mod which expands on the religion system, naming the gods. Maybe someone will even make a mod for Space Empires V which has scripted "religion spreading" events, sort of like Civilization IV and V. (You couldn't do that for Space Empires IV because it didn't support scripting.) Who knows? But again, it's just escapist entertainment.