andrew-peng-144 / js-explore-game

0 stars 0 forks source link

cleaner/faster grid physics. #1

Open andrew-peng-144 opened 3 years ago

andrew-peng-144 commented 3 years ago

WOW! dont always iterate thru each tile every time. for a 50x50 its already ~2500 wasted computations per frame.

andrew-peng-144 commented 3 years ago

currently using 1d array of "buckets", each bucket having 10 numbers max representing the entities in that cell. possible solutions:

andrew-peng-144 commented 3 years ago

or just use fewer cells. Cell size increased to 32x32 instead of 16x16 (unzoomed) pixels, this lowers number of cells by factor of 4, but has a lower maximum # of entities.