faiface / pixel

A hand-crafted 2D game library in Go
MIT License
4.46k stars 246 forks source link

Quadtree implementation #248

Closed jakubDoka closed 4 years ago

orsinium commented 4 years ago

I think it should be a separate library rather than included in pixel. Right now, pixel is simple and doesn't provide any data structures or game-dev specific algorithms. It provides only a few geometric primitives, means to create a window, means to draw on Canvas, and wrappers to make it more efficient (imdraw, atlas, batch). And that's all! And it's essential for every project. However, Quadtree is quite specific and needed only in some cases, it is a data structure, it's hard to learn, and it's not related to the pixel. It even can be implemented without external dependencies because built-in image already provides Rectangle and Point structs.

Chillance commented 4 years ago

I think it should be a separate library rather than included in pixel. Right now, pixel is simple and doesn't provide any data structures or game-dev specific algorithms. It provides only a few geometric primitives, means to create a window, means to draw on Canvas, and wrappers to make it more efficient (imdraw, atlas, batch). And that's all! And it's essential for every project. However, Quadtree is quite specific and needed only in some cases, it is a data structure, it's hard to learn, and it's not related to the pixel. It even can be implemented without external dependencies because built-in image already provides Rectangle and Point structs.

So, be able to include it as an "Pixel extension" then? That would have been nice. Basically this would depend on Pixel, but just extend Pixel's core functionality. Would be nice if these "Pixel extensions" were easily found, so added to Pixel's readme or something.