Posts: 721
	Threads: 77
	Joined: Apr 2014
	
Thanks: 113
	Given 131 thank(s) in 92 post(s)
	 
	
	
		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?
	
	
	
	
	
 
 
	
	
	
		
	Posts: 6,482
	Threads: 176
	Joined: Jan 2012
	
Thanks: 131
	Given 1085 thank(s) in 857 post(s)
	 
	
	
		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.
	
	
	
	
	
 
 
	
	
	
		
	Posts: 721
	Threads: 77
	Joined: Apr 2014
	
Thanks: 113
	Given 131 thank(s) in 92 post(s)
	 
	
	
		Thanks.
It should be noted that cLineBlockTracer also lacks a constructor which accepts a chunk instead of a world.