Shock oil and pistons work together to control a car's damping, that is, its resistance to shock compression or extension. Those words may sound fancy, but think of it this way - the only thing keeping your car from sitting on the ground is four springs, and without damping your car would be bouncing all over the place on those springs. The shock oil and pistons slow down that bouncing effect, making it easier to drive the car.
On rough surfaces, you'll want to use lighter shock oil, so the suspension can respond to the terrain, allowing the wheels to move up and down with the surface, and allowing the chassis to roll in corners.
On smooth surfaces, you'll want thicker shock oil to keep the car from rolling.
For more, see our article on damping to see how shock oil and shock pistons affect the car's overall handling, and how you can use them to improve your car's handling.
Temperature Variance
The viscosity of shock oil varies with the temperature, getting thicker in cold weather and thinner in hot weather. So, when racing in colder conditions than usual, you may need to use a lighter oil, or a heavier oil for hotter conditions. If the weather is dramatically different, you may need to change the viscosity by 10wt/100 cSt or even more.