protected void doTickUpdate() {
        try {
            // If there is no ship, don't do anything.
            if (ship == null || state != WAIT_PLAYING || hud == null) {
                return;
            }
            // Call the ship update.
            ship.doShipTickUpdate();
            // Update the Heads Up Display.
            hud.updateHud();
            // Clear the message queue.
            for (int x = 0; x < messageQueue.size(); x++) {
                String theMessage = (String) messageQueue.elementAt(x);
                this.sendMessage(theMessage);
            }
            messageQueue.clear();
        } catch (Exception e) {
            TrekLog.logException(e);
            kill();
        }

        sendOutputBuffer();

    }