Настроение: | accomplished |
Entry tags: | computing |
Moving the terrain arrays to ECS...
Beside efficient bitmaps, implementing world map cells as entities requires a way to allocate entity ids at a specific continuous range and to reserve that range in advance. But a continuous range of memory addresses is usually called "array"! In our case sparse columnar array, which itself can be implemented using `cls` (columnar struct classifier macro):
//array of columnar objects
cls cla n: = newIds_ $n
@as_text = "$<cla:[$id]:[$n]>"
@'.' K = (fxn $id + 1 + K).as_id.trycls
Of course instead of 10 I can easily do 1000*1000*1000, with most cells being empty