bryanedds / Nu

Repository hosting the open-source Nu Game Engine and related projects.
MIT License
1.05k stars 151 forks source link

Getting a likely incorrect tile layer strip calculation, perhaps due to precision error. #766

Closed bryanedds closed 2 months ago

bryanedds commented 3 months ago

Scrolling up just a bit on the BlazeVector scene will result in this rendering error -

image

I'm guessing the issue is in the way that the algorithm in TmxMap.getLayeredMessages2d is still precision-sensitive.

I think I've seen this pop up in other tile map viewing scenarios as well.

bryanedds commented 3 months ago

So one reason this is hard to fix is that, perhaps surprisingly, the tile strip computation code is some of the most complex in this engine. I think it's complex because I try to compute only the tiles that are in view for efficiency.

One possibility - use lazy eval programming and just write the naive code, then see if we can eval just the parts that will produce the tile computations we actually need. This will probably produce more GC pressure but I think for 2D games, won't matter.