Java: What is a good data structure for storing a coordinate map for an infinite game world?

前端 未结 11 1306
心在旅途
心在旅途 2020-12-23 11:35

I am used to coding in PHP but I am not really proficient with Java and this has been a problem for some time now. I expect it to be a fairly easy solution, however I cannot

11条回答
  •  北海茫月
    2020-12-23 11:52

    If you want to be really fast and really scalable definitely go with a Sparse Octree.

    http://en.wikipedia.org/wiki/Octree

    I am not aware of any implementations in Java, but it is trivial. Just store in a single byte a bitfield for which nodes are currently linked and use a linked list to keep those references (for each Octree-node a separate list of max. 8 entries).

提交回复
热议问题