Establish the harmony -- the environment that the tune exists in -- with the bassline. The simplest bassline you can play is to take the name of the chords that define the harmony and play these notes. For example, a blues tune in E will have some measures -- sequence of four beats -- in the E chord, and some other measures in the A chord. There will also be a few measures in the B chord. Just playing the E, A and B notes at the appropriate times will make an adequate -- but somewhat boring -- bassline. Most bass players think of playing the chord names as the starting place to develop a bassline.
Mark the rhythm. The bass establishes the harmony but it also marks the rhythm. For example, in a 4/4 tune the bass will likely play a note on the first and third beats of each measure -- marking the first beat louder than the third beat. Good dancers listen to the bass -- even if it is subconsciously. For 3/4 tunes a bass may mark the first beat of a measure and not the other two beats.
Invent a small melodic pattern to fit each measure to bring a bassline to life. Bass players often make up a rhythmic pattern that spans the measure and will play this figure transposed into all -- or many of -- the chords of the harmony. A good way to create these melodic figures is to consider the other note of the harmony -- not just the chord name. For example, if you are playing a tune in E, the E chord actually contains three notes: E, G# and B. Adding the G# and B to the E measure -- usually off the main beats, makes the bassline more flowing and interesting.