If you play in a band or intend to play in a band, it is essential that you do some work every day on creating bass lines that work with specific drum parts. Because you can’t always work with a drummer, it is a good idea to buy a drum machine and program your own drum beats into it.
Playing along with a drum machine will improve your timing and enable you to focus on the drums more easily when you are in a band situation. Another advantage of using a drum machine is that it enables you to experiment and go through the trial and error process of working out where to play with a particular drum part and where to play in between the drum notes for each new drum beat you work with. When you play with a drum part, remember to leave space for the other instrumental parts instead of playing every available note in the bar. Bass players who can lock in well with a drummer without overplaying are always in demand.
When practicing parts for songs, play the basic groove over and over until you can do it easily in a relaxed manner and you feel good playing it. Then try adding a few fills and variations. If you are not comfortable doing a particular part, analyze what it is you are having difficulty with and then work on that part over and over with the drum machine, counting out loud as you play until you can do it easily. When you are practicing, experimentation is great because it enables you to come up with new parts. However, when you come to playing a song live, it is often better to go with parts you already know well (unless you are soloing or are in an improvised section of a song) Once again, underplay rather than overplay. The bottom line is that the time should always be strong and solid and the groove should feel good.