A lot depends on the sort of game you're writing. RPGs can have some of the richest stories but they're also varied in how the story is told.
Things to think about:
How interactive is the story? Some games have stories that are the same every time you play through: the player just needs to go through the correct motions (solve puzzles, beat monsters, sometimes even just walk from A to B) and that triggers the next bit of story. Other games (especially RPGs) have stories that change depending on choices the player makes. Neither type of story is better--both can be done well and both can be done badly--but they require different approaches to writing so you should decide up-front how interactive you want the story to be.
A related thing is whether (and to what extent) the player gets to customise their character. Most western RPGs let you pick your character's name, character class, sometimes race, etc.. Other games give you a character, e.g. in Batman: Arkham Asylum you don't get to choose who you play as--you play as Batman! Letting the player customise their character can be awkward for you as a writer since you're writing a story without knowing who the main character is. Again, neither approach is better, but you need to decide how much you're letting the player customise their character and bear that in mind while writing.
Remember to make the player feel like they're the hero, and let them accomplish all the important things. In films, books etc. you can have groups of characters in different parts of the world doing different things and switch between them, but in the game you've got to stay focused on the player character.
But, make sure the player always knows what to do next. It can be tricky to do this while making them feel like a hero rather than an errand-runner. The ideal is to make the player *feel* like they're in control of the story while actually you're leading them by the nose.
In games as in every other kind of writing, interesting characters are absolutely essential. Make sure the allies, villains, bystanders, etc. have interesting personalities and motivations. If you're writing a typical RPG, the characters you'll want to pay most attention to are the main character's 'party', and the main villain.
Keep your text concise. The player is there to *play*; if they wanted to read a book or watch a movie they'd be doing that instead. Let the story unfold through the player character doing things, rather than through people telling you things. When you're writing the text, write your first draft and then mercilessly look for ways to cut it down.
For the game as a whole and for each bit of the game, decide what the mood is. Funny or serious? Resist the urge to put in jokes and funny pop culture references if the scene ought to be dramatic.
There is no standard format for games writing like there is for screenplays. The exact way in which you write the dialogue will depend on the type of game you're writing, the way in which you're working with the rest of the team (are you *just* writing or are you doing other stuff too?), the software you're using, and your personal preference. If you're writing a basically linear game story then writing it like a screenplay might be best, though I personally don't find it helpful. If you have non-linear conversations or lines triggered by player action then writing into a spreadsheet might be best. If you're writing and also developing then you might end up writing your dialogue straight into the code.