How do you help kids play nice

Kids usually get caught up playing and don't understand when they hurt someone. They think everything is fun and games the thing is I'd like children to be aware of themselves and if a child got hurt for them to feel some form of compassion and responsibility.