War is hell. William T. Sherman, the Civil War general, made this statement back in 1880, but it's just as true today. The current conflict in Iraq, now almost three years old, is confronting American soldiers with horrors that we on the home front can only guess at. Recently, however, I got a high-tech glimpse of what the grunts in Iraq must be going through. During a visit to the U.S. Naval Research Laboratory (NRL) in Washington, D.C., I immersed myself in several virtual-reality training systems that can simulate urban combat with uncanny realism by allowing users to walk, march and run inside an electronic battlefield.

The Office of Naval Research is developing these systems as part of a six-year, $40-million program called Virtual Technologies and Environments (VIRTE). Much of the work focuses on the needs of the Marine Corps, which is engaged in some of the bloodiest fighting in Iraq. My first stop at NRL was a small windowless room containing the VirtuSphere, a nine-foot-high hollow ball made of sturdy perforated plastic. The VirtuSphere rests on 26 wheels rising from a stationary platform; the wheels allow the sphere to rotate in place like a giant trackball, turning in any direction. Next to the sphere was its Russian coinventor, Nurakhmed Latypov, whose company--also named VirtuSphere--is working with VIRTE to incorporate this contraption into a training system.

Latypov gave me a demonstration. He opened the VirtuSphere's hatch, stepped inside and began running full-tilt like a hamster in an exercise wheel. As the sphere turns, two tracking devices fire ultrasound beams at it from below and measure the Doppler shift of the echoes to determine the speed and direction of its spin. This information goes into a virtual-reality program running on a nearby computer, which calculates what the path of the user would be if he or she were traveling through a simulated landscape instead of scrambling inside the VirtuSphere. The user wears virtual-reality goggles that display the landscape, which advances and recedes as the person moves about. (The system transmits the signal wirelessly to the head-mounted display through the VirtuSphere's perforated shell.) The goggles have accelerometers and magnetometers to detect changes in the orientation of the user's head--if the individual turns left, right, up or down, his or her view of the virtual world pivots accordingly.

The marines are interested in the VirtuSphere because real-life combat training facilities are expensive and often impractical, especially at temporary bases overseas. The VirtuSphere, in contrast, can be taken to the front lines or onboard ships and assembled in a few hours. Conducting maneuvers in the device, however, takes a little practice. When I entered the VirtuSphere, I had trouble keeping my balance. Although it was relatively easy to start walking and change direction, it was harder to slow down and stop. At one point I took a step backward and went tumbling. Still, after a few minutes I felt confident enough to don the head-mounted display and begin my virtual trek.

The first program I tried was a three-dimensional rendering of a proposed sports center to be built in Moscow. (Latypov had previously used the program to assist Moscow's bid for the 2012 Olympics.) In fits and starts, my feet turned the VirtuSphere, propelling me up the stairways and down the corridors of this weirdly barren virtual building. I came to a long hallway lined with identical doors that opened automatically when I approached. "I hope this isn't the women's room," I said as I walked through one of the doorways, but the room was empty.

I finally reached an indoor swimming pool, where I encountered a surprise: animated monsters that looked vaguely like bugs and robots. I was supposed to shoot the monsters using a handheld controller, but I still felt a little unsteady. Perhaps sensing my ineptitude, the program generated a second shooter who appeared on my display as a flickering soldier. As I tried to get out of the line of fire, I heard a shot. I spun around and saw a splatter of blood on the floor. Although the program's graphics were no more sophisticated than those of an ordinary computer game, the simulated violence seemed much more intense and confusing because I couldn't see everything at once. By the time I ended the program and stepped out of the sphere, I was sweating copiously.

The VirtuSphere is not the only device that allows users to walk inside a virtual world. Because the goal of VIRTE is to develop and evaluate a mix of technologies, an NRL group led by Jim Templeman is working on a system called Gaiter that extrapolates the path of a user in a completely different way. To enter Gaiter, I strapped on a head-mounted display and a flak jacket, as well as forearm and shin guards. All these accessories, plus a model rifle, were tagged with retroreflectors, which can reflect a beam of radiation back to its source regardless of the angle of incidence. Then I was tethered to a harness dangling from the ceiling.

Surrounding me were 10 high-speed cameras that emitted beams of infrared light and captured the reflections. By tracking the motion of my shin guards, the Gaiter system measured my gait--the length and rate of my steps--as I walked in place, lifting my feet up and down. This measurement determined how quickly I moved in the virtual world; if I stepped high and fast, I could zoom across the simulated landscape. I was immersed in a different program now, a reproduction of an actual urban-combat training site at Fort Benning, Ga. I took a virtual stroll past several blocky, brightly colored buildings. When I pointed my rifle or extended my arms, I could see their animated duplicates on the display. I could even knock down simulated chairs or tables in my path.

The major drawback of these systems is their expense. The VirtuSphere, for example, costs between $50,000 and $100,000. (The company hopes to sell an entertainment version to arcades for $20,000.) Cheaper, simpler platforms may suffice for virtual exercises involving large numbers of marines. NRL neuroscientist Roy Stripling is developing a system, informally called Pod 1, that has no complex mechanism for incorporating locomotion--you just press a switch on the rifle's barrel to move back and forth in the virtual world--yet it provides a very lifelike simulation by accurately tracking the twists and turns of the user's torso, head and rifle, which are all marked by red LEDs and monitored by an array of cameras.

Using this system to navigate the Fort Benning program, I managed to enter one of the blocky buildings, climb the stairs to the second floor and stumble into a firefight with the enemy, a squad of computer-generated thugs. In real life I would've been cut to pieces, but the program was set to God mode, making me impervious to their bullets. I closed in on my opponents and shot them point-blank. But when I tried to leave the building, I couldn't find the stairway in the maze of dark rooms now littered with virtual corpses. I was just about to panic when K. C. Pfluger, a marine reservist and independent contractor, said, "Don't worry, I'll get you." He slipped on a pair of goggles and entered the simulation; moments later his avatar--a grunt in camouflage--appeared on my display and led me downstairs.

By this point I was suffering from simulation sickness, an awful nausea induced by too much virtual reality. The NRL researchers had told me that the experience would give me an appreciation for the rigors of combat, and they were right: I felt a small slice of the fear and a fair amount of the exhaustion. But most of all, I was repelled. Even a virtual war can look ugly and futile. No matter how many simulated opponents you kill, they keep on coming, one after another, an inexhaustible enemy, and the program doesn't end until you take the goggles off.