In this paper we design a numerical scheme for approximating backward doubly stochastic differential equations which represent a solution to stochastic partial differential equations. We first use a time discretization and then we decompose the value function on a functions basis. The functions are deterministic and depend only on time-space variables, while decomposition coefficients depend on the external Brownian motion $B$. The coefficients are evaluated through an empirical regression scheme, which is performed conditionally to $B$. We establish nonasymptotic error estimates, conditionally to $B$, and deduce how to tune parameters to obtain a convergence conditionally and unconditionally to $B$. We provide numerical experiments as well.