implementing game thread