A bass player needs to wear two hats, has two responsibilities when putting his or her part in a song. Providing rhythm (laying down and holding a solid groove), and tonal foundation (playing the right note(s) for the rest of the band to play melody and chords over). Pretty simple. The fun part is when the band is in the groove, you listen less to what you are playing and hear what the band, as a whole, sounds like. If everyone is doing they're job, the band should sound like one, cohesive unit, or team. You have a song, rather than a bunch of people trying doing they're own thing for they're own personal agenda. And there is the point. When I'm playing a song, I don't want to be the center of attention, I'm giving my best for the greater good of the song.
Now, it goes without saying, if you don't have rhythm, don't pick up the bass. It's almost a religious experience when the beat takes on a life of it's own. I remember when I was in P.E. class in elementary school and I had to hold myself up at nose level on the chin-up bar. After about a minute or so, my arms locked up, took over, effortlessly, and, for mabey couple of minutes, held me in place. Well, holding down the groove is much the same thing. At first it takes some effort and detirmination to hold the groove in place, but, once it is there it takes on a life of it's own. If you don't take care of the groove, it gets upset. It might slow down and decide to take it's own sweet time, or, it might get impatient and try to get the song over with by speeding up, and sometimes it just gets fed up and leaves altogether. When that happens to a band, I refer to that as a "train wreck".
Be disciplined. Be respectfull to the groove and it will respond in kind. During your personal practice time, use a metrimome. When recording, use a click track. When playing live, listen.
Now, concerning playing the tonal foundation, usually the root, third, and fifth notes of the chord, it's important to establish these notes when creating your own bass lines. When playing cover tunes, well, obviously, play the line that is on the recording. I can't imagine any bass player "doing their own thing" while playing the bassline for a Bob Marley tune.
When it comes to writing your own basslines for original songs, the K.I.S.S. method is always best. You know, put on some make-up and stick out your tongue. Just kidding. Keep It Simple Stupid. Unless you have a reasonable command of music theory, or a heap of natural ability, make sure that the bass line is maintaining a supportive role for the rest of the band. And establish the groove with the drummer. "GET ON THE BEAT, OR GET ON THE BUS."
These are the basics. Yet, from the beginner to the hardened professional, these things are the building blocks for the enjoyment and wonder of making music.
So, for the person who wants to take their bass appreciation a step further, I strongly recommend, right now, find a copy or mp3 of Marvin Gayes, "What's Going On", and really listen to the genius of James Jamerson's bass line. Also, keep in mind that, when James Jamerson recorded this, he had been sitting in a bar waiting for his turn to record the bass part for the song. He was so drunk that he couldn't sit in the chair without falling over. So, he recorded this bass line, lying on his back, on the floor.