Individual-based modelling of biofilms accounts for the fact that individual organisms of the same species may well be in a different physiological state as a result of environmental gradients, lag times in responding to change, or noise in gene expression, which we have become increasingly aware of with the advent of single-cell microbiology. But progress in developing and using individual-based modelling has been hampered by different groups writing their own code and the lack of an available standard model. We therefore set out to merge most features of previous models and incorporate various improvements in order to provide a common basis for further developments. Four improvements stand out: the biofilm pressure field allows for shrinking or consolidating biofilms; the continuous-in-time extracellular polymeric substances excretion leads to more realistic fluid behaviour of the extracellular matrix, avoiding artefacts; the stochastic chemostat mode allows comparison of spatially uniform and heterogeneous systems; and the separation of growth kinetics from the individual cell allows condition-dependent switching of metabolism. As an illustration of the model's use, we used the latter feature to study how environmentally fluctuating oxygen availability affects the diversity and composition of a community of denitrifying bacteria that induce the denitrification pathway under anoxic or low oxygen conditions. We tested the hypothesis that the existence of these diverse strategies of denitrification can be explained solely by assuming that faster response incurs higher costs. We found that if the ability to switch metabolic pathways quickly incurs no costs the fastest responder is always the best. However, if there is a trade-off where faster switching incurs higher costs, then there is a strategy with optimal response time for any frequency of environmental fluctuations, suggesting that different types of denitrifying strategies win in different environments. In a single environment, biodiversity of denitrifiers is higher in biofilms than chemostats, higher with than without costs and higher at intermediate frequency of change. The highly modular nature of the new computational model made this case study straightforward to implement, and reflects the sort of novel studies that can easily be executed with the new model.