I thought evolution was about genetical structure and biological stuffs slowly changing and adapting over time to suit a changing environment. How would a person/animal develop a moral system or a code of conduct by this? Or is my take on evolution misinformed?
You have a pretty average understanding of evolution. If you actually care, I could suggest a book or 2 for you to read that will explain it properly to you. Most people think its just some theory a crazy scientist made 400 years ago to disprove religion and stick it to the man and that there are many things it doesn't have the explanation for and thus it hasn't been "proved". They say they don't understand how X can affect X, I think its because people like to keep the mysticism behind things like morals and life.
What you have to understand is evolution isn't "random chance" and its not "designed". When things are talked about as "favored" by evolution say such as being strong or being tall, you cant picture a god there saying "this is good" because that goes against the entire point of evolution, making the theory useless. Instead how you should understand it is this: If something is an advantage (generally) it will survive compared to something that is a disadvantage. Thus things that are an advantage live on, slowly weeding out the disadvantages. No one has pre-decided what will be the advantage and what will be the disadvantage like it is imagined when you talk of intelligent design.
Taken from wiki:In biology, evolution is change in the inherited traits of a population of organisms from one generation to the next.
Traits can mean pretty much anything not just genetic traits.
Reputation, altruism, emotions, empathy and sympathy and reasoning are not confined to humans as most people think. Think of it this way, you have a pack of wolves, they live together so they can work as a team to take down large beasts for food and to protect each other... if they didn't have emotions or reputation or reasoning what would stop them from ripping each other apart violently for absolutely no reason?
Vampire bats are probably the easiest explanation of a system of reputation in lower animals. Vampire bats share blood with each other in order to help each other survive, now you may ask, whats stopping one bat from just living off the blood everyone feeds him as opposed to actually going out and finding/working for his own food? The answer is that the bats remember each other by smell alone. If they remember a bat was generous and helped them out with food they will return the favor. If they remember a bat which takes more blood than they give to the society (or just takes) then they don't give that bat a helping hand. They will even go as far as to ostracize the bats who "cheat the system".
Now what does this have to do with evolution? Well say your a starving bat and no one helps you, you die, so you don't pass on your genes to the next generation. But say your starving and your a nice bat and your batty friends come to help you and you live to fight another day and mate and pass on your genes, then the "nice" genes are favored by natural selection. Considering all living creatures want to survive, the bats will want to share food with each other because it increases there survival.
That is the basic concept of "good" and "bad", altruism, looked at in a darwinistic sense. I'm not going to say that the bats have morals and think and reason about what they are doing like humans, its probably just basic instinct. What I'll do instead is list a few gradually more complex forms of social values in animals to show how it little by little gets closer to the level of human morals and reasoning.
Next is a bird that I can not ever remember the name of (which pisses me off to no end because I use this example all the time lol) but basically it has a system of reputation where by the bird who sticks its neck out for the flock by being the "sentinel" or watch tower against other birds of pray, is considered the dominant member of the pack. Because he is doing something so dangerous he has the respect of his peers and also of the women, meaning he gets lots of action and thus gets to pass on his genes more regularly.
Next there are dogs, who love their masters more than themselves, who will defend you at the drop of a hat ect, another example of altruism.
Then we have apes like chimpanzees and gorillas which are a whole world apart from the lesser animals... ...Ok I'm slowly getting bored of typing so if you want to know more I shall link you stuff to read instead Chapters 3 - 6 comment on what I'm saying
But basically what I'm trying to demonstrate is that showing good will, looking out for your peers, helping them when they are in need, mutual aid, sympathy, empathy, shame and approval are evident in animals. To have the approval of your peers is a beneficial thing to your survival.
Now this brings us to another thing you may not of heard of. Sexual selection
. As opposed to just competing with your environment to survive, sexual selection is competing with your own species to mate, this also has an effect on your morals because generally the females would not mate with the "cheats" of the society and thus the cheats/immoral would not pass on their genes.
So yeah basically morals have gradually developed through natural selection to the level that they are in humans today. Think about why we feel shame when we do something like steal and why we feel proud when we work hard. Why we love those close to us and why we hate that which threatens us... think about it (or better yet READ about it) and you will understand how it all comes to play as survival apart of the survival tools which made us as we are today.
tl; dr: Read books on science dumbasses!