How do you build a shelter to protect you from animals and weather?

Go to an architectural college and learn construction. There are many disciplines within construction. Choose one that interests you.

Such shelters as you suggest are called houses.