Just what is spawn camping? Spawn camping is when you can kill players just as they spawn and basically not let them get out of their spawn. It's almost universally hated by players, but like TK'ing (team killing when friendly fire is on), there are those that will do it just to irritate. So what's a mapper to do? Read on for some examples and techniques to prevent it.
Keeping down spawn camping is pretty easy with a few basic tricks and some good planning and design of your map's layout near the spawns. Here's a list of basic rules to use that should keep your spawns a happy and safe place for all...
Physically block entering the spawn
The number one rule is to do something to physically keep the enemy from entering the spawn. If they can't get in, they won't be a problem. If they can just walk into the enemy spawn, it will be too easy for them to do so.
The easiest and best way is to make some kind of one way slope. Basically a ramp with a dropoff at the end. Most maps use this method, including Caen (for the main exit), Jagd, and Chemille. Another variant on this method is to place the spawns in a building, and require the players to jump out and down out of the building to enter the game. You'll want to make sure the drop is not too high (for either method), as players might take damage if they fall too far. But you don't want to make it too low, as then the enemy might be able to jump or be boosted into the spawn. A good height is about 75-100 units.
Another method of keeping players out is to use team specific doors. These are doors which can only be opened by memebers of the spawning team. Be careful though as the enemy might run into the spawn while the door is open.
Warn the enemy if they are close to where they should not be
It is a good idea to put a trigger_multiple outside of the spawn, set to only be triggered by the enemy. It should trigger an env_message or game_text that gives the player a message warning them. It might be a message like, "Watch out! You're in enemy territory!" or "Danger ahead!".
Keep the enemy from shooting directly into the spawn
You should be very careful if you give the enemy some vantage point (like a window in a building) where they can shoot directly into the spawn. Examples of maps that let you do this are Anzio and Caen. But in both cases, the view does not cover the entire spawn, and the enemy is not able to totally dominate the entire area. Use with extreme discression and thought!
Provide an alternate exit to the spawn
The enemy may set up outside of a spawn and prevent players from exiting it. They can't shoot players as they spawn, but they can shoot them as they exit. Sometimes this is done for legitimate reasons, such as protecting the flag that is closest to the enemy in a map such as Caen.
So to give the other team a chance, always provide an alternate exit to the spawn if possible. If not an alternate exit, then some place a player may go which could let them shoot at an enemy outside the spawn. Examples of maps with alternate exits include Caen, Donner, Avalanche, and Anzio.
Kill any enemy that may actually be able to enter the spawn
Should the enemy manage to get past your physical block in the spawn, you will need to somehow deal with them.
The simplest way is to cover the entire spawn area with a trigger_hurt and set it to only hurt the other team. It's unrealistic in some ways (the enemy just dies for no reason), but it's a guarunteed way to take care of spawn campers.
An alternate method to protect the inside of a spawn is with an "auto MG" - which is a func_tank shooter set to shoot only at the enemy. They can be very effective, but must be positioned carefully so they don't shoot out of the spawn area, and so they cover the entrances properly. If a player can hide behind a wall or other solid item, the auto-MG won't fire at them. An example of maps with this kind of protection include Flash, Caen, and Avalanche.