I wrote some game music for a 3rd party project that fell apart with the programmers and so I spent a little bit of time thinking about it.
First of all, I have a guy basically managing what I produced, so if it didn't fit what he was going for, he sent me back to the drawing board with additional instructions. Basically, he had ideas in his head from other videos he had played, and I had to more or less steal little things from those games and change them around and disguise them in order to make him happy, reproducing the general sound and feel he wanted.
From a psychological perspective, there are different approaches to game music. Are you trying to create an atmospheric sound that fits the game world, or are you trying to evoke an emotional response from the player based on what you expect their reaction to such a world would be? Or a little bit of both? When you have a map and game art to go off of, somehow or another you have to draw inspiration from the game world and its art in order to make a cohesive whole.
The music itself should be cohesive from piece to piece so that you aren't just randomly changing styles every time the player enters a new area, because that can be distracting and detract from the experience of playing the game.
So a lot of it just depends on what the other guys creating the game are going for and how you all work together as a creative team.