All In The Game by R. Ann Sircusa
Buy at http://www.breathlesspress.com/index.php?main_page=product_free_shipping_info&cPath=6&products_id=376
An author and physicist, trapped in a futuristic video game, must work together to win, but the artificial intelligence controlling the game has different goals.
Shauna Evans, a romance author with problems maintaining relationships with men, agrees to help her agent's family friend write a video game to appeal to the women's market. Shauna soon discovers that the friend, Donlyn Kennedy, isn't the nerd she imagined—actually, he's kind of cute—and is a physicist doing research with new virtual reality and artificial intelligence technologies.
When testing the game in a simulator, Shauna and Don are transported physically into the imaginary game world, far in the future in a distant galaxy, where they exist as lead characters in the video game. To get back to their own reality, they must work cooperatively to win the game from the inside. A daunting task when they find themselves as leaders on opposite sides of a military conflict, not to mention dealing with an artificial intelligent unit, with a crush on Shauna, that has a different agenda.