start of core game loop