On Mon, Oct 19, 2009 at 5:07 AM, Heiko Schulz <aeitsch...@yahoo.de> wrote:

> Hello all,
>
>
> > Hello,
> >
> > here is another snapshot while flying which demonstrates
> > the problem quite
> > well:
> >
> > http://www.martinlaabs.de/tmp/fgfs-screen-006.png
> >
> > Greetings,
> >   Martin L.
> >
>
> I have sometimes the same problems using Terragear terrain but not beeing
> connected to the server. (so not fetching tiles, but using the fetched tiles
> instead)
>
> It seems indeed to me, that tile actually under and nearest to the aircraft
> disappears, and appears again when it is  in a certain distance.
>
> In the moment I don't have this problem using CVS from 09/13/2009, but with
> some older binaries I had this problem.
>

I don't have time today to check this again, but previously I could reliably
trigger this bug by flying from KBOS to KJFK.  Somewhere about halfway I
started seeing the problem, and by the time I would get to JFK, the tiles
would be missing more than they were present.

At the time I convinced myself this is a tile caching bug.  Originally tiles
were flushed out of the cache based on their distance from the current view
point.  Along the way this got changed to a time based system so that the
most recently used tiles were highest priority in the cache.  (This makes
some sense if the view point can jump around significantly like between the
tower and the aircraft when the two are far apart.)

Then during the OSG port, this got further modified so that only tiles that
were drawn got their time stamps updated.  (That sounded like a good idea at
least on paper.)  This unfortunately led to a race condition that could
cause a tile to be unloaded before it was properly scheduled.  Even worse,
the current tile that you are over the top of could be missing when you did
a reposition, and because it had already been scheduled for loading, it was
never scheduled again.  But in the mean time it had been flushed from the
cache so it was no longer there.  Oh, and by the way, the FDM needed a
ground height query to succeed before it could re-init, so this led to a
deadlock and hang.  We did a small bit of massage on the OSG logic and that
fixed the one reliable test case I had at the time.

However, a similar missing tile problem resurfaced later on during a
KBOS->KJFK flight.

So I still think this is a tile caching issue.  The contributing factors to
consider (I think) are:

- time based aging of cache entries may not be the best approach, especially
in a situation where you could potentially remove a tile that is literally
underneath you if it's never actually entered the view frustum. Also
considering that an aircraft could turn 180 degrees suddenly, a distance
base cache "aging" scheme might be better?

- The AI and multplayer system?  Since all the cache aging code was written,
we've added features for doing terrain height queries.  AI aircraft and even
nasal scripts can now query the terrain system to return the terrain height
for any arbitrary location or even the terrain intersection with any
aribitrary vector.  Could this code be causing tiles from outside the view
to get referenced and then tiles underneath the viewer end up getting
removed to make room?  Do we need to think through the tile intersection
query semantics in the context of the tile cache scheme to make sure we
haven't overlooked something?

These are my thoughts ... I haven't had a chance to fully investigate.  It
would be great if some of you seeing the problem could try the KBOS->KJFK
route to see if this triggers the bug for you.  And those of you who haven't
seen this problem could try the flight as well to see if you also have this
bug.

Thanks,

Curt.
-- 
Curtis Olson: http://baron.flightgear.org/~curt/
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to