An ex-police officer killed at least 37 people at a childcare centre before killing himself and his family.