Using Smoothed Particle Radiation Magnetohydrodynamics to Explore How Protostars are Formed