Both. A story presents characters with roles the characters are supposed to fill. If you have a good story but bad characters, then it will be apparent that the above is the case. If you have bad story but good characters, then it will be clear that there exist barely any roles for the characters to fill. When you have a good story and good characters, only then will you be fully able to see the characters as an integral part of the story, while it's still not apparent that they are simply filling a role (VNs are generally terrible at this by choice, especially when it comes to moege)