The origins of communal roosting behaviour in birds