The episode you're talking about is "Once Upon a Time"--from the transcript here:
JANEWAY: Just checking on my future Captain's Assistant.
NEELIX: Right now, she's off to conquer a giant beetle.
JANEWAY: Oh, sounds like a dangerous mission.
NEELIX: She can handle it.
JANEWAY: She's a courageous girl. Did I ever tell you about the time I flooded this entire forest? I was six years old. Flotter claimed we were in for a dry spell so I came up with the obvious solution. Why not just divert the river? This entire forest was a swamp by the time we were done. At which point, Stinger was born.
JANEWAY: The biggest mosquito.
Although the writers probably did intend to suggest Janeway had been playing the game on a holodeck at six years old (I'm guessing they just forgot about holodecks being portrayed as new at the start of TNG), this isn't stated explicitly, so if we want to reconcile it with the apparent novelty of holodecks in "Encounter at Farpoint", we could imagine the game had simply been ported over to Holodecks from some earlier, less advanced form of interactive game technology. It could have been played on a tabletop holographic projector like the one seen in this shot from "Loud as a Whisper":
Or for a more immersive option, in the Voyager episode "Equinox, Part II" the captain of another lost Federation ship was seen using a technology called a synaptic stimulator that seems like it was feeding sensory information directly into the nervous system, you can see it starting at 0:33 in this clip:
However, the synaptic stimulator article seems to indicate that everyone on Voyager who was seen using one had acquired the technology in the Delta Quadrant, and in Equinox Chakotay seemed unfamiliar with them, so maybe this isn't likely...from the transcript:
GILMORE: Could you use a synaptic stimulator?
CHAKOTAY: Depends. What is it?
GILMORE: It's a neural interface you wear behind your ear. It taps into your visual cortex and shows you different alien vistas. Just think of it as a poor man's holodeck.
KIM: So that's how you kept yourself entertained.
GILMORE: Beats checkers. The Ponea gave it to us.
CHAKOTAY: Never heard of them.
GILMORE: We called them the life of the Delta Quadrant. They see every First Contact as an excuse to throw a party. I wish that we had encountered more species like that.
There was also the technology seen in the TNG episode "The Game" which projected an image over one's sight, it seemed to do so not by directly stimulating the brain but by beaming a signal into the eyes (maybe something like the real-world technology known as virtual retinal display):