"Castle Doctrine" is a little misleading.
Simply stated, one has the right to protect his life and property or the life and property of another using all reasonable means including the use of deadly force if necessary. However, one's use of force must be proportional to the threat. Generally speaking, if somebody tries to punch you, you can punch back to stop them. If somebody uses a weapon against you, you can use a weapon to stop him. If somebody uses a gun against you, you can use a gun to stop him. This does NOT mean you can simply use a gun to shoot anybody who comes into your house. You have to be in a situation where there is no other reasonable alternative.
However, because one's home is presumed to be a place of ultimate safety, a person who comes into your house without your permission can be assumed to be a threat. You can then use stronger measures to protect your own safety. This STILL does not give you the right to come into your house because there is that concept of "proportional threat."
For instance, if you are a 6 foot tall adult man, a 10 year old child who wanders into your house would NOT normally be a threat. It would be reasonable for a man in that situation to simply grab the kid by the arm and unceremoniously usher him out the door but it would NOT be reasonable to shoot him. On the other hand, it might be reasonable for an 80 year old woman to use deadly force against a teenager who came into her house but, even then, there are limits.
The old woman would have to tell the intruder to leave. If possible, she should call the police. If she is able, she could try to escape to another part of the house. Before she unloads that double-barrel shotgun on the intruder she needs to give fair warning. But, if it can be shown that such conditions have been met, deadly force can be used in a situation like this.
The "Castle Doctrine" does not give somebody the right to shoot anybody who comes into their house. It simply provides a list of conditions under which a person may protect his life and property in case of intrusion.
The difference is pretty subtle.