Combat
RimWorld's Combat System may seem a little daunting to new players at first, however a few simple guidelines will have you ready to repel attacks and hold ground like a Pro.
Combat Basics
The Various Character roles play a big part in combat. Fighting type characters Commissar/Assassin/Pirates are ideal for combat, use these types first. Keep your commonly used weapons close to your base's front line, so that characters can equip them easily.
It's often handy to keep one unarmed character with only firefighting duties nearby during a fight, if a character catches fire they will run around in panic and likely die. So this extra character can help them out before they panic.
Characters will need rest if they take a lot of damage. This is when you can use the less combat skilled characters, have your injured character drop the equipped weapon and un-recruit them, then have your reserves pick up the weapon and fight in their place.
Security Defense Turrets with a wall of sandbags around them are an effective way to repel attackers, a few well armed characters with a turret will be hard to beat. Have someone on hand to deal with fires and to repair the turret.
Cover
Place your Sandbags in a U shape or zig-zagged pattern, as the extra bags will provide more cover spots for your characters. Walls can be used for lean-around cover and are great for flanking positions. Take care not to place your Sandbags too close to security defenses, as they explode when destroyed, damaging everything around them in a 3 tile radius (starting "outside" the turret).
Loose rubble near your base can be used by attackers as cover, be sure to have your characters clear away rubble as soon as possible. Ranged attackers will be much more exposed with all the rubble removed.
If you have the resources spare, you can make multi-level defenses, with rows of cover you can fall over. This may seem wasteful, but dead characters cost more than sandbags.
Enemy attackers will move around your defenses so keep your characters behind cover and fall back if you're being overwhelmed.
Aftermath
Your characters will slowly become tired and hungry, eventually leading to a mental break if you don't take them off draft (R). Return all drafted colonists to normal control so they may work on cleanup and repair. Select dropped weapons and corpses and uncheck forbidden to allow colonists to move them. Build graves or have a dumping stockpile designated for corpses to dispose of them and prevent colonists from losing happiness.