Why doesn't cTracer use Chunks?
#1
I've been inspecting cTracer in an attempt to fix some mob line-of-sight issues, and I noticed that it doesn't use Chunks at all. Instead, it queries cWorld directly for blocks using m_World->GetBlock().

Is there any performance difference between querying a chunk for blocks and querying the World for blocks? And why do we need both approaches?
Reply
Thanks given by:
#2
The cTracer class had been written before the chunks were made available. It is a somewhat legacy API; if you can change its usage to cLineBlockTracer instead, that would be great.

The performance hasn't been measured, but is assumed to be better with the direct chunk approach. Getting a single block from cWorld requires the underlying cChunkMap to lock a mutex, find the chunk to which the block belongs (a linear list search of the cChunkLayer objects), then query the chunk in the same way as the direct approach does.
Reply
Thanks given by:
#3
Thanks.
It should be noted that cLineBlockTracer also lacks a constructor which accepts a chunk instead of a world.
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)