What do you do before setting up your tent when the your camping site is either:
- full of rocks ?
- not flat ?
Camping on a slope is really quite common, and while an extreme slope can cause problems a mild one shouldn't and is all part of the experience! I find it comfier to set the tent so I'm sleeping at an angle rather than rolling against one side, so that may be something to consider.
Likewise if there's just a relatively rocky surface you should be ok - if you want to make sure you don't puncture the tent then putting down a tarp first certainly wouldn't do any harm.
Beyond those points, you really have to look at starting to change your environment - but if this is the case decide if you really need to, if you're allowed to and if it's really going to make a big difference. It really does go against the "leave no trace" philosophy, so consider that first. The situation can vary wildly depending on whether you find yourself in a survival situation or whether you're just out on a few day's recreational wild camping.
If you do decide to modify it, see if you can level the ground off with your available tools - not so it's dead level per-se, but just so you have a reasonable slope that means you can still get some good rest. Or, if you don't fancy levelling off ground for an entire tent, you may want to level off just a bit so your stove (if you have one) sits level (if it's not then it could be a hazard since it's more likely to tip over.)