The Fugue

Counterpoint by Hans Fugal

TerraSync Prefetch

Posted by Hans Fugal Tue, 05 Jun 2007 16:54:38 GMT

TerraSync is a nice little utility included with FlightGear that downloads scenery on the fly. It works like a charm, but there's one caveat. FlightGear wants the scenery right now and TerraSync needs to download it first, therefore the first time you start FlightGear in a new area (or "teleport" there), you won't have scenery. TerraSync will be busily downloading it in the background, though, so you just restart FlightGear a minute later, et voilá! But starting FlightGear that first time is a waste of time, since it takes forever to parse its config files and do a bunch of other stuff before it even tries to get the scenery. So I wrote a little shell script to do the job quicker.

Incidentally, this is the script I use to start FlightGear. It starts TerraSync if it's not already running:

#!/bin/sh
PORT=5500
FG_HOME=$HOME/.fgfs
FG_ROOT=/usr/local/share/FlightGear
TERRASYNC_DIR=$FG_HOME/Scenery
FG_SCENERY=$TERRASYNC_DIR:$FG_ROOT/Scenery

pgrep terrasync || \
nice terrasync -p $PORT -d $TERRASYNC_DIR >> $FG_HOME/terrasync.log &

/usr/local/bin/fgfs --atlas=socket,out,1,localhost,$PORT,udp $*

2 comments | Tags , | atom

Comments

Leave a response

  1. momomoko
    2 months later:

    so if i type terrasync-prefetch.sh into the command shell and start flight gear will it work? (sorry if its a noob question)

  2. Hans
    2 months later:

    Yes, download it, then type:

      chmod 755 terrasync-prefetch.sh
      ./terrasync-prefetch.sh
    

Leave a comment