Role-playing is something that children often do for playtime. It involves a person pretending to be something and doing something. As an example, one might pretend to be a cop, and the other a robber, and they will pretend to try to kill each other, typically using water guns or just holding their hands out pretending they have a gun. The same is the case with cowboys and Indians.
Once Marvin was on the S.S. Grayback, and he was pretending that he was a special agent that was there to save the Imprisoned American Scientist. Wendy told him to knock it off with the fantasy, because they're supposed to be watching for Professor Baffles, but Marvin ignored her, continuing with his role-playing game.