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 ZigZagged, 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 to close to security defenses, as they exploded when destroyed, damaging everything around them.
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 become scared and eventually unstable if you do not un equip their weapons, so after any fight immediately dump all weapons into equipment racks then focus on cleanup and repair.